/* ═══════════════════════════════════════════════════
   ICPC ACADEMY — DESIGN SYSTEM v4
   HNU · FE · ICPC — Codeforces Light Theme
   Navy #1a3a6b · Red #c0392b · Gold #d4a017
   ═══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;800;900&family=IBM+Plex+Sans:wght@300;400;500;600;700;800&family=Space+Mono:wght@400;700&display=swap');

/* ── VARIABLES ───────────────────────────────────── */
:root {
  /* Backgrounds — Light */
  --bg-deep:       #f0f4f8;
  --bg-mid:        #edf1f7;
  --bg-card:       #ffffff;
  --bg-card2:      #f4f7fb;
  --bg-card-hover: #eef2f8;
  --bg-glass:      rgba(255, 255, 255, 0.85);
  --bg-glass2:     rgba(247, 249, 252, 0.95);
  --bg-input:      #ffffff;

  /* Primary — HNU Navy Blue (Codeforces style) */
  --accent:          #1a3a6b;
  --accent-bright:   #2651a0;
  --accent-dim:      rgba(26, 58, 107, 0.10);
  --accent-dim2:     rgba(26, 58, 107, 0.05);
  --accent-glow:     0 0 20px rgba(26, 58, 107, 0.15);
  --accent-glow-lg:  0 0 40px rgba(26, 58, 107, 0.12);
  --accent-glow-xl:  0 0 60px rgba(26, 58, 107, 0.15);

  /* Legacy cyan aliases → now navy */
  --cyan:          #1a3a6b;
  --cyan-bright:   #2651a0;
  --cyan-dim:      rgba(26, 58, 107, 0.10);
  --cyan-dim2:     rgba(26, 58, 107, 0.05);
  --cyan-glow:     0 0 20px rgba(26, 58, 107, 0.15);
  --cyan-glow-lg:  0 0 40px rgba(26, 58, 107, 0.12);
  --cyan-glow-xl:  0 0 60px rgba(26, 58, 107, 0.15);

  /* Red accent — from HNU logo */
  --red:           #c0392b;
  --red-dim:       rgba(192, 57, 43, 0.10);

  /* Secondary palette */
  --blue:          #2651a0;
  --blue-bright:   #3b6fd4;
  --blue-dim:      rgba(38, 81, 160, 0.12);
  --purple:        #6d4aad;
  --purple-dim:    rgba(109, 74, 173, 0.12);
  --violet:        #7c5cbf;

  /* Gold highlight — from HNU logo */
  --gold:          #d4a017;
  --gold-dim:      rgba(212, 160, 23, 0.12);

  /* Text */
  --text-primary:  #1a1f2e;
  --text-secondary:#3d4a5c;
  --text-muted:    #7a8799;
  --text-bright:   #0a0f1a;

  /* Semantic */
  --success:       #27ae60;
  --success-dim:   rgba(39, 174, 96, 0.12);
  --warning:       #d4a017;
  --warning-dim:   rgba(212, 160, 23, 0.12);
  --danger:        #c0392b;
  --danger-dim:    rgba(192, 57, 43, 0.10);
  --info:          #2980b9;

  /* Borders */
  --border:        rgba(26, 58, 107, 0.12);
  --border-subtle: rgba(26, 58, 107, 0.06);
  --border-hover:  rgba(26, 58, 107, 0.25);
  --border-active: rgba(26, 58, 107, 0.45);

  /* Radii */
  --radius-xs:     4px;
  --radius-sm:     8px;
  --radius-md:     12px;
  --radius-lg:     16px;
  --radius-xl:     24px;
  --radius-2xl:    32px;
  --radius-full:   9999px;

  /* Transitions */
  --transition:        all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow:   all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Fonts */
  --font-main:    'Cairo', 'IBM Plex Sans', sans-serif;
  --font-display: 'IBM Plex Sans', 'Cairo', sans-serif;
  --font-mono:    'Space Mono', monospace;

  /* Layout */
  --navbar-h:   64px;
  --sidebar-w:  260px;

  /* Shadows — light mode */
  --shadow-sm:  0 1px 4px rgba(26,58,107,0.08);
  --shadow-md:  0 4px 16px rgba(26,58,107,0.10);
  --shadow-lg:  0 12px 40px rgba(26,58,107,0.12);
  --shadow-xl:  0 20px 60px rgba(26,58,107,0.14);
}

