/* ==========================================================================
   ARCHIMEDES DESIGN SYSTEM
   Brand: owl-navy (#1e3a5f) + gold-amber (#d4a017)
   Reference: Notion warmth + Linear precision
   ========================================================================== */

:root {
  /* Brand */
  --owl-navy: #1e3a5f;
  --owl-navy-900: #0f1f33;
  --owl-navy-800: #15294a;
  --owl-navy-700: #1e3a5f;
  --owl-navy-600: #2a5080;
  --owl-navy-500: #3a6a9e;
  --gold-amber: #d4a017;
  --gold-light: #f0d060;
  --gold-bg: #fdf8e8;

  /* Surfaces */
  --bg-page: #f7f8fa;
  --bg-card: #ffffff;
  --bg-sidebar: #15294a;
  --bg-sidebar-hover: rgba(255,255,255,0.06);
  --bg-sidebar-active: #d4a017;

  /* Text */
  --text-primary: rgba(0,0,0,0.92);
  --text-secondary: #5a6270;
  --text-tertiary: #8a919c;
  --text-sidebar: rgba(255,255,255,0.75);
  --text-sidebar-active: #1e3a5f;
  --text-on-navy: #ffffff;
  --text-on-gold: #1e3a5f;

  /* Borders */
  --border-subtle: 1px solid rgba(0,0,0,0.07);
  --border-card: 1px solid rgba(0,0,0,0.06);
  --border-accent: 3px solid var(--gold-amber);

  /* Shadows - Notion-style layered */
  --shadow-card: rgba(0,0,0,0.04) 0px 1.5px 6px, rgba(0,0,0,0.02) 0px 0.5px 2px;
  --shadow-card-hover: rgba(0,0,0,0.06) 0px 3px 12px, rgba(0,0,0,0.03) 0px 1px 3px;
  --shadow-nav: 0 1px 3px rgba(0,0,0,0.08);

  /* Radii */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-pill: 9999px;

  /* Spacing */
  --sidebar-w: 240px;
  --nav-h: 56px;
}

/* ── NAVBAR ─────────────────────────────────────────────────── */

.arch-navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  padding: 0 24px;
  background: var(--owl-navy-900);
  border-bottom: 2px solid var(--gold-amber);
  box-shadow: var(--shadow-nav);
}

.arch-navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-on-navy);
  text-decoration: none;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.3px;
}

.arch-navbar-brand:hover { color: var(--text-on-navy); }

.arch-navbar-brand .owl-icon {
  width: 32px;
  height: 32px;
  background: var(--gold-amber);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--owl-navy-900);
}

.arch-navbar-tagline {
  color: rgba(255,255,255,0.45);
  font-size: 12px;
  font-weight: 400;
  margin-left: 12px;
  font-style: italic;
}

.arch-navbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.arch-btn-ghost {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.85);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font: 500 13px/1 var(--font-sans, 'Inter', system-ui, sans-serif);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.arch-btn-ghost:hover { background: rgba(255,255,255,0.12); color: #fff; }

.arch-btn-gold {
  background: var(--gold-amber);
  color: var(--text-on-gold);
  border: none;
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  font: 600 13px/1 var(--font-sans, 'Inter', system-ui, sans-serif);
  cursor: pointer;
  transition: background 0.15s;
}

.arch-btn-gold:hover { background: var(--gold-light); }

/* ── LAYOUT ──────────────────────────────────────────────────── */

.arch-layout {
  display: flex;
  min-height: calc(100vh - var(--nav-h));
}

/* ── SIDEBAR ─────────────────────────────────────────────────── */

.arch-sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255,255,255,0.05);
  position: sticky;
  top: var(--nav-h);
  height: calc(100vh - var(--nav-h));
  overflow-y: auto;
  flex-shrink: 0;
}

.arch-sidebar-section-label {
  padding: 0 20px;
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold-amber);
}

.arch-sidebar-nav { list-style: none; margin: 0; padding: 0; }

.arch-sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  font: 500 14px/1.3 var(--font-sans, 'Inter', system-ui, sans-serif);
  color: var(--text-sidebar);
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}

.arch-sidebar-nav li a:hover {
  background: var(--bg-sidebar-hover);
  color: #fff;
}

