/* Nano Banana Pro 图像生成器 - 样式文件 */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --fabric-base: #f4f1ea;
  --fabric-light: #fdfbf7;
  --primary: #5c7c8a;
  --primary-hover: #4a6572;
  --accent: #d97d54;
  --text-main: #4a4a4a;
  --text-sub: #8c8880;
  --stitch-color: #d4cbb8;
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--fabric-base);
  background-image: 
    linear-gradient(45deg, rgba(0,0,0,0.02) 25%, transparent 25%, transparent 75%, rgba(0,0,0,0.02) 75%),
    linear-gradient(45deg, rgba(0,0,0,0.02) 25%, transparent 25%, transparent 75%, rgba(0,0,0,0.02) 75%);
  background-size: 20px 20px;
  background-position: 0 0, 10px 10px;
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ==================== 页面头部 - 居中显示 ==================== */
.page-header {
  text-align: center;
  padding: 40px 20px 30px;
  margin-bottom: 20px;
}

.page-header h1 {
  font-size: 36px;
  font-weight: 700;
  color: var(--text-main);
  text-shadow: 2px 2px 0px rgba(255,255,255,0.8);
}

.page-header p { 
  color: var(--text-sub); 
  font-size: 16px; 
  margin-top: 8px; 
}

/* ==================== 积分和设置显示 ==================== */
.credits-display-inline {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  position: relative;
  z-index: 3;
}

.credits-info {
  background: rgba(92, 124, 138, 0.08);
  border: 2px solid var(--stitch-color);
  padding: 14px 24px;
  border-radius: 10px;
  font-weight: 600;
  flex: 1;
  font-size: 16px;
}

.credits-info .amount {
  color: var(--primary);
  font-size: 22px;
  margin-left: 8px;
  font-weight: 700;
}

.settings-btn {
  background: var(--primary);
  border: none;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  transition: all 0.24s;
  box-shadow: 0 4px 12px rgba(92, 124, 138, 0.3);
  flex-shrink: 0;
}

.settings-btn:hover {
  background: var(--primary-hover);
  transform: scale(1.05);
}

/* ==================== 设置弹窗 ==================== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: var(--fabric-light);
  border-radius: 16px;
  padding: 40px;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  position: relative;
}

.modal-content::after {
  content: '';
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  bottom: 12px;
  border: 2px dashed var(--stitch-color);
  border-radius: 12px;
  pointer-events: none;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  position: relative;
  z-index: 3;
}

.modal-header h2 {
  font-size: 24px;
  color: var(--primary);
}

.close-btn {
  background: none;
  border: none;
  font-size: 28px;
  color: var(--text-sub);
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.24s;
}

.close-btn:hover {
  color: var(--accent);
  transform: rotate(90deg);
}

.modal-body {
  position: relative;
  z-index: 3;
}

.card-status {
  background: rgba(92, 124, 138, 0.1);
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.card-status p {
  margin: 8px 0;
  font-size: 14px;
}

.card-status .label {
  color: var(--text-sub);
  display: inline-block;
  width: 80px;
}

.card-status .value {
  color: var(--text-main);
  font-weight: 600;
}

.logout-btn {
  width: 100%;
  background: var(--text-sub);
  border: none;
  border-radius: 12px;
  padding: 16px;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.24s;
}

.logout-btn:hover {
  background: #c0392b;
}

/* ==================== 主容器 - 左右布局 ==================== */
.main-container {
  display: flex;
  gap: 20px;
  padding: 0 60px 20px;
  align-items: stretch;
  max-width: 1600px;
  margin: 0 auto;
}

/* 左侧操作面板 */
.left-panel {
  width: 520px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

/* 右侧画廊面板 */
.right-panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ==================== 卡片 ==================== */
.card {
  background: var(--fabric-light);
  border-radius: 16px;
  padding: 40px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05), 0 8px 24px rgba(92, 85, 75, 0.06);
  border: 1px solid #fff;
  position: relative;
}

