/* ===== 全局变量 ===== */
:root {
  --sidebar-w: 220px;
  --color-bg:       #0b0f14;
  --color-surface:  #131920;
  --color-border:   #1e2733;
  --color-accent:   #3b82f6;
  --color-accent-hover: #2563eb;
  --color-text:     #e2e8f0;
  --color-muted:    #64748b;
  --color-success:  #22c55e;
  --color-danger:   #ef4444;
  --color-warning:  #f59e0b;
}

/* ===== 基础 ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  display: flex;
  min-height: 100vh;
  overflow: hidden;
}

/* ===== 侧边栏 ===== */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  padding: 24px 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 10;
}

.sidebar-logo {
  padding: 0 20px 24px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 16px;
}

.sidebar-logo h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #60a5fa, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar-logo .logo-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-muted);
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background: rgba(255,255,255,0.04);
  color: var(--color-text);
}

.nav-item.active {
  background: rgba(59,130,246,0.12);
  color: var(--color-accent);
}

.nav-item .nav-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

/* 底部用户信息 */
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--color-border);
  margin-top: auto;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
}

.user-detail {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
}

.user-credits {
  font-size: 11px;
  color: var(--color-warning);
  font-weight: 500;
}

.version-info {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  color: var(--color-muted, #64748b);
}
.version-label { opacity: 0.7; }
.version-update {
  color: var(--color-muted, #64748b);
  text-decoration: none;
  font-size: 12px;
  transition: all 0.2s;
}
.version-update:hover {
  color: #60a5fa;
  transform: rotate(180deg);
}

/* ===== 主内容区 ===== */
.main-area {
  flex: 1;
  margin-left: var(--sidebar-w);
  margin-right: 220px;
  overflow-y: auto;
  overflow-x: hidden;
  height: 100vh;
}

.page-panel {
  display: none;
  padding: 32px 40px;
  max-width: 1000px;
  animation: fadeIn 0.2s ease;
}

.page-panel.active {
  display: block;
}

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

/* ===== 页面头部 ===== */
.page-header {
  margin-bottom: 28px;
}

.page-header h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}

.page-header p {
  font-size: 13px;
  color: var(--color-muted);
}

/* ===== 卡片容器 ===== */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 20px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
}

/* ===== 表单元素 ===== */
.input-row {
  display: flex;
  gap: 12px;
}

.input-field {
  flex: 1;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--color-text);
  outline: none;
  transition: border-color 0.15s;
}

.input-field::placeholder { color: var(--color-muted); }
.input-field:focus { border-color: var(--color-accent); }

.btn {
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

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

.btn-primary { background: var(--color-accent); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--color-accent-hover); }

.btn-success { background: var(--color-success); color: white; }
.btn-success:hover:not(:disabled) { background: #16a34a; }

/* ===== 结果/消息区 ===== */
.result-box {
  margin-top: 16px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 16px;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 400px;
  overflow-y: auto;
}

.msg-box {
  margin-top: 16px;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13px;
}

.msg-success {
  background: rgba(34,197,94,0.08);
  border: 1px solid rgba(34,197,94,0.3);
  color: #86efac;
}

.msg-error {
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.3);
  color: #fca5a5;
}

.hidden { display: none !important; }

/* ===== 案例广场双栏布局 ===== */
.gallery-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}
.gallery-main {
  flex: 1;
  min-width: 0;
}
.right-sidebar {
  position: fixed;
  right: 0;
  top: 0;
  width: 220px;
  height: 100vh;
  padding: 80px 16px 24px;
  border-left: 1px solid var(--color-border);
  background: var(--color-bg);
  z-index: 100;
  overflow-y: auto;
}

/* ===== 使用锦囊 ===== */
.tips-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  overflow: hidden;
}
.tips-card-header {
  font-size: 13px;
  font-weight: 700;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--color-border);
}
.tips-card-body {
  padding: 16px;
  font-size: 13px;
  color: #cbd5e1;
  line-height: 1.7;
  min-height: 80px;
}
.tips-card-footer {
  padding: 8px 16px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.tips-counter {
  font-size: 11px;
  color: #64748b;
}
.tips-next-btn {
  background: none;
  border: 1px solid var(--color-border);
  color: #94a3b8;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
}
.tips-next-btn:hover {
  border-color: #60a5fa;
  color: #60a5fa;
}

/* ===== 媒体网格 ===== */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.media-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.15s;
  cursor: pointer;
}

