/* 基础样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}


/* 密码保护界面样式 */
.password-protection {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.password-container {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
  text-align: center;
  max-width: 450px;
  width: 90%;
  animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.password-logo {
  font-size: 48px;
  color: #6a11cb;
  margin-bottom: 20px;
}

.password-title {
  font-size: 28px;
  color: #333;
  margin-bottom: 10px;
  font-weight: 600;
}

.password-subtitle {
  color: #666;
  margin-bottom: 30px;
  font-size: 16px;
  line-height: 1.5;
}

.password-form {
  margin-bottom: 20px;
}

.password-input {
  width: 100%;
  padding: 15px 20px;
  border: 2px solid #e1e1e1;
  border-radius: 50px;
  font-size: 16px;
  transition: all 0.3s;
  box-sizing: border-box;
  text-align: center;
  letter-spacing: 2px;
}

.password-input:focus {
  border-color: #6a11cb;
  outline: none;
  box-shadow: 0 0 0 3px rgba(106, 17, 203, 0.2);
}

.password-btn {
  background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
  color: white;
  border: none;
  border-radius: 50px;
  padding: 15px 30px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  width: 100%;
  margin-top: 10px;
}

.password-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 7px 15px rgba(106, 17, 203, 0.3);
}

.password-btn:active {
  transform: translateY(0);
}

.password-error {
  color: #e74c3c;
  margin-top: 15px;
  font-size: 14px;
  display: none;
}

.password-hint {
  color: #999;
  font-size: 13px;
  margin-top: 20px;
}

/* 主内容初始隐藏 */
.container {
  display: none;
}


/* 加载提示 */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1),
    visibility 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.loading-overlay.show {
  opacity: 1;
  visibility: visible;
}

/* 背景粒子效果 */
.particles-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.particle {
  position: absolute;
  border-radius: 50%;
  background: rgba(74, 108, 247, 0.3);
  box-shadow: 0 0 8px rgba(74, 108, 247, 0.5);
  animation: float 8s infinite ease-in-out;
  z-index: 1;
}

/* 加载动画 - 修复居中显示 */
.loading-container {
  position: relative;
  width: 150px;
  height: 150px;
  margin-bottom: 20px;
  z-index: 2;
  display: flex;
  justify-content: center;
  align-items: center;
}

.loading-circle {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: conic-gradient(
    transparent,
    rgba(74, 108, 247, 0.7),
    transparent 30%
  );
  animation: spin 2s linear infinite;
}

.loading-circle::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 85%;
  height: 85%;
  background: white;
  border-radius: 50%;
}

.loading-icon {
  position: relative;
  width: 80%;
  color: #4a6cf7;
  text-shadow: 0 0 10px rgba(74, 108, 247, 0.5);
  z-index: 3;
  animation: pulse 2s infinite ease-in-out;
}

/* 进度指示器 */
.progress-container {
  width: 200px;
  height: 6px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 3px;
  margin: 20px auto 0;
  overflow: hidden;
  z-index: 2;
  position: relative;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #4a6cf7, #8b5cf6);
  border-radius: 3px;
  transition: width 0.5s ease;
  animation: progress 3s infinite ease-in-out;
}

/* 文字效果容器 */
.loading-text-container {
  min-height: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2;
  position: relative;
}

.loading-text {
  color: #2d3748;
  font-size: 1.3rem;
  text-align: center;
  min-height: 1.8em;
  font-weight: 500;
  letter-spacing: 0.5px;
}

.loading-subtext {
  color: #718096;
  font-size: 0.9rem;
  text-align: center;
  margin-top: 10px;
  font-weight: 400;
}

/* 加载卡片 */
.loading-card {
  background: white;
  border-radius: 16px;
  padding: 30px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(74, 108, 247, 0.1);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* 文字流光效果 */
.loading-char {
  display: inline-block;
  animation: glow 2s infinite ease-in-out;
  opacity: 0.9;
}

.loading-char:nth-child(2) {
  animation-delay: 0.1s;
}

.loading-char:nth-child(3) {
  animation-delay: 0.2s;
}

.loading-char:nth-child(4) {
  animation-delay: 0.3s;
}

.loading-char:nth-child(5) {
  animation-delay: 0.4s;
}

.loading-char:nth-child(6) {
  animation-delay: 0.5s;
}

.loading-char:nth-child(7) {
  animation-delay: 0.6s;
}

.loading-char:nth-child(8) {
  animation-delay: 0.7s;
}

.loading-char:nth-child(9) {
  animation-delay: 0.8s;
}

.loading-char:nth-child(10) {
  animation-delay: 0.9s;
}

/* 动画定义 */
@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.1);
    opacity: 1;
  }
}

@keyframes glow {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.7;
    text-shadow: 0 0 3px rgba(74, 108, 247, 0.3);
  }
  50% {
    transform: translateY(-3px);
    opacity: 1;
    text-shadow: 0 0 8px rgba(74, 108, 247, 0.5);
  }
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0) translateX(0);
  }
  25% {
    transform: translateY(-20px) translateX(10px);
  }
  50% {
    transform: translateY(0) translateX(20px);
  }
  75% {
    transform: translateY(20px) translateX(10px);
  }
}