/* ── RESET & BASE ────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.65;
  position: relative;
}

/* Subtle dot grid — light */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle, rgba(26,58,107,0.06) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
  z-index: 0;
  opacity: 1;
}

body::after {
  content: '';
  position: fixed;
  top: -20vh; right: -10vw;
  width: 60vw; height: 60vh;
  background: radial-gradient(ellipse, rgba(26,58,107,0.05) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg-mid); }
::-webkit-scrollbar-thumb {
  background: rgba(26,58,107,0.2);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(26,58,107,0.4); }

/* ── TYPOGRAPHY ──────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

h1 { font-size: clamp(1.9rem, 4vw, 2.9rem); font-weight: 800; }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); }
h3 { font-size: clamp(1.1rem, 2.5vw, 1.45rem); }

a { color: var(--accent); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent-bright); }

/* ── LAYOUT ──────────────────────────────────────── */
.page-wrapper {
  display: flex;
  min-height: 100vh;
  padding-top: var(--navbar-h);
  position: relative;
  z-index: 1;
}

.sidebar { display: none !important; }

.sidebar::after {
  content: '';
  position: absolute;
  top: 0; right: -1px;
  width: 1px; height: 100%;
  background: linear-gradient(180deg, transparent 0%, var(--accent) 40%, var(--blue-bright) 70%, transparent 100%);
  opacity: 0.2;
}

.main-content {
  flex: 1;
  margin: 0;
  padding: 2.5rem 2rem;
  width: 100%;
  min-width: 0;
  position: relative;
  z-index: 1;
}

@media (max-width: 768px) {
  .main-content { padding: 1.25rem 1rem; }
}

/* ── NAVBAR ──────────────────────────────────────── */
.navbar {
  height: var(--navbar-h);
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  background: #ffffff;
  backdrop-filter: blur(20px) saturate(1.4);
  border-bottom: 2px solid var(--border);
  box-shadow: 0 1px 0 rgba(26,58,107,0.06), 0 4px 20px rgba(26,58,107,0.07);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-sub {
  font-size: 0.65rem;
  color: var(--text-muted);
  opacity: 0.8;
}

.logo-ico {
  width: 76px;
  height: 76px;
}

@media (max-width: 768px) {
  .logo-ico { width: 46px; height: 46px; }
  .brand-sub { display: none; }
  .navbar { padding: 0 1rem; }
  .navbar-actions { gap: 0.5rem; }
}

.logo-ico img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.hero-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.hero-logo {
  width: 42px; height: 42px;
  background: linear-gradient(135deg, var(--accent), #e08000);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--accent-glow);
  overflow: hidden;
}

.navbar-brand span { color: var(--accent); }
.navbar-actions { display: flex; align-items: center; gap: 0.75rem; }

.notif-btn {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition);
}

.notif-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
  box-shadow: var(--accent-glow);
}

.notif-badge {
  position: absolute;
  top: -5px; right: -5px;
  width: 17px; height: 17px;
  background: var(--danger);
  border-radius: 50%;
  font-size: 0.6rem;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: white;
  border: 2px solid var(--bg-deep);
}

.user-avatar-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 2px solid var(--border);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
}

.user-avatar-btn:hover {
  border-color: var(--accent);
  box-shadow: var(--accent-glow);
}

/* ── SIDEBAR NAV ─────────────────────────────────── */
.sidebar-nav { list-style: none; padding: 0 0.75rem; }
.sidebar-nav li { margin-bottom: 0.15rem; }

.sidebar-nav a {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.7rem 1rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 500; font-size: 0.9rem;
  transition: var(--transition);
  border: 1px solid transparent;
}

.sidebar-nav a:hover {
  color: var(--text-primary);
  background: var(--bg-card2);
}

.sidebar-nav a.active {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: rgba(26,58,107,0.2);
}

.sidebar-nav a.active::after {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

.sidebar-nav .nav-icon { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 0.75rem 1rem;
}

.sidebar-label {
  padding: 0.5rem 1.5rem;
  font-size: 0.68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--text-muted);
}

