/* =====================================================================
   Practice School — Custom Styles (Bootstrap 5 + Custom Design Tokens)
   Mirrors the original Tailwind/shadcn design exactly
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ── Design Tokens ── */
:root {
  --ps-primary:       #6b48c8;
  --ps-primary-light: #8b68e8;
  --ps-primary-fg:    #ffffff;
  --ps-bg:            #ffffff;
  --ps-fg:            #1c2230;
  --ps-muted:         #f5f5f7;
  --ps-muted-fg:      #717a8a;
  --ps-border:        #e8eaef;
  --ps-card:          #ffffff;
  --ps-accent:        #f0ecfc;
  --ps-accent-fg:     #4a3580;
  --ps-sidebar-bg:    #ffffff;
  --ps-sidebar-fg:    #717a8a;
  --ps-radius:        0.625rem;
  --ps-sidebar-w:     260px;
  --ps-topbar-h:      64px;
  --ps-green:         #3d8f62;
  --ps-amber:         #b07a28;
}

/* ── Reset / Base ── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  background: var(--ps-bg);
  color: var(--ps-fg);
  margin: 0;
}

code, pre, .font-mono {
  font-family: 'JetBrains Mono', monospace !important;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(113,122,138,0.2); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(113,122,138,0.4); }

/* ── App Shell ── */
.app-shell {
  display: flex;
  height: 100vh;
  width: 100%;
  overflow: hidden;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--ps-sidebar-w);
  flex-shrink: 0;
  background: var(--ps-sidebar-bg);
  border-right: 1px solid var(--ps-border);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  z-index: 100;
  transition: transform 0.25s ease;
}

.sidebar-brand {
  padding: 1.25rem;
  border-bottom: 1px solid var(--ps-border);
}

.sidebar-brand .brand-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--ps-primary), #7c5ce8);
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.sidebar-brand .brand-name { font-size: 14px; font-weight: 600; color: var(--ps-fg); }
.sidebar-brand .brand-sub  { font-size: 11px; color: var(--ps-muted-fg); }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0.75rem;
}

/* ── Section headers (collapsible toggles) ── */
.nav-section-toggle {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between;
  background: none; border: none; cursor: pointer;
  padding: 6px 12px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ps-muted-fg);
  border-radius: var(--ps-radius);
  transition: color 0.15s;
  margin-top: 1rem;
}
.nav-section-toggle:hover { color: var(--ps-fg); }
.nav-section-toggle .chevron {
  width: 12px; height: 12px;
  transition: transform 0.2s;
  flex-shrink: 0;
}
.nav-section-toggle.collapsed .chevron { transform: rotate(-90deg); }

/* ── Nav items ── */
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  border-radius: var(--ps-radius);
  font-size: 14px; font-weight: 500;
  color: var(--ps-sidebar-fg);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  cursor: pointer; border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: var(--ps-muted); color: var(--ps-fg); text-decoration: none; }
.nav-item.active {
  background: var(--ps-accent);
  color: var(--ps-accent-fg);
  font-weight: 600;
}
.nav-item.active svg { color: var(--ps-primary); }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

/* ── Sub-nav items (indented) ── */
.sub-nav { margin-left: 1.25rem; padding-left: 0.75rem; border-left: 1px solid var(--ps-border); }
.sub-nav-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 12px; font-weight: 500;
  color: var(--ps-muted-fg);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.sub-nav-item:hover { background: var(--ps-muted); color: var(--ps-fg); text-decoration: none; }
.sub-nav-item.active { background: var(--ps-accent); color: var(--ps-primary); font-weight: 600; }
.sub-nav-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ps-border); flex-shrink: 0;
}
.sub-nav-item.active .sub-nav-dot { background: var(--ps-primary); }

/* ── Nested group toggle (year/interview sub-group) ── */
.nav-group-toggle {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  border-radius: var(--ps-radius);
  font-size: 14px; font-weight: 500;
  color: var(--ps-fg);
  cursor: pointer; border: none; background: none; width: 100%; text-align: left;
  transition: background 0.15s;
}
.nav-group-toggle:hover { background: var(--ps-muted); }
.nav-group-toggle .chevron { margin-left: auto; width: 12px; height: 12px; transition: transform 0.2s; color: var(--ps-muted-fg); }
.nav-group-toggle.collapsed .chevron { transform: rotate(-90deg); }
.nav-group-toggle svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--ps-muted-fg); }
.nav-group-toggle .hours { font-size: 10px; color: var(--ps-muted-fg); font-weight: 400; }

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--ps-border);
  font-size: 11px; color: var(--ps-muted-fg); text-align: center;
}

