/* ═══════════════════════════════════════════════════════════
   FERMATA DESIGN SYSTEM
   Dark theme + gold accent (#d4a44a)
   Fonts: Space Grotesk (headings), DM Sans (body)
   ═══════════════════════════════════════════════════════════ */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg-deep: #0a0a0f;
  --bg-card: #12121a;
  --bg-elevated: #1a1a26;
  --bg-input: #16161f;
  --accent: #d4a44a;
  --accent-glow: #e8b84d;
  --accent-dim: rgba(212, 164, 74, 0.15);
  --text-primary: #f0ede6;
  --text-secondary: #8a8693;
  --text-muted: #5a5666;
  --border: #2a2835;
  --border-light: #33303f;
  --success: #4ade80;
  --error: #ff6b6b;
  --warning: #fbbf24;
}

body {
  font-family: 'DM Sans', sans-serif;
  background-color: var(--bg-deep);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 999;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ─── NAV ─────────────────────────────────────────────── */
.app-nav {
  padding: 20px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}

.logo {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.logo-symbol {
  font-size: 1.8rem;
  color: var(--accent);
  line-height: 1;
}

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

.nav-link {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 8px;
  transition: all 0.2s;
}

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

.nav-link.active {
  color: var(--accent);
  background: var(--accent-dim);
}

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

.nav-user-name {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ─── BUTTONS ─────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg-deep);
}

.btn-primary:hover {
  background: var(--accent-glow);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 16px;
}

.btn-ghost:hover {
  color: var(--text-primary);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.8rem;
  border-radius: 8px;
}

.btn-danger {
  background: rgba(255, 107, 107, 0.1);
  color: var(--error);
  border: 1px solid rgba(255, 107, 107, 0.2);
}

.btn-danger:hover {
  background: rgba(255, 107, 107, 0.2);
}

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

/* ─── FORMS ───────────────────────────────────────────── */
.form-group {
  margin-bottom: 20px;
}

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

.form-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  transition: border-color 0.2s;
  outline: none;
}

.form-input:focus {
  border-color: var(--accent);
}

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

textarea.form-input {
  resize: vertical;
  min-height: 100px;
}

select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a8693' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.form-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.form-error {
  font-size: 0.8rem;
  color: var(--error);
  margin-top: 6px;
}

/* ─── CARDS ───────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  transition: border-color 0.3s ease;
}

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

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

.card-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* ─── STAT CARDS ──────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
}

.stat-card-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}

.stat-card-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.stat-card-change {
  font-size: 0.8rem;
  margin-top: 4px;
}

.stat-card-change.positive { color: var(--success); }
.stat-card-change.negative { color: var(--error); }

/* ─── SECTION HEADERS ─────────────────────────────────── */
.section-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--accent);
  margin-bottom: 8px;
  font-weight: 500;
}

.section-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 24px;
}

/* ─── BADGES ──────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-gold {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(212, 164, 74, 0.2);
}

.badge-green {
  background: rgba(74, 222, 128, 0.1);
  color: var(--success);
  border: 1px solid rgba(74, 222, 128, 0.2);
}

.badge-red {
  background: rgba(255, 107, 107, 0.1);
  color: var(--error);
  border: 1px solid rgba(255, 107, 107, 0.2);
}

/* ─── CHIPS (selectable) ──────────────────────────────── */
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.chip:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.chip.selected {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

/* ─── PROGRESS STEPS ──────────────────────────────────── */
.steps-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 40px;
}

.step-dot {
  height: 4px;
  flex: 1;
  border-radius: 2px;
  background: var(--border);
  transition: background 0.3s;
}

.step-dot.active {
  background: var(--accent);
}

.step-dot.completed {
  background: var(--accent);
  opacity: 0.6;
}

/* ─── ALERTS ──────────────────────────────────────────── */
.alert {
  padding: 14px 18px;
  border-radius: 10px;
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.alert-error {
  background: rgba(255, 107, 107, 0.08);
  border: 1px solid rgba(255, 107, 107, 0.15);
  color: var(--error);
}

.alert-success {
  background: rgba(74, 222, 128, 0.08);
  border: 1px solid rgba(74, 222, 128, 0.15);
  color: var(--success);
}

/* ─── AUTH LAYOUT ─────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 48px;
  width: 100%;
  max-width: 420px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 40px;
}

.auth-logo a {
  text-decoration: none;
}

.auth-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.auth-footer a {
  color: var(--accent);
  text-decoration: none;
}

.auth-footer a:hover {
  text-decoration: underline;
}

/* ─── LOADING ─────────────────────────────────────────── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

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

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 15, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 998;
}

/* ─── BAR CHART ───────────────────────────────────────── */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 160px;
  padding-top: 20px;
}

.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  height: 100%;
  justify-content: flex-end;
}

.bar {
  width: 100%;
  background: var(--accent-dim);
  border-radius: 6px 6px 0 0;
  transition: height 0.5s ease;
  min-height: 4px;
  position: relative;
}

.bar::after {
  content: attr(data-value);
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.bar-label {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ─── PLATFORM BARS ───────────────────────────────────── */
.platform-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.platform-bar-name {
  font-size: 0.85rem;
  color: var(--text-secondary);
  width: 100px;
  flex-shrink: 0;
}

.platform-bar-track {
  flex: 1;
  height: 8px;
  background: var(--bg-elevated);
  border-radius: 4px;
  overflow: hidden;
}

.platform-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.platform-bar-fill.spotify { background: #1DB954; }
.platform-bar-fill.apple_music { background: #FC3C44; }
.platform-bar-fill.youtube_music { background: #FF0000; }

.platform-bar-value {
  font-size: 0.8rem;
  color: var(--text-muted);
  width: 60px;
  text-align: right;
  flex-shrink: 0;
}

/* ─── ACTIONS LIST ────────────────────────────────────── */
.action-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.action-item:last-child {
  border-bottom: none;
}

.action-priority {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 7px;
  flex-shrink: 0;
}

.action-priority.high { background: var(--error); }
.action-priority.medium { background: var(--warning); }
.action-priority.low { background: var(--text-muted); }

.action-content {
  flex: 1;
  min-width: 0;
}

.action-title {
  font-size: 0.95rem;
  font-weight: 500;
  margin-bottom: 4px;
}

.action-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.action-due {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.action-btns {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* ─── CONTENT CARDS ───────────────────────────────────── */
.content-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 16px;
  transition: border-color 0.3s;
}

.content-card:hover {
  border-color: var(--border-light);
}

.content-text {
  font-size: 0.95rem;
  line-height: 1.7;
  white-space: pre-wrap;
  margin-bottom: 16px;
}

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

/* ─── RESPONSIVE ──────────────────────────────────────── */
@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .app-nav {
    flex-wrap: wrap;
    gap: 12px;
  }

  .nav-links {
    order: 3;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px;
  }

  .nav-link {
    padding: 6px 12px;
    font-size: 0.8rem;
  }

  .auth-card {
    padding: 32px 24px;
  }

  .section-title {
    font-size: 1.3rem;
  }

  .card {
    padding: 20px;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .stat-card {
    padding: 18px;
  }

  .stat-card-value {
    font-size: 1.4rem;
  }

  .container {
    padding: 0 16px;
  }
}

/* ─── UTILITY ─────────────────────────────────────────── */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.gap-2 { gap: 8px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.w-full { width: 100%; }