/* ── CARDS ───────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.card:hover { border-color: rgba(26,58,107,0.20); }

.card-glow {
  box-shadow: 0 2px 20px rgba(26,58,107,0.08);
  transition: var(--transition-slow);
}

.card-glow:hover {
  box-shadow: 0 8px 40px rgba(26,58,107,0.13), 0 0 0 1px rgba(26,58,107,0.10);
  transform: translateY(-2px);
}

/* Stat cards */
.stat-card { display: flex; flex-direction: column; gap: 0.5rem; }

.stat-card .stat-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  background: var(--accent-dim);
  border: 1px solid rgba(26,58,107,0.12);
  margin-bottom: 0.2rem;
}

.stat-card .stat-label {
  font-size: 0.75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-muted);
}

.stat-card .stat-value {
  font-size: 2rem; font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  font-family: var(--font-mono);
}

.stat-card .stat-sub {
  font-size: 0.8rem; color: var(--text-secondary);
  display: flex; align-items: center; gap: 0.3rem;
}

.stat-card .stat-trend-up   { color: var(--success); }
.stat-card .stat-trend-down { color: var(--danger); }

/* ── BUTTONS ─────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center; justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.5rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 0.9rem; font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: none; outline: none;
  white-space: nowrap;
  position: relative; overflow: hidden;
  letter-spacing: 0.01em;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 2px 12px rgba(26,58,107,0.25);
}

.btn-primary:hover {
  background: var(--accent-bright);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(26,58,107,0.35);
  color: #ffffff;
}

.btn-primary:active { transform: translateY(0); }

.external-link-btn {
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 10px;
  box-shadow: 0 2px 12px rgba(26,58,107,0.25);
  transition: var(--transition);
  font-size: 0.95rem;
}

.external-link-btn:hover {
  background: var(--accent-bright);
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(26,58,107,0.35);
  color: #ffffff;
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid rgba(26,58,107,0.35);
}

.btn-outline:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
  box-shadow: var(--accent-glow);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--bg-card2);
  color: var(--text-primary);
  border-color: rgba(26,58,107,0.20);
}

.btn-danger {
  background: var(--danger-dim);
  color: var(--danger);
  border: 1px solid rgba(239,71,67,0.3);
}

.btn-danger:hover {
  background: rgba(239,71,67,0.2);
  border-color: var(--danger);
  box-shadow: 0 0 16px rgba(239,71,67,0.25);
}

.btn-gold {
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 2px 12px rgba(26,58,107,0.25);
}

.btn-gold:hover {
  background: var(--accent-bright);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(26,58,107,0.35);
}

.btn-sm   { padding: 0.36rem 0.9rem; font-size: 0.82rem; }
.btn-lg   { padding: 0.85rem 2rem; font-size: 1rem; }
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; }

/* Spinner */
.btn .spinner {
  width: 14px; height: 14px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── FORMS ───────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }

.form-label {
  display: block;
  font-size: 0.8rem; font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.45rem;
  text-transform: uppercase; letter-spacing: 0.07em;
}

.input-wrap { position: relative; }

.input-icon {
  position: absolute;
  left: 0.9rem; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.95rem;
  pointer-events: none;
  transition: color 0.2s;
}

.input-wrap:focus-within .input-icon { color: var(--accent); }
.input-wrap .form-control { padding-left: 2.5rem; }

.form-control {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 0.93rem;
  transition: var(--transition);
  outline: none;
}

.form-control:hover { border-color: rgba(26,58,107,0.25); }

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
  background: var(--bg-card2);
}

.form-control::placeholder { color: var(--text-muted); }

textarea.form-control { resize: vertical; min-height: 100px; line-height: 1.6; }

.form-error {
  margin-top: 0.4rem; font-size: 0.8rem;
  color: var(--danger);
  display: flex; align-items: center; gap: 0.3rem;
}

/* Select arrow */
select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%231a3a6b' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
  cursor: pointer;
}

/* ── PROGRESS BARS ───────────────────────────────── */
.progress-bar-wrap {
  background: rgba(26,58,107,0.08);
  border-radius: var(--radius-full);
  height: 6px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--accent);
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 8px rgba(26,58,107,0.35);
}