@keyframes progress {
  0% {
    width: 0%;
  }
  50% {
    width: 80%;
  }
  100% {
    width: 100%;
  }
}

body {
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  color: #333;
  line-height: 1.6;
  min-height: 100vh;
  padding: 10px 20px 20px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

/* 头部样式 */
header {
  text-align: center;
  margin-bottom: 30px;
  width: 100%;
}

.logo {
  font-size: 2.5rem;
  color: #4a6cf7;
  margin-bottom: 10px;
}

h1 {
  font-size: 2.2rem;
  color: #2d3748;
  margin-bottom: 10px;
}

.subtitle {
  font-size: 1.1rem;
  color: #718096;
  max-width: 600px;
  margin: 0 auto;
}

/* 主内容区域 */
.main-content {
  display: flex;
  flex-wrap: wrap;
  gap: 30px;
  justify-content: center;
  width: 100%;
}

/* 表单区域 */
.form-container {
  background: white;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  padding: 30px;
  flex: 1;
  min-width: 300px;
  max-width: 500px;
}

.form-title {
  font-size: 1.8rem;
  color: #2d3748;
  margin-bottom: 25px;
  text-align: center;
  position: relative;
  padding-bottom: 15px;
}

.form-title::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 4px;
  background: #4a6cf7;
  border-radius: 2px;
}

.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #4a5568;
}

/* 拍照区域样式 - 修改为支持图片预览 */
.camera-section {
  margin-bottom: 25px;
}

.camera-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 25px;
  border: 2px dashed #cbd5e0;
  border-radius: 12px;
  background: #f8fafc;
  color: #4a5568;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  min-height: 150px;
}

.camera-btn:hover {
  border-color: #4a6cf7;
  background: #f0f4ff;
  color: #4a6cf7;
}

.camera-btn.uploaded {
  border: none;
  background: white;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.camera-icon {
  font-size: 3rem;
  margin-bottom: 15px;
}

.camera-text {
  font-size: 1.2rem;
  font-weight: 600;
}

/* 上传图片预览样式 */
.uploaded-preview {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  overflow: hidden;
  display: none;
  justify-content: center;
  align-items: center;
  background: white;
}

.uploaded-image {
  max-width: 80%;
  max-height: 80%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
}

.change-photo-btn {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border: none;
  border-radius: 20px;
  padding: 5px 10px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 2;
}

.change-photo-btn:hover {
  background: rgba(0, 0, 0, 0.9);
}

.file-input {
  display: none;
}

/* 样本图区域 - 修复移动端问题 */
.sample-section {
  margin-bottom: 25px;
}

.sample-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.sample-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: #4a5568;
}

.sample-nav {
  display: flex;
  gap: 10px;
}

.nav-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #f1f5f9;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-btn:hover {
  background: #e2e8f0;
}

.nav-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.sample-container {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  width: 100%;
}

.sample-track {
  display: flex;
  transition: transform 0.3s ease;
  width: 100%;
}

.sample-item {
  flex: 0 0 31.5%;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  margin-right: 10px;
  margin-top: 5px;
}

.sample-item:last-child {
  margin-right: 0;
}

.sample-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.sample-item.active {
  border: 3px solid #4a6cf7;
  background: #e6eeff;
}

.sample-img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
}

.sample-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 5px;
  font-size: 0.85rem;
  text-align: center;
}

/* 按钮样式 */
.btn {
  display: block;
  width: 100%;
  padding: 14px;
  background: #4a6cf7;
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 10px;
}

.btn:hover {
  background: #3a5bd9;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(74, 108, 247, 0.3);
}

.btn:active {
  transform: translateY(0);
}

/* 图片预览区域 - 上下结构 */
.preview-container {
  background: white;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  padding: 30px;
  flex: 1;
  min-width: 300px;
  max-width: 600px;
  display: flex;
  flex-direction: column;
}

.preview-title {
  font-size: 1.8rem;
  color: #2d3748;
  margin-bottom: 25px;
  text-align: center;
  position: relative;
  padding-bottom: 15px;
}

.preview-title::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 4px;
  background: #4a6cf7;
  border-radius: 2px;
}