.card::after {
  content: '';
  position: absolute;
  top: 12px; left: 12px; right: 12px; bottom: 12px;
  border: 2px dashed var(--stitch-color);
  border-radius: 12px;
  pointer-events: none;
}

/* ==================== 输入组 ==================== */
.input-group {
  margin-bottom: 28px;
  position: relative;
  z-index: 3;
}

.input-group label {
  display: block;
  margin-bottom: 12px;
  font-weight: 700;
  font-size: 14px;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.input-group input,
.input-group textarea {
  width: 100%;
  background: #f0ede6;
  border: none;
  border-bottom: 2px solid var(--stitch-color);
  border-radius: 8px 8px 0 0;
  padding: 18px;
  color: var(--text-main);
  font-size: 15px;
  font-family: inherit;
  transition: all 0.24s;
  box-shadow: inset 0 2px 6px rgba(92, 85, 75, 0.12);
  resize: vertical;
}

.input-group input:focus,
.input-group textarea:focus {
  outline: none;
  background: #fff;
  border-bottom-color: var(--primary);
  box-shadow: 0 4px 12px rgba(92, 124, 138, 0.1);
}

/* ==================== 比例和分辨率按钮 ==================== */
.aspect-ratio-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.aspect-btn {
  background: transparent;
  border: 2px solid var(--stitch-color);
  border-radius: 6px;
  padding: 12px 8px;
  color: var(--text-sub);
  cursor: pointer;
  transition: all 0.24s;
  font-size: 14px;
  line-height: 1.4;
}

.aspect-btn small {
  font-size: 12px;
  display: block;
  margin-top: 2px;
}

.aspect-btn:hover {
  border-color: var(--primary-hover);
  color: var(--primary-hover);
  background: rgba(92, 124, 138, 0.05);
}

.aspect-btn.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(92, 124, 138, 0.3);
}

.resolution-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.resolution-btn {
  background: transparent;
  border: 2px solid var(--stitch-color);
  border-radius: 6px;
  padding: 14px 10px;
  color: var(--text-sub);
  cursor: pointer;
  transition: all 0.24s;
  font-size: 14px;
  line-height: 1.5;
}

.resolution-btn small {
  font-size: 12px;
  display: block;
  margin-top: 3px;
}

.resolution-btn:hover {
  border-color: var(--primary-hover);
  color: var(--primary-hover);
  background: rgba(92, 124, 138, 0.05);
}

.resolution-btn.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(92, 124, 138, 0.3);
}

/* ==================== 生成按钮 ==================== */
.generate-btn {
  width: 100%;
  background: var(--accent);
  border: none;
  border-radius: 12px;
  padding: 18px;
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.24s;
  box-shadow: 0 4px 0 #b5603b, 0 8px 16px rgba(181, 96, 59, 0.3);
  z-index: 5;
  position: relative;
}

.generate-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #b5603b, 0 12px 20px rgba(181, 96, 59, 0.4);
}

.generate-btn:disabled {
  background: var(--text-sub);
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.7;
}