.progress-label {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 0.45rem; font-size: 0.82rem;
  color: var(--text-secondary);
}

.progress-label span:last-child { color: var(--accent); font-weight: 700; font-family: var(--font-mono); }

/* ── BADGES ──────────────────────────────────────── */
.badge-chip {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.25rem 0.7rem;
  border-radius: var(--radius-full);
  font-size: 0.73rem; font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-chip.cyan   { background: var(--accent-dim);   color: var(--accent);    border: 1px solid rgba(26,58,107,0.22); }
.badge-chip.green  { background: var(--success-dim);   color: var(--success);   border: 1px solid rgba(45,181,93,0.22); }
.badge-chip.gold   { background: var(--gold-dim);      color: var(--gold);      border: 1px solid rgba(255,161,22,0.22); }
.badge-chip.red    { background: var(--danger-dim);    color: var(--danger);    border: 1px solid rgba(239,71,67,0.22); }
.badge-chip.purple { background: var(--purple-dim);    color: var(--violet);    border: 1px solid rgba(123,97,255,0.22); }

/* ── TOAST NOTIFICATIONS ─────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 1.5rem; right: 1.5rem;
  z-index: 9999;
  display: flex; flex-direction: column;
  gap: 0.6rem;
  pointer-events: none;
}

@media (max-width: 480px) {
  #toast-container { bottom: 1rem; right: 0.75rem; left: 0.75rem; }
  .toast { min-width: unset; max-width: 100%; width: 100%; }
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  min-width: 280px; max-width: 360px;
  box-shadow: var(--shadow-xl);
  display: flex; align-items: flex-start; gap: 0.75rem;
  pointer-events: all;
  animation: toastIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.info    { border-left: 3px solid var(--accent); }
.toast.warning { border-left: 3px solid var(--warning); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px) scale(0.95); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}

.toast-icon { font-size: 1.1rem; margin-top: 0.05rem; flex-shrink: 0; }
.toast-body { flex: 1; }
.toast-title { font-weight: 700; font-size: 0.88rem; margin-bottom: 0.2rem; }
.toast-msg   { font-size: 0.8rem; color: var(--text-secondary); }

/* ── GRID HELPERS ────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.25rem; }

@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

/* ── SECTION TYPES ───────────────────────────────── */
.section-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: var(--transition);
}

.section-card:hover { border-color: rgba(26,58,107,0.20); }
.section-card.completed { border-color: rgba(45,181,93,0.25); }
.section-card.completed .section-header { background: rgba(45,181,93,0.04); }

.section-header {
  padding: 1rem 1.2rem;
  display: flex; align-items: center; gap: 0.75rem;
  cursor: pointer; user-select: none;
  transition: background 0.15s;
}

.section-header:hover { background: rgba(26,58,107,0.03); }

.section-type-icon {
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; flex-shrink: 0;
}

.section-type-icon.video { background: rgba(239,71,67,0.12);  color: var(--danger); }
.section-type-icon.link  { background: rgba(96,165,250,0.12); color: var(--info); }
.section-type-icon.note  { background: rgba(26,58,107,0.08);  color: var(--accent); }
.section-type-icon.quiz  { background: var(--purple-dim);     color: var(--violet); }

.section-title { flex: 1; font-weight: 600; font-size: 0.9rem; }

.section-check {
  width: 22px; height: 22px;
  border: 2px solid var(--border);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem;
  transition: var(--transition);
  cursor: pointer;
}

.section-check:hover { border-color: var(--accent); background: var(--accent-dim); }

.section-check.done {
  background: var(--success);
  border-color: var(--success);
  color: #000;
  box-shadow: 0 0 8px rgba(45,181,93,0.4);
}

