/* ============================================================
   CompSjid — Design system (style.css)
   ============================================================ */

/* ─── Theme variables ─────────────────────────────────────── */
:root {
  --bg:        #f5f7fb;
  --light-bg:  #ffffff;
  --card-bg:   #ffffff;
  --text:      #0f1729;
  --sub:       #64748b;
  --border:    #e5e9f2;
  --mid:       #2e6fc5;
  --deep:      #1b4f8a;
  --light:     #4fa3e0;
  --accent:    #7dd3fc;
  --success:   #16a34a;
  --warn:      #d97706;
  --danger:    #dc2626;
  --shadow-sm: 0 1px 3px rgba(15,23,41,.06);
  --shadow-md: 0 4px 16px rgba(15,23,41,.08);
  --shadow-lg: 0 20px 60px rgba(15,23,41,.12);
}
[data-theme="dark"] {
  --bg:        #0a1020;
  --light-bg:  #111a30;
  --card-bg:   #141d35;
  --text:      #e5e9f2;
  --sub:       #94a3b8;
  --border:    #1f2a47;
  --mid:       #4fa3e0;
  --deep:      #2e6fc5;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,.4);
  --shadow-lg: 0 20px 60px rgba(0,0,0,.5);
}

/* ─── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Google Sans Flex', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-feature-settings: 'cv11', 'ss01';
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  transition: background .2s, color .2s;
}
.font-display { font-family: 'Google Sans Flex', sans-serif; font-weight: 700; letter-spacing: -.02em; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ─── Logo "π" gradient text ──────────────────────────────── */
.pi-logo {
  background: linear-gradient(135deg, var(--deep) 0%, var(--mid) 55%, var(--light) 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -.01em;
}

/* ─── Card surface ────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

/* ─── Primary button (deep → light gradient) ──────────────── */
.btn-primary {
  background: linear-gradient(135deg, var(--deep), var(--light));
  color: #fff;
  border: none;
  box-shadow: 0 4px 14px rgba(46,111,197,.25);
}
.btn-primary:hover { opacity: .92; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

/* ─── Navbar ──────────────────────────────────────────────── */
#navbar {
  background: rgba(255,255,255,.85);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
          backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
}
[data-theme="dark"] #navbar {
  background: rgba(10,16,32,.85);
}
#navbar.scrolled { box-shadow: var(--shadow-sm); }

.nav-link {
  color: var(--text);
  transition: all .15s;
}
.nav-link:hover { color: var(--mid); }
[data-theme="dark"] .nav-link:hover { background: rgba(79,163,224,.08) !important; }

/* Dropdown */
.dropdown-parent { position: relative; }
.dropdown {
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity .18s, transform .18s, visibility .18s;
  background: var(--card-bg);
  border: 1px solid var(--border);
}
.dropdown-parent:hover .dropdown,
.dropdown-parent:focus-within .dropdown {
  opacity: 1; visibility: visible; transform: translateY(0);
}

/* Mobile-toggle hidden on desktop */
.mobile-toggle { display: none; }
.mobile-menu { display: none; background: var(--card-bg); }
.mobile-menu.open { display: block; }
@media (max-width: 900px) {
  .desktop-nav { display: none !important; }
  .mobile-toggle { display: flex !important; }
  .hide-mobile { display: none !important; }
}

/* ─── Page hero (deep gradient) ───────────────────────────── */
.page-hero {
  position: relative;
  padding: 110px 16px 60px;
  background:
    radial-gradient(900px 400px at 12% 8%, rgba(125,211,252,.18) 0%, transparent 60%),
    radial-gradient(700px 380px at 92% 30%, rgba(79,163,224,.18) 0%, transparent 60%),
    linear-gradient(135deg, #0a1428 0%, #0f1f3d 45%, #1b4f8a 100%);
  overflow: hidden;
}
.page-hero::before {
  content: ''; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
  pointer-events: none;
}

.breadcrumb {
  font-size: 13px; color: rgba(255,255,255,.65); gap: 6px;
}
.breadcrumb a { color: rgba(255,255,255,.85); transition: color .15s; }
.breadcrumb a:hover { color: #fff; }
.breadcrumb span:not(:last-child) { color: rgba(255,255,255,.4); margin: 0 2px; }

/* ─── Section titles ──────────────────────────────────────── */
.section-title { color: var(--text); }

/* ─── Progress bars ───────────────────────────────────────── */
.progress-bar-track {
  width: 100%; height: 8px;
  background: rgba(46,111,197,.1);
  border-radius: 999px; overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--deep), var(--light));
  border-radius: 999px;
  transition: width .4s ease;
}

