/* ==========================================================================
   USA House — main.css
   Global styles, design system, CSS custom properties
   ========================================================================== */

:root {
  /* Backgrounds */
  --bg-base: #060912;
  --bg-surface: #080D1A;
  --bg-elevated: #0D1526;
  --bg-border: #0F1829;

  /* Accents (US theme) */
  --accent-red: #B22234;
  --accent-blue: #3B5FC0;
  --accent-white: #F1F5F9;

  /* Text */
  --text-primary: #F1F5F9;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;

  /* Status */
  --status-home: #4ADE80;
  --status-away: #F87171;
  --status-home-bg: #052010;
  --status-away-bg: #1A0808;
  --status-home-border: #14532D;
  --status-away-border: #4C1212;

  /* Typography */
  --font-main: system-ui, -apple-system, sans-serif;
  --font-mono: 'Courier New', monospace;

  /* Spacing scale */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-12: 48px;

  /* Radius */
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;

  /* Layout */
  --topbar-h: 56px;
  --sidebar-w: 175px;
}

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

html, body {
  height: 100%;
}

body {
  font-family: var(--font-main);
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent-blue);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

button {
  font-family: inherit;
  cursor: pointer;
}

input, select, textarea {
  font-family: inherit;
}

/* The tricolour strip ----------------------------------------------------- */
.tricolour {
  height: 3px;
  width: 100%;
  background: linear-gradient(
    to right,
    var(--accent-red) 0%, var(--accent-red) 33.33%,
    #FFFFFF 33.33%, #FFFFFF 66.66%,
    var(--accent-blue) 66.66%, var(--accent-blue) 100%
  );
}

/* Logo -------------------------------------------------------------------- */
.logo {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.logo-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  background: var(--accent-red);
  color: #FFFFFF;
  font-weight: 800;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}
.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.logo-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-primary);
}
.logo-sub {
  font-size: 11px;
  color: var(--text-secondary);
}

/* ==========================================================================
   AUTH PAGES (login / reset) — centered card
   ========================================================================== */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-5);
  background:
    radial-gradient(900px 500px at 50% -10%, rgba(59, 95, 192, 0.10), transparent),
    radial-gradient(900px 500px at 50% 110%, rgba(178, 34, 52, 0.10), transparent),
    var(--bg-base);
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.auth-card-body {
  padding: var(--sp-8) var(--sp-6) var(--sp-6);
}
.auth-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  text-align: center;
  margin-bottom: var(--sp-4);
}
.auth-logo .logo-icon {
  width: 48px;
  height: 48px;
  font-size: 20px;
}
.auth-logo .logo-title { font-size: 20px; }
.auth-logo .logo-sub { font-size: 12px; }

.auth-tricolour {
  margin: var(--sp-4) auto var(--sp-6);
  width: 80px;
  border-radius: 2px;
  overflow: hidden;
}

.auth-form { display: flex; flex-direction: column; gap: var(--sp-3); }

.auth-footer {
  text-align: center;
  margin-top: var(--sp-5);
  font-size: 11px;
  color: var(--text-muted);
}
.auth-note {
  text-align: center;
  margin-top: var(--sp-4);
  font-size: 12px;
}

/* ==========================================================================
   APP SHELL — topbar + sidebar + main
   ========================================================================== */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-h);
  background: var(--bg-surface);
  border-bottom: 2px solid var(--accent-red);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-5);
  z-index: 50;
}
.topbar-left { display: flex; align-items: center; }
.topbar-center {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.nav-pill {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
}
.nav-pill:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
  text-decoration: none;
}
.nav-pill.active {
  color: var(--text-primary);
  background: var(--bg-elevated);
  border-color: var(--bg-border);
}

.online-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--status-home);
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.15);
}
.user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  text-align: right;
}
.user-name { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.user-role { font-size: 10px; color: var(--text-muted); text-transform: capitalize; }

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  color: #FFFFFF;
  flex-shrink: 0;
}
.avatar-sm { width: 26px; height: 26px; font-size: 10px; }
.avatar-lg { width: 44px; height: 44px; font-size: 16px; }

/* Sidebar ----------------------------------------------------------------- */
.sidebar {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--bg-border);
  padding: var(--sp-4) 0;
  overflow-y: auto;
  z-index: 40;
}
.sidebar-section + .sidebar-section { margin-top: var(--sp-5); }
.sidebar-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: 0 var(--sp-5);
  margin-bottom: var(--sp-2);
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 9px var(--sp-5);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  border-left: 2px solid transparent;
}
.sidebar-link:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
  text-decoration: none;
}
.sidebar-link.active {
  color: var(--text-primary);
  background: var(--bg-elevated);
  border-left-color: var(--accent-red);
  font-weight: 600;
}
.sidebar-link .ico { width: 16px; text-align: center; opacity: 0.9; }

/* Main content ------------------------------------------------------------ */
.main {
  margin-left: var(--sidebar-w);
  margin-top: var(--topbar-h);
  padding: var(--sp-5);
  min-height: calc(100vh - var(--topbar-h));
}
.page-head { margin-bottom: var(--sp-5); }
.page-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}
.page-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Section heading w/ red left border accent ------------------------------- */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-left: 3px solid var(--accent-red);
  padding-left: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.section-head h2 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

/* Grids ------------------------------------------------------------------- */
.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}
.three-col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}

/* Responsive -------------------------------------------------------------- */
@media (max-width: 1000px) {
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .topbar-center { display: none; }
}
@media (max-width: 760px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.2s; }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .stat-row, .two-col, .three-col { grid-template-columns: 1fr; }
  .user-meta { display: none; }
}
