/* ================================
   商品换色 - 玄猫AI 独立样式文件
   ================================ */

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: #f8fafc;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4 {
  margin: 0;
}

p { margin: 0; }
a { text-decoration: none; color: inherit; }
button { border: none; background: none; cursor: pointer; outline: none; }

/* ================================
   左侧导航栏
   ================================ */
.sidebar-narrow {
  width: 80px;
  background: #fff;
  border-right: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 20px;
  flex-shrink: 0;
}

.sidebar-item {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  color: #64748b;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  border-right: 3px solid transparent;
  box-sizing: border-box;
  text-align: center;
}

.sidebar-item iconify-icon {
  font-size: 24px;
  margin-bottom: 4px;
}

.sidebar-item:hover {
  color: #2563eb;
  background-color: #f1f5f9;
  border-right-color: #2563eb;
}

.sidebar-item.active {
  color: #2563eb;
  background-color: #eff6ff;
  border-right-color: #2563eb;
}

/* ================================
   顶部区域
   ================================ */
.top-bar-wrapper {
  flex-shrink: 0;
  z-index: 50;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  width: 100%;
  overflow: visible;
}

/* 促销条 */
.promo-bar {
  width: 100%;
  background: linear-gradient(to right, #006fee, #8b5cf6, #ec4899);
  color: white;
  padding: 6px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 500;
}

.promo-bar-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.promo-bar span { white-space: nowrap; }
.promo-bar .opacity-50 { opacity: 0.5; }

.btn-recharge {
  background: #fff;
  color: #006fee;
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: background 0.2s;
  white-space: nowrap;
}

.btn-recharge:hover { background: #f1f5f9; }

/* 主导航 */
.main-header {
  background: #fff;
  border-bottom: 1px solid #f1f5f9;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 24px;
  flex: 1;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.brand-logo {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 8px;
}

.brand-name {
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.3px;
}

.brand-slogan {
  font-size: 12px;
  color: #94a3b8;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  padding: 16px 12px;
  color: #475569;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s;
  white-space: nowrap;
}

.nav-link:hover { color: #2563eb; }
.nav-link.active { color: #2563eb; }

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-shrink: 0;
}

.header-link {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #475569;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s;
  cursor: pointer;
}

.header-link:hover { color: #2563eb; }
.header-link.orange { color: #f97316; }
.header-link.orange:hover { color: #ea580c; }

.btn-login {
  background: #006fee;
  color: #fff;
  padding: 8px 20px;
  border-radius: 9999px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background 0.2s;
  box-shadow: 0 2px 8px rgba(0,110,238,0.2);
}

.btn-login:hover { background: #1d4ed8; }

/* ================================
   主体内容区
   ================================ */
.page-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px;
  min-height: calc(100vh - 52px - 200px);
}

.content-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ================================
   控制面板
   ================================ */
.control-panel {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.panel-title {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-title iconify-icon { color: #2563eb; }

.section-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 12px;
}

/* 颜色选择 */
.color-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.color-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.2s, border-color 0.2s;
}

.color-dot:hover { transform: scale(1.1); }

.color-dot.active {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.color-add-btn {
  width: 24px;
  height: 24px;
  border: 1px solid #e2e8f0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}

.color-add-btn:hover { background: #f8fafc; }

/* 上传框 */
.upload-box {
  border: 2px dashed #e2e8f0;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 24px;
}

.upload-box:hover {
  border-color: #2563eb;
  color: #2563eb;
  background: #f8fafc;
}

/* 滑块 */
.slider-row {
  margin-bottom: 20px;
}

.slider-label {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: #475569;
  margin-bottom: 8px;
}

.slider-value {
  font-family: monospace;
}

.custom-range {
  width: 100%;
  height: 4px;
  background: #e2e8f0;
  border-radius: 2px;
  appearance: none;
  outline: none;
  cursor: pointer;
}

.custom-range::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  background: #2563eb;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* 生成按钮 */
.btn-generate {
  width: 100%;
  background: #2563eb;
  color: #fff;
  font-weight: 700;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.2s;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
  margin-top: 24px;
  cursor: pointer;
  border: none;
}

.btn-generate:hover { background: #1d4ed8; }

.btn-generate .cost {
  color: #bfdbfe;
  font-size: 12px;
  font-weight: 400;
}

/* 操作提示 */
.tips-box {
  background: #eff6ff;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  padding: 16px;
}

.tips-title {
  font-size: 14px;
  font-weight: 700;
  color: #1e40af;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.tips-text {
  font-size: 12px;
  color: #1d4ed8;
  line-height: 1.7;
}

/* ================================
   预览容器
   ================================ */
.preview-container {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  flex: 1;
}

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

.preview-title {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
}

.preview-actions {
  display: flex;
  gap: 8px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  border-radius: 8px;
  color: #64748b;
  transition: color 0.2s, background 0.2s;
  cursor: pointer;
  border: none;
}

.icon-btn:hover {
  color: #2563eb;
  background: #eff6ff;
}

.result-image-box {
  flex: 1;
  background: #f1f5f9;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
}

.result-image-box img {
  max-height: 100%;
  object-fit: contain;
}

.result-badge {
  position: absolute;
  bottom: 16px;
  left: 16px;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(4px);
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 12px;
  color: #475569;
  font-weight: 500;
}

/* 下方缩略图 */
.thumbnail-area {
  margin-top: 24px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.thumb-upload {
  width: 128px;
  height: 128px;
  flex-shrink: 0;
  background: #fff;
  border: 2px dashed #93c5fd;
}

.thumb-upload iconify-icon { color: #2563eb; }
.thumb-upload span { color: #2563eb; font-weight: 700; }

.thumb-list {
  flex: 1;
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding: 8px 0;
  align-items: center;
  white-space: nowrap;
}

.thumb-item {
  width: 96px;
  height: 96px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 0.2s;
}

.thumb-item:hover { border-color: #2563eb; }

.thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb-placeholder {
  width: 96px;
  height: 96px;
  background: #f1f5f9;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #94a3b8;
  flex-shrink: 0;
}

/* ================================
   历史记录侧边栏
   ================================ */
.history-sidebar {
  width: 300px;
  background: #fff;
  border-left: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  transition: width 0.3s ease;
  flex-shrink: 0;
}

.history-sidebar.collapsed { width: 60px; }

.history-title-container {
  padding: 16px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
  white-space: nowrap;
  height: 57px;
}

.collapsed .history-title-container {
  padding: 16px 0;
  flex-direction: column;
  gap: 12px;
  height: auto;
}

.history-title-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.history-title-left iconify-icon { color: #2563eb; }

.history-title {
  font-weight: 700;
  color: #1e293b;
  font-size: 14px;
}

.collapsed .history-title { display: none; }

.toggle-btn {
  width: 28px;
  height: 28px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #64748b;
  transition: all 0.2s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  flex-shrink: 0;
}

.toggle-btn:hover {
  border-color: #2563eb;
  color: #2563eb;
  background: #eff6ff;
}

.history-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

/* ── 历史记录卡片（展开时：图片在上、文字在下） ── */
.history-item {
  padding: 12px;
  border-bottom: 1px solid #f8fafc;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item:hover {
  background-color: #f1f5f9;
}

.history-card {
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  width: 100%;
}

.history-card-icon-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-card-img {
  width: 100%;
  max-height: 100px;
  object-fit: contain;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
}

/* 缩略图默认隐藏，展开时外面那张小图隐藏；收起时才显示 */
.history-item-img {
  display: none;
}

.history-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.history-info-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
  font-weight: 600;
  color: #374151;
}

.history-info-time {
  font-size: 10px;
  color: #94a3b8;
  margin-top: 2px;
  white-space: nowrap;
}

/* 收起时：缩略图居中 */
.collapsed .history-item {
  justify-content: center;
  align-items: center;
  padding: 16px 12px;
  position: relative;
}

.collapsed .history-item:hover {
  background-color: #eff6ff;
}

.collapsed .history-card {
  display: none;
}

.collapsed .history-item-img {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.collapsed .history-item iconify-icon {
  display: none;
}

/* ================================
   Footer
   ================================ */
.site-footer {
  background: #f8f9fb;
  border-top: 1px solid rgba(226, 232, 240, 0.55);
  padding: 28px 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-brand-logo {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 8px;
}

.footer-brand-name {
  font-size: 18px;
  font-weight: 900;
  color: #0f172a;
  letter-spacing: -0.3px;
}

.footer-slogan {
  font-size: 12px;
  color: #64748b;
}

.footer-tags {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #64748b;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-tags a:hover { color: #2563eb; transition: color 0.2s; }

.footer-links {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12px;
  color: #94a3b8;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-links a:hover { color: #2563eb; transition: color 0.2s; }

.footer-copy {
  font-size: 12px;
  color: #94a3b8;
}

.footer-copy a:hover { color: #2563eb; transition: color 0.2s; }

/* ================================
   响应式
   ================================ */
@media (max-width: 1024px) {
  .history-sidebar { display: none !important; }
  .sidebar-narrow { display: none !important; }
}

@media (max-width: 768px) {
  .main-header { padding: 0 16px; flex-wrap: wrap; gap: 8px; }
  .header-nav { display: none; }
  .header-right .header-link { display: none; }
  .brand-slogan { display: none; }
  .main-content { padding: 16px; }
  .promo-bar .hide-sm { display: none; }
  .btn-login { padding: 6px 16px; font-size: 13px; }
}
