/* VidAffiliate palette + layout. Tailwind (Play CDN) handles utilities;
   this file holds the locked palette, sidebar/drawer layout, and
   shared component styles. */

:root {
  --navy-1: #2c234d;
  --navy-2: #171233;
  --sky: #3ac5f9;
  --sky-dark: #0ea5e9;
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --danger: #dc2626;
  --ok: #15803d;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--sky-dark); }

/* ---------- shell ---------- */
.app-shell { min-height: 100vh; }

/* Mobile: the sidebar is an off-canvas drawer, hidden until toggled. */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  width: 15rem;
  background: linear-gradient(180deg, var(--navy-1), var(--navy-2));
  color: #fff;
  padding: 1.25rem 1rem;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform 0.2s ease;
}
body.drawer-open .sidebar { transform: translateX(0); }

.content {
  padding: 1rem 1rem 2rem;
  max-width: 72rem;
  margin: 0 auto;
}

.content-public { padding-bottom: 2rem; }

@media (min-width: 768px) {
  .app-shell { display: flex; }
  .sidebar {
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    width: 15rem;
    flex-shrink: 0;
    background: linear-gradient(180deg, var(--navy-1), var(--navy-2));
    color: #fff;
    padding: 1.25rem 1rem;
    transform: none;
    transition: none;
  }
  .content { flex: 1; padding: 2rem 2rem 3rem; margin: 0; max-width: none; }
  /* !important: the base .mobile-topbar rule below this block would otherwise win by source order. */
  .mobile-topbar { display: none !important; }
  .scrim { display: none !important; }
}

.sidebar-logo { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 1.5rem; }
.sidebar-nav { display: flex; flex-direction: column; gap: 0.25rem; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.75rem;
  border-radius: 0.5rem;
  color: #d6d3e8;
  text-decoration: none;
  font-weight: 500;
}
.nav-link svg { width: 1.25rem; height: 1.25rem; flex-shrink: 0; }
.nav-link:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.nav-link.active { background: var(--sky); color: #0b1220; font-weight: 700; }

.sidebar-footer { margin-top: auto; border-top: 1px solid rgba(255, 255, 255, 0.15); padding-top: 1rem; }
.sidebar-user { font-weight: 600; overflow-wrap: anywhere; }
.sidebar-user-sub { font-size: 0.8rem; color: #b8b3d4; overflow-wrap: anywhere; }

.btn-sidebar {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #fff;
  border-radius: 0.5rem;
  padding: 0.4rem 0.8rem;
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
}
.btn-sidebar:hover { border-color: #fff; }

/* ---------- mobile drawer toggle + scrim ---------- */
.mobile-topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  background: linear-gradient(90deg, var(--navy-1), var(--navy-2));
  color: #fff;
}
.mobile-topbar-logo { color: #fff; font-weight: 800; font-size: 1.15rem; text-decoration: none; }
.hamburger {
  background: transparent;
  border: 0;
  padding: 0.35rem;
  color: #fff;
  cursor: pointer;
  line-height: 0;
}
.hamburger svg { width: 1.5rem; height: 1.5rem; }
.scrim {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 25;
  background: rgba(0, 0, 0, 0.45);
}
body.drawer-open .scrim { display: block; }

/* ---------- public top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: linear-gradient(90deg, var(--navy-1), var(--navy-2));
}
.topbar-logo { color: #fff; font-weight: 800; font-size: 1.25rem; text-decoration: none; }

/* ---------- components ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  padding: 1.25rem;
}

.page-title { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 0.25rem; }
.page-sub { color: var(--muted); margin: 0 0 1.25rem; }

.btn-primary, .btn-secondary, .btn-danger {
  display: inline-block;
  border-radius: 0.5rem;
  padding: 0.55rem 1.1rem;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
}
.btn-primary { background: var(--sky); color: #0b1220; border-color: var(--sky); }
.btn-primary:hover { background: #7dd8fb; }
.btn-secondary { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { border-color: #9ca3af; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.85rem; }

.label { display: block; font-weight: 600; font-size: 0.9rem; margin: 0 0 0.3rem; }
.input, select.input, textarea.input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  padding: 0.55rem 0.7rem;
  font: inherit;
  background: #fff;
}
.input:focus { outline: 2px solid var(--sky); outline-offset: 0; border-color: var(--sky); }
.field { margin-bottom: 1rem; }
.help { color: var(--muted); font-size: 0.85rem; margin-top: 0.3rem; }

.alert-error, .alert-ok, .alert-note {
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid;
}
.alert-error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.alert-ok { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.alert-note { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 700;
  background: #e0f2fe;
  color: #075985;
}
.badge-green { background: #dcfce7; color: #166534; }
.badge-amber { background: #fef3c7; color: #92400e; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-gray { background: #f3f4f6; color: #4b5563; }

.table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.table th { text-align: left; padding: 0.6rem; border-bottom: 2px solid var(--line); color: var(--muted); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; }
.table td { padding: 0.6rem; border-bottom: 1px solid var(--line); vertical-align: top; }

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
@media (min-width: 768px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.stat-value { font-size: 1.6rem; font-weight: 800; }
.stat-label { color: var(--muted); font-size: 0.85rem; }

.step-dots { display: flex; gap: 0.5rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.step-dot { border-radius: 999px; padding: 0.3rem 0.8rem; font-size: 0.85rem; font-weight: 600; background: #e5e7eb; color: #4b5563; }
.step-dot.current { background: var(--sky); color: #0b1220; }
.step-dot.done { background: #dcfce7; color: #166534; }

.choice-card {
  display: block;
  border: 2px solid var(--line);
  border-radius: 0.75rem;
  padding: 1rem;
  cursor: pointer;
  background: #fff;
}
.choice-card:hover { border-color: var(--sky); }
.choice-card input { margin-right: 0.5rem; }

.key-mask { font-family: ui-monospace, monospace; letter-spacing: 0.15em; color: var(--muted); }

.empty-state {
  border: 2px dashed var(--line);
  border-radius: 0.75rem;
  padding: 2rem 1.25rem;
  text-align: center;
  background: #fff;
}

.section-title { font-size: 1.15rem; font-weight: 700; margin: 0 0 0.75rem; }
.muted { color: var(--muted); }
.stack > * + * { margin-top: 1rem; }
.grid-2 { display: grid; gap: 1rem; }
@media (min-width: 768px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.grid-3 { display: grid; gap: 1rem; }
@media (min-width: 768px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }
