/* ============================================
   优单UBill — 全站样式
   Apple 极简 · 琥珀金 #c8922a · 深色/浅色双主题
   ============================================ */

/* ---- CSS Variables ---- */
:root {
  --gold: #c8922a;
  --gold-light: #d4a84a;
  --gold-dark: #a67a20;
  --gold-bg: rgba(200, 146, 42, 0.08);
  --gold-bg-hover: rgba(200, 146, 42, 0.14);

  --bg: #ffffff;
  --bg-secondary: #f5f5f7;
  --bg-card: rgba(255, 255, 255, 0.72);
  --bg-glass: rgba(255, 255, 255, 0.58);
  --bg-input: #f5f5f7;

  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #aeaeb2;

  --border: #d2d2d7;
  --border-light: #e8e8ed;
  --border-focus: #c8922a;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.1);
  --shadow-gold: 0 8px 32px rgba(200, 146, 42, 0.18);

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --font-heading: 'Noto Serif SC', 'Songti SC', 'STSong', serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Cascadia Code', monospace;

  --transition-fast: 0.15s cubic-bezier(0.25, 0.1, 0.25, 1);
  --transition: 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
  --transition-slow: 0.5s cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* ---- Dark Theme ---- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1a1a;
    --bg-secondary: #252525;
    --bg-card: rgba(40, 40, 42, 0.78);
    --bg-glass: rgba(40, 40, 42, 0.55);
    --bg-input: #2a2a2c;

    --text: #f5f5f7;
    --text-secondary: #a1a1a6;
    --text-tertiary: #6e6e73;

    --border: #424245;
    --border-light: #38383a;
    --border-focus: #c8922a;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 48px rgba(0,0,0,0.5);
    --shadow-gold: 0 8px 32px rgba(200, 146, 42, 0.12);
  }
}

[data-theme="light"] {
  --bg: #ffffff;
  --bg-secondary: #f5f5f7;
  --bg-card: rgba(255, 255, 255, 0.72);
  --bg-glass: rgba(255, 255, 255, 0.58);
  --bg-input: #f5f5f7;
  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #aeaeb2;
  --border: #d2d2d7;
  --border-light: #e8e8ed;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
}

[data-theme="dark"] {
  --bg: #1a1a1a;
  --bg-secondary: #252525;
  --bg-card: rgba(40, 40, 42, 0.78);
  --bg-glass: rgba(40, 40, 42, 0.55);
  --bg-input: #2a2a2c;
  --text: #f5f5f7;
  --text-secondary: #a1a1a6;
  --text-tertiary: #6e6e73;
  --border: #424245;
  --border-light: #38383a;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.4);
}

/* ---- Reset ---- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
}

/* ---- Typography ---- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

h1 { font-size: clamp(2.2rem, 5vw, 3.2rem); }
h2 { font-size: clamp(1.6rem, 4vw, 2.2rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

p { color: var(--text-secondary); }

a {
  color: var(--gold);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--gold-light); }

/* ---- Layout ---- */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: 80px 0;
}

/* ---- Navigation ---- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition);
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--gold);
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
}

.nav-links a {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}
.nav-links a:hover {
  background: var(--bg-secondary);
  color: var(--text);
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 22px;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.925rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--gold);
  color: #fff;
  box-shadow: var(--shadow-gold);
}
.btn-primary:hover {
  background: var(--gold-dark);
  box-shadow: 0 4px 20px rgba(200, 146, 42, 0.3);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text);
  border: 1px solid var(--border-light);
}
.btn-secondary:hover {
  background: var(--bg-input);
  border-color: var(--border);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover {
  background: var(--bg-secondary);
  color: var(--text);
}

.btn-danger {
  background: rgba(255, 69, 58, 0.1);
  color: #ff453a;
  border: 1px solid rgba(255, 69, 58, 0.2);
}
.btn-danger:hover {
  background: rgba(255, 69, 58, 0.18);
}

.btn-sm { padding: 6px 14px; font-size: 0.825rem; border-radius: var(--radius-sm); }
.btn-lg { padding: 14px 32px; font-size: 1rem; border-radius: var(--radius-lg); }
.btn-xl { padding: 16px 40px; font-size: 1.05rem; border-radius: var(--radius-lg); }

/* ---- Forms ---- */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 0.825rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.925rem;
  color: var(--text);
  transition: all var(--transition-fast);
  outline: none;
}
.form-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--gold-bg);
}
.form-input::placeholder { color: var(--text-tertiary); }