/* ─── Live clock widget (replaces BAC countdown) ──────────── */
.live-clock {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 10px 18px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.live-clock .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(22,163,74,.5);
  animation: pulse 1.6s cubic-bezier(.66,0,0,1) infinite;
}
.live-clock .time {
  font-family: 'JetBrains Mono', 'SF Mono', Menlo, monospace;
  color: var(--mid); font-weight: 700;
  font-variant-numeric: tabular-nums;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0   rgba(22,163,74,.45); }
  70%  { box-shadow: 0 0 0 10px rgba(22,163,74,0);  }
  100% { box-shadow: 0 0 0 0   rgba(22,163,74,0);  }
}

/* ─── Active users counter (replaces streak) ──────────────── */
.active-counter {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 14px;
  background: linear-gradient(135deg, rgba(22,163,74,.08), rgba(79,163,224,.08));
  border: 1px solid rgba(22,163,74,.18);
  border-radius: 999px;
  font-size: 13px; font-weight: 600;
}
.active-counter .num {
  background: linear-gradient(135deg, var(--success), var(--light));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800; font-variant-numeric: tabular-nums;
}

/* ─── Niveau cards ────────────────────────────────────────── */
.niveau-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px;
  transition: all .2s;
  position: relative;
  overflow: hidden;
}
.niveau-card::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, transparent 50%, rgba(79,163,224,.06) 100%);
  pointer-events: none;
  opacity: 0; transition: opacity .25s;
}
.niveau-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--mid);
}
.niveau-card:hover::before { opacity: 1; }

.niveau-tag {
  display: inline-block;
  font-size: 10px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .8px;
  padding: 3px 9px; border-radius: 20px;
  margin-bottom: 10px;
}
.tag-college { background: rgba(125,211,252,.18); color: #0369a1; }
.tag-lycee   { background: rgba(46,111,197,.15);  color: var(--deep); }
.tag-bac     { background: rgba(220,38,38,.12);   color: var(--danger); }

/* ─── Modals (auth + dash) ────────────────────────────────── */
#authOverlay, #dashOverlay {
  display: none;
  position: fixed; inset: 0; z-index: 100;
  background: rgba(10,16,32,.65);
  -webkit-backdrop-filter: blur(8px);
          backdrop-filter: blur(8px);
  align-items: center; justify-content: center;
  padding: 20px;
  animation: fadeIn .2s;
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }

/* ─── Stats bar ───────────────────────────────────────────── */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 22px;
  background: linear-gradient(135deg, #0a1428, #1b4f8a);
  border-radius: 20px;
  margin-bottom: 32px;
  position: relative; overflow: hidden;
}
.stats-bar::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 80% 20%, rgba(125,211,252,.15), transparent 50%);
  pointer-events: none;
}
.stat-item { text-align: center; position: relative; z-index: 1; }
@media (max-width: 640px) { .stats-bar { grid-template-columns: repeat(2,1fr); } }

/* ─── Utility ─────────────────────────────────────────────── */
.max-w-7xl { max-width: 1280px; }
.mx-auto   { margin-left: auto; margin-right: auto; }

/* ─── Scrollbar polish ────────────────────────────────────── */
*::-webkit-scrollbar         { width: 10px; height: 10px; }
*::-webkit-scrollbar-track   { background: transparent; }
*::-webkit-scrollbar-thumb   { background: var(--border); border-radius: 10px; }
*::-webkit-scrollbar-thumb:hover { background: var(--mid); }

/* ─── Focus rings ─────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--mid);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ─── Selection ───────────────────────────────────────────── */
::selection { background: rgba(46,111,197,.25); color: var(--text); }
