/* =========================================
   PagePilot — Dashboard SPA Styles
   ========================================= */

:root {
  --bg: #0c0c0e;
  --surface: #141416;
  --surface-2: #1c1c1f;
  --border: #2a2a2e;
  --fg: #f0f0f0;
  --fg-muted: #8a8a8e;
  --accent: #c8ff00;
  --accent-dim: #c8ff0020;
  --accent-text: #0c0c0e;
  --font-display: 'Syne', system-ui, sans-serif;
  --font-body: 'Figtree', system-ui, sans-serif;
  --radius: 8px;
  --radius-lg: 12px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---- Nav ---- */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 40px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-logo {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.01em;
  text-decoration: none;
}
.nav-right { display: flex; align-items: center; gap: 16px; }
.nav-link {
  font-size: 0.85rem;
  color: var(--fg-muted);
  text-decoration: none;
  transition: color 0.2s;
}
.nav-link:hover { color: var(--fg); }
.nav-link.active { color: var(--accent); }

/* ---- Main ---- */
.main { max-width: 1200px; margin: 0 auto; padding: 40px 40px 80px; }

/* ---- Section header ---- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.section-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.section-label {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 4px;
}

/* ---- Stat cards ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: 48px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.stat-label { font-size: 0.72rem; color: var(--fg-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 8px; }
.stat-value { font-family: var(--font-display); font-size: 1.75rem; font-weight: 700; color: var(--fg); line-height: 1; }
.stat-value.accent { color: var(--accent); }
.stat-sub { font-size: 0.7rem; color: var(--fg-muted); margin-top: 4px; }

/* ---- Cards ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
}
.card-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: opacity 0.2s, transform 0.1s;
  text-decoration: none;
}
.btn:hover { opacity: 0.85; }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-secondary { background: var(--surface-2); color: var(--fg); border: 1px solid var(--border); }
.btn-danger { background: transparent; color: #ef4444; border: 1px solid #ef4444; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-icon { padding: 8px; border-radius: 6px; }

/* ---- Forms ---- */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 0.8rem; font-weight: 500; color: var(--fg-muted); margin-bottom: 6px; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 14px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-hint { font-size: 0.75rem; color: var(--fg-muted); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 500;
}
.tag-green { background: #052e1640; color: #4ade80; }
.tag-yellow { background: #42200640; color: #fbbf24; }
.tag-red { background: #450a0a40; color: #f87171; }
.tag-blue { background: #0c1a3d40; color: #60a5fa; }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th { text-align: left; padding: 10px 12px; font-size: 0.72rem; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-muted); border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 12px 12px; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface-2); }

/* ---- Tabs ---- */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.tab {
  padding: 10px 20px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--fg-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}
.tab:hover { color: var(--fg); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---- Badges / status ---- */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--fg-muted);
  display: inline-block;
}
.status-dot.active { background: var(--accent); box-shadow: 0 0 6px var(--accent); animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ---- Toast ---- */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 18px;
  font-size: 0.85rem;
  z-index: 999;
  display: none;
  max-width: 300px;
}
.toast.show { display: block; }
.toast.error { border-color: #ef4444; color: #f87171; }
.toast.success { border-color: #4ade80; color: #4ade80; }

/* ---- Empty state ---- */
.empty-state { text-align: center; padding: 48px 24px; color: var(--fg-muted); }
.empty-state p { font-size: 0.9rem; margin-top: 8px; }

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .main { padding: 24px 20px 60px; }
  .nav { padding: 12px 20px; }
  .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---- Loading spinner ---- */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Progress bar ---- */
.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--surface-2);
  border-radius: 2px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s;
}