/* ---- Card ---- */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: all var(--transition);
}
.card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border);
}

/* ---- Feature Grid ---- */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 40px;
}

.feature-card {
  padding: 28px;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  transition: all var(--transition);
}
.feature-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border);
}

.feature-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gold-bg);
  color: var(--gold);
  margin-bottom: 16px;
  font-size: 1.3rem;
}

.feature-card h3 {
  font-size: 1.1rem;
  margin-bottom: 8px;
  color: var(--text);
}

.feature-card p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ---- Hero ---- */
.hero {
  padding: 120px 0 80px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--gold-bg) 0%, transparent 70%);
  pointer-events: none;
}

.hero h1 {
  margin-bottom: 16px;
}

.hero .subtitle {
  font-size: 1.15rem;
  color: var(--text-secondary);
  max-width: 520px;
  margin: 0 auto 32px;
}

.hero-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ---- Auth Pages ---- */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 36px;
}

.auth-card h2 {
  text-align: center;
  margin-bottom: 6px;
}

.auth-card .auth-sub {
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 28px;
}

.auth-card .form-input { margin-bottom: 12px; }

.auth-card .btn {
  width: 100%;
  justify-content: center;
  margin-top: 8px;
}

.auth-switch {
  text-align: center;
  margin-top: 20px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.auth-error {
  background: rgba(255, 69, 58, 0.08);
  border: 1px solid rgba(255, 69, 58, 0.2);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.85rem;
  color: #ff453a;
  margin-bottom: 16px;
  display: none;
}

.auth-error.show { display: block; }

/* ---- Dashboard ---- */
.dashboard {
  padding: 80px 0 60px;
}

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 12px;
}

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

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.stat-card .stat-icon {
  font-size: 1.5rem;
  margin-bottom: 12px;
}

.stat-card .stat-value {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
}

.stat-card .stat-label {
  font-size: 0.825rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ---- Table ---- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

thead th {
  text-align: left;
  padding: 12px 16px;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-secondary);
}

tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg-secondary); }

/* ---- Badge ---- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-success { background: rgba(52, 199, 89, 0.1); color: #34c759; }
.badge-warning { background: rgba(255, 149, 0, 0.1); color: #ff9500; }
.badge-danger { background: rgba(255, 69, 58, 0.1); color: #ff453a; }
.badge-default { background: var(--bg-secondary); color: var(--text-secondary); }

/* ---- License Code ---- */
.license-code {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 4px 8px;
  background: var(--bg-input);
  border-radius: 4px;
  letter-spacing: 0.04em;
  user-select: all;
}

/* ---- Modal / Toast ---- */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 10px 22px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  z-index: 9999;
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}
.toast.show { opacity: 1; }

/* ---- Loading ---- */
.spinner {
  width: 24px;
  height: 24px;
  border: 2.5px solid var(--border-light);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ---- Utilities ---- */
.text-center { text-align: center; }
.text-gold { color: var(--gold); }
.text-muted { color: var(--text-secondary); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 12px; }
.gap-3 { gap: 16px; }

/* ---- Empty State ---- */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-tertiary);
}

.empty-state .empty-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

.empty-state p {
  font-size: 0.9rem;
}

/* ---- Admin Dashboard ---- */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .section { padding: 48px 0; }
  .hero { padding: 96px 0 48px; }
  .hero h1 { font-size: 1.8rem; }
  .hero .subtitle { font-size: 1rem; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .features-grid { grid-template-columns: 1fr; }
  .admin-stats { grid-template-columns: repeat(2, 1fr); }
  .auth-card { padding: 24px; }
  .nav-links a { padding: 4px 10px; font-size: 0.8rem; }
}

@media (max-width: 480px) {
  .container { padding: 0 16px; }
  .admin-stats { grid-template-columns: 1fr; }
  .hero-actions { flex-direction: column; width: 100%; }
  .hero-actions .btn { width: 100%; }
}