.section-body { display: none; padding: 1.25rem; border-top: 1px solid var(--border); }
.section-body.open { display: block; animation: fadeIn 0.2s ease; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Video embed */
.video-embed {
  width: 100%; aspect-ratio: 16/9;
  border-radius: var(--radius-sm);
  overflow: hidden; background: #000;
  box-shadow: 0 8px 30px rgba(0,0,0,0.6);
}

.video-embed iframe { width: 100%; height: 100%; border: none; }

/* Notes */
.notes-content {
  line-height: 1.85; color: var(--text-secondary); font-size: 0.93rem;
}

.notes-content code {
  background: rgba(26,58,107,0.07);
  color: var(--accent);
  padding: 0.15em 0.45em;
  border-radius: 4px;
  font-family: var(--font-mono); font-size: 0.85em;
  border: 1px solid rgba(26,58,107,0.12);
}

/* ── WEEK CARDS ──────────────────────────────────── */
.week-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  transition: var(--transition-slow);
  position: relative; overflow: hidden;
}

.week-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.week-card:not(.locked):hover::before { opacity: 1; }

.week-card.locked { opacity: 0.4; pointer-events: none; }
.week-card.locked::after {
  content: '';
  position: absolute; top: 1rem; right: 1rem;
  width: 20px; height: 20px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23555555' stroke-width='2'%3E%3Crect x='3' y='11' width='18' height='11' rx='2' ry='2'/%3E%3Cpath d='M7 11V7a5 5 0 0 1 10 0v4'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
}

.week-card:not(.locked):hover {
  border-color: rgba(26,58,107,0.28);
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(26,58,107,0.12), 0 0 0 1px rgba(26,58,107,0.08);
}

/* ── LEADERBOARD ─────────────────────────────────── */
.leaderboard-row {
  display: grid;
  grid-template-columns: 50px 1fr auto auto;
  align-items: center; gap: 1rem;
  padding: 0.85rem 1.2rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: var(--transition);
  margin-bottom: 0.35rem;
}

@media (max-width: 480px) {
  .leaderboard-row { grid-template-columns: 40px 1fr auto; gap: 0.6rem; padding: 0.7rem 0.85rem; }
}

.leaderboard-row:hover { background: var(--bg-card2); border-color: var(--border); }

.leaderboard-row.top-1 { background: rgba(255,215,0,0.04); border-color: rgba(255,215,0,0.12); }
.leaderboard-row.top-2 { background: rgba(192,192,192,0.03); border-color: rgba(192,192,192,0.1); }
.leaderboard-row.top-3 { background: rgba(205,127,50,0.03); border-color: rgba(205,127,50,0.1); }

.rank-badge {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.85rem;
  font-family: var(--font-mono);
}