/* ── Main area ── */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Topbar ── */
.topbar {
  height: var(--ps-topbar-h);
  flex-shrink: 0;
  border-bottom: 1px solid var(--ps-border);
  background: var(--ps-bg);
  display: flex; align-items: center;
  padding: 0 2rem;
  gap: 1.5rem;
}
.topbar-brand { font-size: 16px; font-weight: 700; color: var(--ps-fg); letter-spacing: -0.02em; }
.topbar-badge {
  font-size: 10px; font-weight: 600;
  padding: 2px 8px; border-radius: 50px;
  background: linear-gradient(135deg, var(--ps-primary), #7c5ce8);
  color: #fff;
}
.topbar-spacer { flex: 1; }
.topbar-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: var(--ps-radius);
  font-size: 14px; font-weight: 500;
  border: 1px solid var(--ps-border);
  background: var(--ps-muted);
  color: var(--ps-fg);
  cursor: pointer; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
  text-decoration: none;
}
.topbar-btn:hover { background: #ebebee; border-color: rgba(107,72,200,0.3); color: var(--ps-fg); text-decoration: none; }
.topbar-btn.primary-btn {
  background: rgba(107,72,200,0.08);
  border-color: rgba(107,72,200,0.2);
  color: var(--ps-primary);
}
.topbar-btn.primary-btn:hover { background: rgba(107,72,200,0.15); border-color: rgba(107,72,200,0.3); color: var(--ps-primary); }
.topbar-dot { width: 8px; height: 8px; border-radius: 50%; }

/* Mobile sidebar toggle */
.sidebar-toggle-btn {
  display: none;
  background: none; border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--ps-fg);
}

/* ── Page content area ── */
.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  background: linear-gradient(180deg, hsl(258,30%,98%) 0%, #fff 100%);
}

/* ── Glass cards ── */
.glass-card {
  background: var(--ps-card);
  border-radius: 12px;
  border: 1px solid var(--ps-border);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.glass-card-hover {
  background: var(--ps-card);
  border-radius: 12px;
  border: 1px solid var(--ps-border);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  transition: box-shadow 0.2s, border-color 0.2s, transform 0.2s;
}
.glass-card-hover:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.10);
  border-color: rgba(107,72,200,0.15);
  transform: translateY(-1px);
}