/* ==================== 状态提示 ==================== */
.status {
  text-align: center;
  padding: 14px;
  margin-top: 18px;
  font-size: 14px;
  color: var(--text-sub);
  background: rgba(0,0,0,0.03);
  border-radius: 4px;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.status:empty {
  visibility: hidden;
}

.status.processing { color: var(--primary); border-left: 4px solid var(--primary); }
.status.error { color: #c0392b; border-left: 4px solid #c0392b; }

/* ==================== 画廊区域 ==================== */
.gallery-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.gallery-title {
  margin-bottom: 20px;
  font-size: 24px;
  color: var(--primary);
  position: relative;
  z-index: 3;
  flex-shrink: 0;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  position: relative;
  z-index: 3;
  padding-right: 8px;
  flex: 1;
  overflow: hidden;
  align-content: start;
  min-height: 0;
}

.gallery-item {
  background: #fff;
  padding: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  transform: rotate(-1deg);
  transition: all 0.24s;
  position: relative;
  cursor: pointer;
  display: grid;
  grid-template-rows: 1fr auto;
  border-radius: 4px;
  aspect-ratio: 1;
  width: 100%;
  overflow: hidden;
}

.gallery-item:nth-child(even) { 
  transform: rotate(1deg); 
}

.gallery-item:hover {
  transform: rotate(0) scale(1.05);
  box-shadow: 0 12px 24px rgba(0,0,0,0.15);
  z-index: 10;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border: 1px solid rgba(0,0,0,0.05);
  cursor: pointer;
  display: block;
  min-height: 0;
}

.gallery-item .info {
  padding-top: 8px;
  display: grid;
  grid-template-rows: auto auto;
  gap: 2px;
  height: 36px;
  overflow: hidden;
}

.gallery-item .prompt-text {
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-main);
  line-height: 1.3;
  height: 14px;
}

.gallery-item .timestamp {
  color: #64748b;
  font-size: 9px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
  height: 11px;
}

.gallery-empty {
  grid-column: 1/-1;
  width: 100%;
  text-align: center;
  padding: 80px 20px;
  color: var(--text-sub);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

/* ==================== 分页控制 ==================== */
.pagination-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 2px dashed var(--stitch-color);
  position: relative;
  z-index: 3;
  flex-shrink: 0;
}

.pagination-btn {
  background: var(--primary);
  border: none;
  border-radius: 8px;
  padding: 12px 24px;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.24s;
  box-shadow: 0 2px 8px rgba(92, 124, 138, 0.3);
  min-width: 100px;
  flex-shrink: 0;
}

.pagination-btn:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(92, 124, 138, 0.4);
}

.pagination-btn:disabled {
  background: var(--text-sub);
  cursor: not-allowed;
  opacity: 0.5;
  box-shadow: none;
}

.pagination-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.pagination-info {
  color: var(--text-main);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
}

.save-tip {
  color: var(--accent);
  font-size: 14px;
  text-align: center;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

#dropZone {
  width: 100%;
  min-height: 80px;
  border: 2px dashed var(--stitch-color);
  border-radius: 8px;
  padding: 14px;
  background: var(--fabric-base);
  transition: all 0.24s;
  cursor: pointer;
}

#imagePreviewContainer {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* 隐藏元素 */
.hidden { display: none !important; }

/* 下拉区域内容样式 */
#dropZoneContent {
  text-align: center;
  color: var(--text-sub);
}

#dropZoneContent .icon {
  font-size: 32px;
  margin-bottom: 6px;
}

#dropZoneContent .title {
  font-weight: 600;
  margin-bottom: 4px;
  font-size: 13px;
}

#dropZoneContent .subtitle {
  font-size: 12px;
  opacity: 0.7;
}

/* 图片预览项样式 */
.preview-item {
  position: relative;
  display: inline-block;
}

.preview-item img {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: 6px;
  border: 2px solid var(--stitch-color);
}

.preview-item .remove-btn {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
}

/* 卡密状态值颜色 */
.status-verified {
  color: #27ae60;
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 1600px) {
  .gallery-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 1400px) {
  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 1200px) {
  .main-container {
    flex-direction: column;
    padding: 0 20px 20px;
    max-width: 100%;
  }
  
  .left-panel {
    width: 100%;
  }
  
  .right-panel {
    width: 100%;
    min-height: 600px;
  }
  
  .gallery-card {
    min-height: 600px;
  }
  
  .gallery-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 900px) {
  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .page-header h1 {
    font-size: 28px;
  }
  
  .page-header {
    padding: 30px 20px 20px;
  }
  
  .aspect-ratio-grid { 
    grid-template-columns: repeat(3, 1fr); 
  }
  
  .gallery-card {
    min-height: 500px;
  }
  
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .credits-display-inline {
    flex-direction: column;
    gap: 12px;
  }
  
  .credits-info {
    padding: 12px 16px;
    font-size: 14px;
  }
  
  .credits-info .amount {
    font-size: 18px;
  }
  
  .settings-btn {
    width: 100%;
    height: 48px;
    border-radius: 12px;
    font-size: 18px;
  }
}

@media (max-width: 480px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