.rank-badge.gold   { background: rgba(255,215,0,0.12);   color: #FFD700; border: 2px solid rgba(255,215,0,0.5); }
.rank-badge.silver { background: rgba(192,192,192,0.1);  color: #C8C8C8; border: 2px solid rgba(192,192,192,0.4); }
.rank-badge.bronze { background: rgba(205,127,50,0.1);   color: #D4915A; border: 2px solid rgba(205,127,50,0.4); }
.rank-badge.other  { background: var(--bg-card2); color: var(--text-muted); border: 1px solid var(--border); }

/* ── MODAL ───────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,25,50,0.55);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease;
}

@media (max-width: 480px) {
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal {
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    max-height: 92vh; padding: 1.5rem 1.25rem;
    width: 100%; max-width: 100%;
  }
}

.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  width: 100%; max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem; padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.modal-close {
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  background: var(--bg-card2); border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer; font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}

.modal-close:hover { border-color: var(--danger); color: var(--danger); }

/* ── TABS ────────────────────────────────────────── */
.tab-nav {
  display: flex; gap: 0.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.tab-btn {
  padding: 0.6rem 1.1rem;
  background: none; border: none;
  color: var(--text-muted);
  font-family: var(--font-main); font-size: 0.88rem; font-weight: 600;
  cursor: pointer; transition: var(--transition);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.tab-btn:hover { color: var(--text-secondary); background: rgba(26,58,107,0.04); }

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: none;
}

/* ── DATA TABLE ──────────────────────────────────── */
.data-table {
  width: 100%; border-collapse: collapse;
  font-size: 0.88rem;
}

.data-table th {
  text-align: left;
  padding: 0.65rem 0.9rem;
  font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  vertical-align: middle;
}

.data-table tr:hover td { background: rgba(26,58,107,0.03); }
.data-table tr:last-child td { border-bottom: none; }

/* ── NOTIFICATION PANEL ──────────────────────────── */
.notif-panel {
  position: fixed;
  top: var(--navbar-h); right: 0;
  width: 340px;
  max-height: calc(100vh - var(--navbar-h) - 2rem);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  z-index: 190;
  overflow: hidden;
  display: flex; flex-direction: column;
  transform: translateX(110%);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  margin: 0.5rem;
}

.notif-panel.open { transform: translateX(0); }

.notif-panel-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}

.notif-panel-list { overflow-y: auto; flex: 1; }

.notif-item {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer; transition: background 0.15s;
  display: flex; gap: 0.75rem; align-items: flex-start;
}

.notif-item:hover { background: rgba(26,58,107,0.04); }

.notif-item.unread { background: rgba(26,58,107,0.05); }

.notif-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0; margin-top: 0.35rem;
  box-shadow: 0 0 6px rgba(26,58,107,0.4);
}

.notif-dot.read { background: var(--border); box-shadow: none; }

.notif-item-title { font-weight: 600; font-size: 0.85rem; margin-bottom: 0.2rem; }
.notif-item-msg   { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.4; }
.notif-item-time  { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.3rem; }

@media (max-width: 480px) {
  .notif-panel { width: calc(100vw - 1rem); right: 0; margin: 0.5rem; }
}

/* ── SKELETON LOADING ────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg,
    rgba(26,58,107,0.05) 0%,
    rgba(26,58,107,0.10) 50%,
    rgba(26,58,107,0.05) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite;
  border-radius: var(--radius-sm);
}

.skeleton-card { pointer-events: none; }

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ── SECTION NAVIGATION ──────────────────────────── */
.content-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  position: relative; overflow: hidden;
}

/* ── PROFILE ELEMENTS ────────────────────────────── */
.profile-avatar-wrap {
  position: relative; width: fit-content;
}

.profile-avatar {
  width: 100px; height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(26,58,107,0.30);
  display: block;
}

.profile-avatar-badge {
  position: absolute; bottom: 4px; right: 4px;
  width: 24px; height: 24px;
  background: var(--success);
  border-radius: 50%;
  border: 3px solid var(--bg-deep);
}

/* ── PAGE HEADER ─────────────────────────────────── */
.page-header {
  margin-bottom: 2rem;
}

.page-header h1 {
  font-size: 1.8rem; font-weight: 800;
  color: var(--text-primary);
}

.page-header p {
  color: var(--text-secondary);
  margin-top: 0.35rem; font-size: 0.92rem;
}

/* ── DIVIDER ─────────────────────────────────────── */
.glow-divider {
  height: 1px;
  background: var(--border);
  margin: 2rem 0;
}

/* ── MOBILE MENU TOGGLE ──────────────────────────── */
.mobile-menu-btn {
  display: none;
  background: none; border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 38px; height: 38px;
  align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-secondary);
  transition: var(--transition);
}

.mobile-menu-btn:hover { border-color: var(--accent); color: var(--accent); }
@media (max-width: 768px) { .mobile-menu-btn { display: flex; } }

/* ── BACKGROUND GLOWS ────────────────────────────── */
.bg-glow {
  position: fixed; pointer-events: none; z-index: 0;
  border-radius: 50%; filter: blur(120px);
}