/* ── Gradient utilities ── */
.gradient-primary { background: linear-gradient(135deg, var(--ps-primary), #7c5ce8); }
.gradient-subtle  { background: linear-gradient(180deg, hsl(258,30%,98%) 0%, #fff 100%); }
.glow-text        { color: var(--ps-primary); }

/* ── Progress bar ── */
.progress-ps { height: 6px; background: var(--ps-muted); border-radius: 50px; overflow: hidden; }
.progress-ps-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--ps-primary), var(--ps-primary-light));
  border-radius: 50px;
  transition: width 0.4s ease;
}

/* ── Badge pill ── */
.badge-primary {
  display: inline-flex; align-items: center;
  padding: 2px 10px; border-radius: 50px; font-size: 11px; font-weight: 600;
  background: linear-gradient(135deg, var(--ps-primary), #7c5ce8);
  color: #fff;
}
.badge-green  { background: rgba(61,143,98,0.12);  color: var(--ps-green);  border: 1px solid rgba(61,143,98,0.25);  padding: 2px 10px; border-radius: 50px; font-size: 11px; font-weight: 600; }
.badge-yellow { background: rgba(234,179,8,0.10);  color: #a16207;          border: 1px solid rgba(234,179,8,0.25);  padding: 2px 10px; border-radius: 50px; font-size: 11px; font-weight: 600; }
.badge-red    { background: rgba(220,38,38,0.10);  color: #b91c1c;          border: 1px solid rgba(220,38,38,0.25);  padding: 2px 10px; border-radius: 50px; font-size: 11px; font-weight: 600; }

/* ── Info boxes ── */
.info-box-blue {
  background: #eff6ff; border: 1px solid #bfdbfe; border-left: 4px solid var(--ps-primary);
  border-radius: 8px; padding: 1rem;
}
.info-box-amber {
  background: #fffbeb; border: 1px solid #fde68a; border-left: 4px solid #f59e0b;
  border-radius: 8px; padding: 0.75rem 1rem;
}
.info-box-green {
  background: #f0fdf4; border: 1px solid #bbf7d0; border-left: 4px solid #22c55e;
  border-radius: 8px; padding: 0.75rem 1rem;
}
.coming-soon-box {
  background: rgba(107,72,200,0.04); border: 1px solid rgba(107,72,200,0.15);
  border-radius: 8px; padding: 1.5rem;
}

/* ── Accordion ── */
/* Module accordion styling */
.module-accordion {
  background: var(--ps-card);
  border: 1px solid var(--ps-border);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.module-accordion:hover {
  border-color: rgba(107, 72, 200, 0.2);
  box-shadow: 0 2px 8px rgba(107, 72, 200, 0.08);
}

/* Accordion button styling */
.accordion-ps-btn {
  width: 100%;
  background: none;
  border: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 1rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
  border-radius: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--ps-fg);
}
.accordion-ps-btn:hover {
  background: rgba(107, 72, 200, 0.04);
}
.accordion-ps-btn:active {
  background: rgba(107, 72, 200, 0.08);
}

/* Legacy accordion-ps styling */
.accordion-ps .accordion-ps-btn {
  padding: 1rem;
}
.accordion-ps .accordion-ps-btn:hover {
  background: rgba(0,0,0,0.03);
}

/* Accordion body styling */
.accordion-ps-body {
  display: none;
  padding: 0 1rem 1rem;
  border-top: 1px solid var(--ps-border);
  background: rgba(107, 72, 200, 0.01);
}
.accordion-ps-body.open {
  display: block;
}

/* Accordion chevron styling */
.accordion-ps-chevron {
  margin-left: auto;
  width: 16px;
  height: 16px;
  color: var(--ps-muted-fg);
  transition: transform 0.2s;
  flex-shrink: 0;
}
.accordion-ps-chevron.open {
  transform: rotate(180deg);
}

/* ── LeetCode pills ── */
.lc-pill {
  display: inline-flex; align-items: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; padding: 2px 8px; border-radius: 4px;
  background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534;
  margin: 2px;
}

/* ── Timeline/stat cards ── */
.stat-card {
  text-align: center;
  padding: 1rem;
}
.stat-card .stat-value { font-size: 1.5rem; font-weight: 700; font-family: 'JetBrains Mono', monospace; color: var(--ps-primary); }
.stat-card .stat-label { font-size: 12px; color: var(--ps-muted-fg); margin-top: 4px; }

/* ── Section titles ── */
.fw-section-title { font-size: 1.5rem; font-weight: 700; color: var(--ps-fg); letter-spacing: -0.02em; }
.fw-section-subtitle { font-size: 14px; color: var(--ps-muted-fg); margin-top: 4px; }

/* ── Table overrides ── */
.table-ps thead th { background: var(--ps-muted); font-size: 12px; font-weight: 700; color: var(--ps-fg); border-color: var(--ps-border); }
.table-ps tbody td { font-size: 14px; color: var(--ps-muted-fg); border-color: var(--ps-border); vertical-align: middle; }
.table-ps tbody td:first-child { color: var(--ps-fg); font-weight: 500; }

/* ── Hero page (Index) ── */
.hero-section {
  position: relative; overflow: hidden;
  border-radius: 2rem;
  border: 1px solid rgba(107,72,200,0.1);
  background: linear-gradient(135deg, rgba(107,72,200,0.05) 0%, transparent 60%);
  padding: 0 2rem 2rem;
  box-shadow: 0 40px 80px -40px rgba(59,130,246,0.2);
}
.hero-section--edge {
  margin-left: -2rem;
  margin-right: -2rem;
  border-radius: 0;
  border-left: none;
  border-right: none;
  padding: 0;
}
.hero-carousel .carousel-item {
  position: relative;
}
.hero-slide-content {
  position: absolute;
  inset: 0;
  z-index: 2;
  padding: clamp(1.2rem, 4vw, 3rem);
  max-width: min(820px, 95%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: linear-gradient(90deg, rgba(17,24,39,0.84) 0%, rgba(17,24,39,0.5) 45%, rgba(17,24,39,0.2) 75%, rgba(17,24,39,0.08) 100%);
  color: #ffffff;
}
.hero-slide-links {
  max-width: 560px;
}
.hero-carousel .carousel-control-prev,
.hero-carousel .carousel-control-next {
  width: 5%;
}
.hero-img { border-radius: 1.75rem; overflow: hidden; box-shadow: 0 10px 25px rgba(0,0,0,0.1); }
.hero-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.home-banner-img {
  height: clamp(170px, 25vw, 340px);
}
.home-banner-img img {
  height: 100%;
  min-height: clamp(170px, 25vw, 340px);
}
.hero-link-card {
  display: flex; align-items: center; gap: 12px;
  border-radius: 12px; border: 1px solid rgba(107,72,200,0.2);
  background: rgba(107,72,200,0.05);
  padding: 1rem; text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.hero-link-card:hover { background: rgba(107,72,200,0.10); border-color: rgba(107,72,200,0.3); text-decoration: none; }
.hero-link-icon {
  width: 40px; height: 40px; border-radius: 8px;
  background: rgba(107,72,200,0.10); color: var(--ps-primary);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.hero-link-card.purple-card { border-color: #e9d5ff; background: #faf5ff; }
.hero-link-card.purple-card:hover { background: #f3e8ff; }
.hero-link-card.purple-card .hero-link-icon { background: #ede9fe; color: #7c3aed; }
.home-intro-section {
  padding: 1.5rem 2rem 2rem;
}

/* ── Overview timeline nodes ── */
.timeline-node {
  display: flex; align-items: center; gap: 1rem;
  padding: 1.25rem; border-radius: 12px;
  border: 1px solid rgba(var(--ps-border),0.5);
  transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
}
.timeline-node:hover { box-shadow: 0 6px 20px rgba(0,0,0,0.08); transform: translateY(-1px); border-color: rgba(107,72,200,0.2); }
.timeline-icon {
  width: 48px; height: 48px; border-radius: 12px; flex-shrink: 0;
  background: linear-gradient(135deg, rgba(107,72,200,0.10), rgba(107,72,200,0.04));
  border: 1px solid rgba(107,72,200,0.2);
  display: flex; align-items: center; justify-content: center;
  color: var(--ps-primary);
}

/* ── Dashboard progress cards ── */
.progress-card { padding: 1.25rem; }
.progress-card .card-icon { color: var(--ps-primary); }
.progress-card .card-value { font-size: 1.75rem; font-weight: 700; font-family: 'JetBrains Mono', monospace; color: var(--ps-primary); }
.progress-card .card-label { font-size: 12px; color: var(--ps-muted-fg); }
.progress-card .card-pct  { font-size: 12px; color: var(--ps-muted-fg); }

/* ── Mobile responsive ── */
@media (max-width: 991.98px) {
  .sidebar {
    width: min(86vw, 320px);
    position: fixed; top: 0; left: 0; height: 100vh;
    transform: translateX(-100%);
    box-shadow: 4px 0 20px rgba(0,0,0,0.12);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-toggle-btn { display: flex; }
  .topbar-actions { display: none; }
  .topbar {
    padding: 0 1rem;
    gap: 0.75rem;
  }
  .topbar-brand {
    font-size: 14px;
  }
  .page-content { padding: 0; }
  .hero-carousel .carousel-control-prev,
  .hero-carousel .carousel-control-next {
    width: 10%;
  }
  .home-intro-section {
    padding: 1.25rem 1rem 1.5rem;
  }
}

@media (max-width: 575.98px) {
  .page-content { padding: 0; }
  .topbar {
    height: 56px;
    padding: 0 0.75rem;
  }
  .topbar-badge {
    display: none;
  }
  .hero-section { padding: 0 1rem 1rem; }
  .hero-section--edge {
    margin-left: -1rem;
    margin-right: -1rem;
    padding: 0;
  }
  .hero-img {
    border-radius: 0;
  }
  .home-banner-img {
    height: clamp(140px, 38vw, 220px);
  }
  .home-banner-img img {
    min-height: clamp(140px, 38vw, 220px);
  }
  .hero-slide-content {
    max-width: 100%;
    background: linear-gradient(180deg, rgba(17,24,39,0.86) 0%, rgba(17,24,39,0.68) 52%, rgba(17,24,39,0.35) 100%);
  }
  .hero-slide-links .col-sm-6 {
    width: 100%;
  }
}

/* ── Overlay for mobile sidebar ── */
#sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 99;
}
#sidebar-overlay.open { display: block; }

/* ── Utility ── */
.text-primary-ps { color: var(--ps-primary) !important; }
.border-l-primary { border-left: 4px solid var(--ps-primary) !important; }
.rounded-2xl { border-radius: 1rem !important; }
.rounded-3xl { border-radius: 1.5rem !important; }
.bg-muted { background: var(--ps-muted) !important; }
.text-muted  { color: var(--ps-muted-fg) !important; }
.shadow-sm-ps { box-shadow: 0 1px 3px rgba(0,0,0,0.06); }

/* Font weight utilities */
.fw-bold { font-weight: 700 !important; }
.fw-semibold { font-weight: 600 !important; }
.font-mono { font-family: 'JetBrains Mono', monospace !important; }

/* Spacing utilities */
.mt-3 { margin-top: 0.75rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 0.75rem !important; }
.mb-4 { margin-bottom: 1rem !important; }
.p-4 { padding: 1rem !important; }

/* Gap utilities */
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 0.75rem !important; }

/* Mobile responsive */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    position: fixed;
    height: 100%;
    z-index: 999;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
  }
  .sidebar-overlay.open {
    display: block;
  }
  .sidebar-toggle-btn {
    display: block !important;
  }
  .page-content {
    padding: 0;
  }
  .module-accordion {
    margin-bottom: 0.75rem;
  }
  .accordion-ps-btn {
    padding: 0.75rem;
    font-size: 13px;
  }
  .accordion-ps-body {
    padding: 0 0.75rem 0.75rem;
  }
  .stat-card {
    padding: 0.75rem;
  }
  .stat-card .stat-value {
    font-size: 1.25rem;
  }
}