.arch-sidebar-nav li a.active {
  background: var(--bg-sidebar-active);
  color: var(--text-sidebar-active);
  font-weight: 600;
}

.arch-sidebar-nav li a .icon {
  width: 18px;
  text-align: center;
  font-size: 15px;
}

.arch-sidebar-student-select {
  margin: 0 16px 16px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
  color: #fff;
  font: 400 13px/1.4 var(--font-sans, 'Inter', system-ui, sans-serif);
  width: calc(100% - 32px);
}

.arch-sidebar-student-select option { background: var(--owl-navy-900); }

/* ── MAIN CONTENT ────────────────────────────────────────────── */

.arch-main {
  flex: 1;
  padding: 32px;
  min-width: 0;
  background: var(--bg-page);
}

.arch-page-header {
  margin-bottom: 28px;
}

.arch-page-header h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--owl-navy);
  margin-bottom: 4px;
}

.arch-page-header p {
  font-size: 14px;
  color: var(--text-secondary);
}

/* ── STAT CARDS ───────────────────────────────────────────────── */

.arch-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.arch-stat-card {
  background: var(--bg-card);
  border: var(--border-card);
  border-left: var(--border-accent);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.2s;
}

.arch-stat-card:hover { box-shadow: var(--shadow-card-hover); }

.arch-stat-card .stat-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  margin-bottom: 6px;
}

.arch-stat-card .stat-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--owl-navy);
  letter-spacing: -1px;
  line-height: 1.1;
}

.arch-stat-card .stat-sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.arch-stat-card .stat-meta {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 8px;
}

/* ── COURSE CARDS ─────────────────────────────────────────────── */

.arch-course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.arch-course-card {
  background: var(--bg-card);
  border: var(--border-card);
  border-top: 3px solid var(--gold-amber);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.2s;
  overflow: hidden;
}

.arch-course-card:hover { box-shadow: var(--shadow-card-hover); }