.bg-glow-1 { width: 600px; height: 600px; background: #1a3a6b; top: -200px; left: -150px; opacity: 0.04; }
.bg-glow-2 { width: 500px; height: 500px; background: #c0392b; bottom: -150px; right: -150px; opacity: 0.03; }
.bg-glow-3 { width: 400px; height: 400px; background: var(--purple); top: 40%; right: 5%; opacity: 0.015; }

/* ── UTILS ───────────────────────────────────────── */
.text-cyan    { color: var(--accent) !important; }
.text-muted   { color: var(--text-muted) !important; }
.text-success { color: var(--success) !important; }
.text-danger  { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-gold    { color: var(--gold) !important; }

.flex         { display: flex; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-wrap    { flex-wrap: wrap; }
.gap-xs       { gap: 0.3rem; }
.gap-sm       { gap: 0.5rem; }
.gap-md       { gap: 1rem; }
.gap-lg       { gap: 1.5rem; }

.mt-sm { margin-top: 0.5rem; }
.mt-md { margin-top: 1rem; }
.mt-lg { margin-top: 1.5rem; }
.mt-xl { margin-top: 2rem; }
.mb-sm { margin-bottom: 0.5rem; }
.mb-md { margin-bottom: 1rem; }
.mb-lg { margin-bottom: 1.5rem; }

.fw-bold  { font-weight: 700; }
.fw-black { font-weight: 900; }
.fs-sm    { font-size: 0.85rem; }
.fs-xs    { font-size: 0.75rem; }

.rounded  { border-radius: var(--radius-md); }
.border-bottom { border-bottom: 1px solid var(--border); padding-bottom: 1rem; margin-bottom: 1rem; }

.text-glow { text-shadow: 0 0 20px rgba(26,58,107,0.35); }

.glass-panel {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.hl {
  display: inline;
  background: var(--accent-dim);
  color: var(--accent);
  border-radius: 4px;
  padding: 0.05em 0.35em;
  font-family: var(--font-mono); font-size: 0.88em;
}

/* ── ONLINE INDICATOR ────────────────────────────── */
.online-dot {
  width: 8px; height: 8px;
  border-radius: 50%; background: var(--success);
  box-shadow: 0 0 0 0 rgba(45,181,93,0.5);
  animation: pulse-online 2.5s infinite;
  display: inline-block;
}

@keyframes pulse-online {
  0%   { box-shadow: 0 0 0 0 rgba(45,181,93,0.5); }
  70%  { box-shadow: 0 0 0 6px rgba(45,181,93,0); }
  100% { box-shadow: 0 0 0 0 rgba(45,181,93,0); }
}

/* ── MOBILE RESPONSIVE ───────────────────────────── */
@media (max-width: 768px) {
  .btn-sm { padding: 0.5rem 0.9rem; font-size: 0.82rem; min-height: 36px; }
  .btn    { min-height: 40px; }
  .page-header h1 { font-size: 1.5rem; }
  .page-header p  { font-size: 0.85rem; }
  .card { padding: 1.1rem; }
  .stat-card .stat-value { font-size: 1.6rem; }
  .tab-nav { flex-wrap: wrap; }
  .tab-btn { min-width: 80px; font-size: 0.8rem; padding: 0.45rem 0.65rem; }
  .page-header.flex-between {
    flex-direction: column; align-items: flex-start; gap: 0.75rem;
  }
  .page-header.flex-between > * { width: 100%; }
  .flex-between { flex-wrap: wrap; gap: 0.5rem; }
  .form-control { font-size: 16px; }
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  :root { --navbar-h: 58px; }
  html { font-size: 15px; }
  .page-wrapper { padding-top: var(--navbar-h); }
  .navbar-brand { gap: 6px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr !important; }
  .stat-card .stat-value { font-size: 1.45rem; }
  .flex.gap-sm { flex-wrap: wrap; }
  .rank-badge { width: 32px; height: 32px; font-size: 0.75rem; }
  .toast { padding: 0.75rem 1rem; }
  .modal { padding: 1.25rem 1rem 2rem; }
  .bg-glow-1 { opacity: 0.01; }
  .bg-glow-2 { opacity: 0.012; }
  .bg-glow-3 { display: none; }
  .page-header { margin-bottom: 1.25rem; }
  .page-header h1 { font-size: 1.35rem; }
  .leaderboard-row { gap: 0.5rem; padding: 0.65rem 0.75rem; }
  .notif-item { padding: 0.75rem 1rem; }
  .external-link-btn { width: 100%; justify-content: center; }
}

@media (max-height: 500px) and (max-width: 900px) {
  .modal { max-height: 85vh; }
  .notif-panel { max-height: 60vh; }
}

@supports (padding: env(safe-area-inset-bottom)) {
  @media (max-width: 768px) {
    #toast-container { bottom: calc(1rem + env(safe-area-inset-bottom)); }
    .modal { padding-bottom: calc(1.25rem + env(safe-area-inset-bottom)); }
    .navbar {
      padding-left:  max(1rem, env(safe-area-inset-left));
      padding-right: max(1rem, env(safe-area-inset-right));
    }
  }
}