/* ============================================
   AI Image Pro - 公共样式表
   深色主题 | 响应式设计 | 专业界面
   ============================================ */

/* ---------- CSS 变量 ---------- */
:root {
  --bg-primary: #0f0f1a;
  --bg-secondary: #1a1a2e;
  --bg-tertiary: #16213e;
  --bg-card: #1a1a2e;
  --bg-input: #252547;
  --bg-hover: #2a2a4a;

  --text-primary: #e8e8f0;
  --text-secondary: #a0a0c0;
  --text-muted: #6a6a8a;

  --accent-start: #667eea;
  --accent-end: #764ba2;
  --accent-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --accent-gradient-hover: linear-gradient(135deg, #7b8ff0 0%, #8a5db5 100%);
  --accent-glow: rgba(102, 126, 234, 0.3);

  --border-color: #2a2a4a;
  --border-active: #667eea;

  --success: #4ade80;
  --success-bg: rgba(74, 222, 128, 0.1);
  --error: #f87171;
  --error-bg: rgba(248, 113, 113, 0.1);
  --warning: #fbbf24;
  --warning-bg: rgba(251, 191, 36, 0.1);
  --info: #60a5fa;
  --info-bg: rgba(96, 165, 250, 0.1);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(102, 126, 234, 0.2);

  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;

  --header-height: 64px;
}

/* ---------- 重置 & 基础 ---------- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial,
    sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: var(--accent-start);
  text-decoration: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button {
  cursor: pointer;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: inherit;
  background: none;
  color: inherit;
}

input,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
  outline: none;
  border: none;
  background: none;
  color: inherit;
}

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-hover);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ---------- 顶部导航 ---------- */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: rgba(15, 15, 26, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  z-index: 100;
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--accent-gradient);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: var(--shadow-glow);
}

.logo-text {
  font-size: 1.25rem;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

.nav-link {
  padding: 8px 16px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.9375rem;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.nav-link.active {
  color: #fff;
  background: var(--accent-gradient);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-credits {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg-input);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
}

.credits-icon {
  font-size: 1rem;
}

.credits-value {
  font-weight: 600;
  color: var(--accent-start);
}

.user-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.user-btn:hover {
  box-shadow: 0 0 20px rgba(102, 126, 234, 0.4);
}

/* ---------- 主内容区 ---------- */
.main {
  padding-top: var(--header-height);
  min-height: 100vh;
}

.page-header {
  padding: 32px 24px;
  text-align: center;
}

.page-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.page-desc {
  font-size: 1rem;
  color: var(--text-secondary);
}

/* ---------- Toast 提示 ---------- */
.toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 14px 20px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 0.875rem;
  box-shadow: var(--shadow-md);
  animation: toastIn 0.3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 400px;
}

.toast.success {
  border-color: var(--success);
}

.toast.error {
  border-color: var(--error);
}

.toast.warning {
  border-color: var(--warning);
}

.toast.info {
  border-color: var(--info);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ---------- 加载动画 ---------- */
.loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 15, 26, 0.8);
  backdrop-filter: blur(4px);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 20px;
}

.loading-overlay.active {
  display: flex;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent-start);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

/* ---------- 响应式 ---------- */
@media (max-width: 992px) {
  .nav {
    display: none;
  }

  .page-title {
    font-size: 1.5rem;
  }
}

@media (max-width: 768px) {
  .header-content {
    padding: 0 16px;
  }

  .page-header {
    padding: 24px 16px;
  }

  .user-credits {
    display: none;
  }
}

/* ---------- 工具类 ---------- */
.hidden {
  display: none !important;
}

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

.text-success {
  color: var(--success);
}

.text-error {
  color: var(--error);
}

.text-warning {
  color: var(--warning);
}

.text-muted {
  color: var(--text-muted);
}