.arch-course-card-header {
  padding: 16px 20px 12px;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

.arch-course-card-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.arch-course-card-header .course-code {
  font-size: 12px;
  color: var(--text-tertiary);
  font-family: var(--font-mono, 'JetBrains Mono', ui-monospace, monospace);
}

.arch-course-card-body {
  padding: 16px 20px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}

.grade-big {
  font-size: 36px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -1.5px;
}

.grade-big.a { color: #16a34a; }
.grade-big.b { color: #2563eb; }
.grade-big.c { color: #d97706; }
.grade-big.d, .grade-big.f { color: #dc2626; }

.grade-details {
  text-align: right;
  font-size: 13px;
}

.grade-details .letter {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
}

.grade-details .letter.a { background: #dcfce7; color: #16a34a; }
.grade-details .letter.b { background: #dbeafe; color: #2563eb; }
.grade-details .letter.c { background: #fef3c7; color: #d97706; }
.grade-details .letter.d, .grade-details .letter.f { background: #fee2e2; color: #dc2626; }

.arch-course-card-footer {
  padding: 10px 20px;
  background: rgba(0,0,0,0.02);
  font-size: 12px;
  color: var(--text-tertiary);
  display: flex;
  justify-content: space-between;
}

/* ── TABLE ────────────────────────────────────────────────────── */

.arch-table-wrap {
  background: var(--bg-card);
  border: var(--border-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.arch-table-wrap table {
  width: 100%;
  border-collapse: collapse;
}

.arch-table-wrap thead {
  background: var(--owl-navy-800);
}

.arch-table-wrap thead th {
  padding: 10px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  line-height: 1.4;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.85);
  border-bottom: 2px solid var(--gold-amber);
}

.arch-table-wrap tbody td {
  padding: 10px 16px;
  font-size: 14px;
  border-bottom: 1px solid rgba(0,0,0,0.04);
}

.arch-table-wrap tbody tr:hover {
  background: rgba(212,160,23,0.04);
}

.arch-table-wrap tbody tr:last-child td {
  border-bottom: none;
}

.arch-table-wrap tfoot td {
  padding: 12px 16px;
  font-weight: 700;
  font-size: 14px;
  border-top: 2px solid var(--gold-amber);
  color: var(--owl-navy);
}

/* ── BADGES ──────────────────────────────────────────────────── */

.arch-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
}

.arch-badge-success { background: #dcfce7; color: #16a34a; }
.arch-badge-info { background: #dbeafe; color: #2563eb; }
.arch-badge-warning { background: #fef3c7; color: #b45309; }
.arch-badge-danger { background: #fee2e2; color: #dc2626; }
.arch-badge-neutral { background: #f1f5f9; color: #475569; }

/* ── FOOTER ──────────────────────────────────────────────────── */

.arch-footer {
  background: var(--owl-navy-900);
  color: rgba(255,255,255,0.5);
  padding: 24px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  border-top: 2px solid var(--gold-amber);
}

.arch-footer a {
  color: var(--gold-amber);
  text-decoration: none;
}

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

.arch-footer-links {
  display: flex;
  gap: 20px;
}

.arch-footer-brand span {
  color: rgba(255,255,255,0.75);
  font-weight: 600;
}

/* ── LOGIN PAGE ──────────────────────────────────────────────── */

.arch-login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--owl-navy-900) 0%, var(--owl-navy-700) 100%);
}

.arch-login-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: var(--radius-lg);
  border-top: 4px solid var(--gold-amber);
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
  padding: 40px 36px;
}

.arch-login-card .owl-logo {
  width: 48px;
  height: 48px;
  background: var(--gold-amber);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  margin: 0 auto 16px;
  color: var(--owl-navy-900);
}

.arch-login-card h2 {
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  color: var(--owl-navy);
  margin-bottom: 4px;
}

.arch-login-card .subtitle {
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.arch-login-card label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 4px;
}

.arch-login-card input[type="text"],
.arch-login-card input[type="email"],
.arch-login-card input[type="password"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 16px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.arch-login-card input:focus {
  outline: none;
  border-color: var(--gold-amber);
  box-shadow: 0 0 0 3px rgba(212,160,23,0.15);
}

.arch-login-card .btn-login {
  width: 100%;
  padding: 10px;
  background: var(--owl-navy);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.arch-login-card .btn-login:hover { background: var(--owl-navy-600); }

.arch-login-card .btn-oauth {
  width: 100%;
  padding: 9px;
  background: #fff;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 8px;
  transition: background 0.15s;
}

.arch-login-card .btn-oauth:hover { background: #f8f8f8; }

.arch-login-card .divider {
  text-align: center;
  color: var(--text-tertiary);
  font-size: 12px;
  margin: 16px 0;
  position: relative;
}

.arch-login-card .divider::before,
.arch-login-card .divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 40%;
  border-top: 1px solid rgba(0,0,0,0.08);
}

.arch-login-card .divider::before { left: 0; }
.arch-login-card .divider::after { right: 0; }

.arch-login-card .forgot-link {
  display: block;
  text-align: center;
  font-size: 13px;
  color: var(--owl-navy-500);
  text-decoration: none;
  margin-top: 12px;
}

.arch-login-card .forgot-link:hover { text-decoration: underline; }

/* ── ALERTS (flash messages) ────────────────────────────────── */

.arch-alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 12px;
}

.arch-alert-success { background: #dcfce7; color: #16a34a; border: 1px solid #bbf7d0; }
.arch-alert-danger { background: #fee2e2; color: #dc2626; border: 1px solid #fecaca; }
.arch-alert-info { background: #dbeafe; color: #2563eb; border: 1px solid #bfdbfe; }
.arch-alert-warning { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }

/* ── PROFILE CARD ───────────────────────────────────────────── */

.arch-profile-card {
  background: var(--bg-card);
  border: var(--border-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 24px;
  margin-bottom: 20px;
}

.arch-profile-card h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--owl-navy);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

/* ── RESPONSIVE ─────────────────────────────────────────────── */

@media (max-width: 768px) {
  .arch-sidebar { display: none; }
  .arch-layout { flex-direction: column; }
  .arch-main { padding: 20px 16px; }
  .arch-stats-grid { grid-template-columns: 1fr 1fr; }
  .arch-course-grid { grid-template-columns: 1fr; }
  .arch-footer { flex-direction: column; gap: 8px; text-align: center; }
}