.media-card:hover { border-color: var(--color-accent); }

.media-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}

.media-card-body {
  padding: 10px 12px;
}

.media-card-body .prompt {
  font-size: 12px;
  color: var(--color-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.media-card-body .meta {
  font-size: 11px;
  color: var(--color-muted);
  margin-top: 4px;
  display: flex;
  justify-content: space-between;
}

/* ===== 画布占位 ===== */
.canvas-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 500px;
  background: var(--color-surface);
  border: 2px dashed var(--color-border);
  border-radius: 20px;
  text-align: center;
  padding: 40px;
}

.canvas-placeholder .icon {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  margin-bottom: 20px;
}

.canvas-placeholder h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
}

.canvas-placeholder p {
  font-size: 13px;
  color: var(--color-muted);
  max-width: 320px;
  line-height: 1.6;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  margin-top: 16px;
}

.badge-premium {
  background: linear-gradient(135deg, rgba(168,85,247,0.15), rgba(59,130,246,0.15));
  border: 1px solid rgba(168,85,247,0.4);
  color: #c4b5fd;
}

/* ===== 工具栏提示 ===== */
.tool-hint {
  font-size: 12px;
  color: var(--color-muted);
  margin-top: 8px;
}

/* ===== 演示案例卡片 ===== */
.demo-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  overflow: hidden;
  transition: all 0.25s;
  cursor: pointer;
}

.demo-card:hover {
  border-color: rgba(139,92,246,0.5);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}

.demo-card-img {
  width: 100%;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.demo-card-img::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.5) 100%);
}

.demo-card-body {
  padding: 16px;
}

.demo-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(139,92,246,0.12);
  color: #a78bfa;
  margin-bottom: 8px;
}

.demo-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 14px;
  line-height: 1.3;
}

.demo-cta {
  width: 100%;
  padding: 9px 0;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid rgba(139,92,246,0.4);
  background: linear-gradient(135deg, rgba(139,92,246,0.1), rgba(59,130,246,0.1));
  color: #c4b5fd;
  cursor: pointer;
  transition: all 0.2s;
}

.demo-cta:hover {
  background: linear-gradient(135deg, rgba(139,92,246,0.25), rgba(59,130,246,0.25));
  border-color: rgba(139,92,246,0.7);
  color: #e9d5ff;
}

/* ===== 侧边栏金色充值按钮 ===== */
.recharge-mini-btn {
  margin-top: 8px;
  width: 100%;
  padding: 6px 0;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid rgba(245,158,11,0.4);
  background: linear-gradient(135deg, rgba(245,158,11,0.12), rgba(234,179,8,0.08));
  color: #fbbf24;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.recharge-mini-btn::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(ellipse at center, rgba(245,158,11,0.15) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
}

.recharge-mini-btn:hover::before {
  opacity: 1;
}

.recharge-mini-btn:hover {
  border-color: rgba(245,158,11,0.7);
  background: linear-gradient(135deg, rgba(245,158,11,0.22), rgba(234,179,8,0.14));
  color: #fde68a;
  box-shadow: 0 0 20px rgba(245,158,11,0.15);
}

/* ===== 公告铃铛 ===== */
.announcement-bell {
  position: fixed;
  top: 16px;
  left: auto;
  right: 40px;
  font-size: 22px;
  cursor: pointer;
  z-index: 1000;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--color-border);
  transition: all 0.2s;
}
.announcement-bell:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.2);
}
.announcement-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  display: none;
}
.announcement-dot.show { display: block; }

.announcement-popup {
  position: fixed;
  top: 60px;
  right: 24px;
  width: 320px;
  max-height: 400px;
  overflow-y: auto;
  background: #1e1e2e;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
  z-index: 999;
  padding: 16px;
}
.announcement-popup-header {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-border);
}
.announcement-item {
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.announcement-item:last-child { border-bottom: none; }
.announcement-item-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}
.announcement-item-date {
  font-size: 10px;
  color: #64748b;
  margin-bottom: 4px;
}
.announcement-item-content {
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.5;
}