/* 上下结构布局 */
.preview-vertical {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.preview-original {
  text-align: center;
}

.preview-original h3 {
  margin-bottom: 15px;
  color: #4a5568;
  font-size: 1.2rem;
}

.preview-results {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.preview-results h3 {
  color: #4a5568;
  font-size: 1.2rem;
  text-align: center;
}

/* 优化AI处理效果区域 - 移动端适配 */
.result-images {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 15px;
}

/* 效果图片区域样式 */
.result-item {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  height: auto;
}

.result-label {
  font-size: 0.9rem;
  color: #4a5568;
  font-weight: 500;
  padding: 5px;
  background: #f8fafc;
  border-radius: 6px;
  margin-top: 5px;
}

.image-placeholder {
  width: 100%;
  height: 180px;
  background: #f8fafc;
  border: none;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #a0aec0;
  transition: all 0.3s ease;
}

.image-placeholder i {
  font-size: 2.5rem;
  margin-bottom: 10px;
}

.image-placeholder:hover {
  color: #4a6cf7;
}

/* 原始图片容器 */
.original-image-container {
  width: 180px;
  height: 180px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #f8fafc;
  border: 2px dashed #cbd5e0;
  border-radius: 12px;
  overflow: hidden;
  margin: 0 auto;
  transition: all 0.3s ease;
}

/* 添加上传成功后的样式 */
.original-image-container.uploaded {
  border: none;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.original-image {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: none;
}

/* 优化AI处理结果图片样式 - 宽度100%，高度自适应 */
.result-image {
  width: 100%;
  height: auto;
  max-height: none;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  display: none;
  transition: transform 0.3s ease;
  cursor: pointer;
}

.result-image:hover {
  transform: scale(1.05);
}

/* 响应消息 */
.response-message {
  margin-top: 20px;
  padding: 15px;
  border-radius: 10px;
  text-align: center;
  font-weight: 500;
  display: none;
}

.success {
  background: #c6f6d5;
  color: #22543d;
  display: block;
}

.error {
  background: #fed7d7;
  color: #742a2a;
  display: block;
}

/* 图片放大预览样式 */
.image-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.image-modal.show {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  max-width: 90%;
  max-height: 90%;
  position: relative;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-image {
  max-width: 80%;
  max-height: 80vh;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  transition: transform 0.3s ease;
}

.modal-close {
  position: absolute;
  top: -120px;
  right: -160px;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  color: white;
  font-size: 2rem;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1001;
}

.modal-close:hover {
  background: rgba(0, 0, 0, 0.8);
  transform: scale(1.1);
}

/* 导航按钮样式 */
.modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.5);
  border: none;
  color: white;
  font-size: 2rem;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1001;
}

.modal-nav:hover {
  background: rgba(0, 0, 0, 0.8);
  transform: translateY(-50%) scale(1.1);
}

.modal-prev {
  left: -50px;
}

.modal-next {
  right: -50px;
}

.modal-nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: translateY(-50%);
}

.modal-nav:disabled:hover {
  background: rgba(0, 0, 0, 0.5);
  transform: translateY(-50%);
}

/* 图片计数器 */
.modal-counter {
  position: absolute;
  bottom: -70px;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  font-size: 1.2rem;
  background: rgba(0, 0, 0, 0.5);
  padding: 8px 16px;
  border-radius: 20px;
  z-index: 1001;
}

/* 响应式设计 - 修复移动端产品选择模块 */
@media (max-width: 768px) {
  .main-content {
    flex-direction: column;
  }

  .form-container,
  .preview-container {
    max-width: 100%;
  }

  h1 {
    font-size: 1.8rem;
  }

  .form-title,
  .preview-title {
    font-size: 1.5rem;
  }

  /* 修复产品选择模块在移动端的显示 - 保持每页3个产品 */
  .sample-item {
    flex: 0 0 calc(33.333% - 7px); /* 保持3个产品，调整间距 */
    margin-right: 10px;
  }

  .sample-img {
    height: 100px; /* 在移动端调整图片高度 */
  }

  /* 优化AI处理效果在平板端的显示 */
  .result-images {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .result-item {
    min-height: auto;
  }

  .result-image {
    height: auto;
    width: 100%;
  }

  .image-placeholder {
    height: 160px;
  }

  .original-image-container {
    width: 160px;
    height: 160px;
  }

  .modal-nav {
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
  }

  .modal-prev {
    left: 10px;
  }

  .modal-next {
    right: 10px;
  }

  .modal-close {
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
  }
}

@media (max-width: 480px) {
  body {
    padding: 15px;
  }

  .form-container,
  .preview-container {
    padding: 20px;
  }

  h1 {
    font-size: 1.6rem;
  }

  .logo {
    font-size: 2rem;
  }

  /* 在小屏幕上仍然保持3个产品 */
  .sample-item {
    flex: 0 0 calc(33.333% - 7px);
    margin-right: 10px;
  }

  .sample-img {
    height: 80px; /* 在小屏幕上调整图片高度 */
  }

  /* 优化AI处理效果在手机端的显示 - 单列布局，图片宽度100%高度自适应 */
  .result-images {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .result-item {
    min-height: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .result-image {
    height: auto;
    width: 100%;
    max-width: none;
  }

  .image-placeholder {
    height: 200px;
    width: 100%;
  }

  .result-label {
    font-size: 1rem;
    padding: 8px 12px;
    width: 100%;
  }

  .original-image-container {
    width: 140px;
    height: 140px;
  }

  .modal-image {
    max-width: 95%;
  }

  .modal-nav {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }
}

/* 页脚样式 */
footer {
  margin-top: 40px;
  text-align: center;
  color: #718096;
  font-size: 0.9rem;
  width: 100%;
}
