/* Learning Hub -- app shell: fixed sidebar, topbar, dashboard grid. */

/* ---------- layout ---------- */
.shell{
  display:grid;
  grid-template-columns:var(--sidebar-w) minmax(0,1fr);
  min-height:100dvh;
  gap:var(--gutter);
  padding:var(--gutter);
}

/* ---------- sidebar ---------- */
.sidebar{
  position:sticky;top:var(--gutter);
  align-self:start;
  height:calc(100dvh - var(--gutter) * 2);
  display:flex;flex-direction:column;gap:22px;
  padding:22px 18px;
  background:var(--surface);
  border-radius:var(--radius-xl);
  box-shadow:var(--shadow-card);
  overflow-y:auto;
}
.brand{display:flex;align-items:center;gap:10px;text-decoration:none;color:inherit}
.brand-mark{
  display:inline-flex;align-items:center;justify-content:center;
  width:38px;height:38px;border-radius:12px;
  background:var(--brand);color:var(--brand-soft);
  font-size:19px;line-height:1;font-weight:800;
}
.brand-text{display:flex;flex-direction:column;line-height:1.2}
.brand-name{font-size:.92rem;font-weight:800;letter-spacing:.06em;text-transform:uppercase;color:var(--ink)}
.brand-sub{font-size:.66rem;color:var(--muted);letter-spacing:.14em;text-transform:uppercase}

.nav{display:flex;flex-direction:column;gap:4px}
.nav-item{
  display:flex;align-items:center;gap:11px;
  padding:11px 13px;border-radius:var(--radius-md);
  background:transparent;color:var(--ink-soft);
  font-size:.9rem;font-weight:600;text-align:left;
  text-decoration:none;
  transition:background .18s ease,color .18s ease;
}
.nav-item:hover{background:var(--surface-alt);color:var(--ink);text-decoration:none}
.nav-item.is-active{background:var(--ink);color:#fff}
.nav-item.is-active .nav-icon{color:var(--brand-soft)}
.nav-icon{width:19px;height:19px;flex:none;color:var(--muted)}
.nav-badge{
  margin-left:auto;min-width:20px;padding:2px 7px;border-radius:99px;
  background:var(--rose);color:#fff;
  font-size:.68rem;font-weight:700;text-align:center;
}
.nav-item.is-active .nav-badge{background:var(--brand-soft);color:var(--brand-deep)}

/* ---------- topbar ---------- */
.main{display:flex;flex-direction:column;gap:20px;min-width:0}
.topbar{
  display:flex;align-items:flex-start;justify-content:space-between;
  gap:20px;flex-wrap:wrap;
}
.head{display:flex;flex-direction:column;gap:8px;min-width:0}
.head h1{margin:0;font-size:clamp(1.5rem,3vw,2rem);font-weight:800;letter-spacing:-.025em}

/* The back control carries its meaning in its shape alone, so it sits
   on its own line above the title rather than beside any text. */
.head-top{
  display:flex;align-items:center;gap:10px;
  min-height:34px;
}
.back-icon{
  display:inline-flex;align-items:center;justify-content:center;
  width:34px;height:34px;flex:none;
  border-radius:50%;
  background:var(--surface);
  box-shadow:var(--shadow-card);
  color:var(--ink-soft);
  text-decoration:none;
  transition:color .18s ease,transform .18s ease;
}
.back-icon:hover{color:var(--brand);text-decoration:none;transform:translateX(-2px)}
.back-icon-svg{width:17px;height:17px;flex:none}

/* ---------- breadcrumb ---------- */
.crumbs{display:flex;align-items:center;gap:8px;flex-wrap:wrap;font-size:.78rem}
.crumb-link{color:var(--muted);font-weight:600;text-decoration:none}
.crumb-link:hover{color:var(--brand-deep);text-decoration:none}
.crumb-current{color:var(--ink-soft);font-weight:700}
/* The separator has to read at its real size, not only when magnified.
   A tone between the link and the background keeps the path legible
   without competing with the words. */
.crumb-sep{color:#9DB3C0;font-weight:700}

/* ---------- dashboard grid ---------- */
.panel{
  background:var(--surface);
  border-radius:var(--radius-lg);
  box-shadow:var(--shadow-card);
  padding:22px;
}
.panel-head{
  display:flex;align-items:center;justify-content:space-between;
  gap:14px;flex-wrap:wrap;margin-bottom:18px;
}
.panel-head h2{margin:0;font-size:1.12rem;font-weight:750;letter-spacing:-.015em}

.stats{
  display:grid;gap:16px;
  grid-template-columns:repeat(auto-fit,minmax(190px,1fr));
}
.stat-tile{
  padding:19px 20px;border-radius:var(--radius-lg);
  display:flex;flex-direction:column;gap:10px;
}
.stat-tile .tile-top{display:flex;align-items:center;gap:9px}
.stat-tile .tile-icon{
  display:inline-flex;align-items:center;justify-content:center;
  width:30px;height:30px;border-radius:9px;
  background:rgba(255,255,255,.66);color:var(--brand-deep);
}
.stat-tile .tile-icon svg{width:17px;height:17px}
.stat-tile .tile-label{font-size:.82rem;font-weight:700;color:var(--ink-soft)}
.stat-tile .tile-value{font-size:2.05rem;font-weight:800;line-height:1;letter-spacing:-.04em}
.tile-lilac{background:var(--pastel-lilac)}
.tile-sky{background:var(--pastel-sky)}
.tile-blush{background:var(--pastel-blush)}
.tile-cream{background:var(--pastel-cream)}
.tile-mint{background:var(--pastel-mint)}

/* The two columns hold different amounts of content. Letting each
   panel size to its own content avoids a tall panel with a large
   empty area under a short list. */
.split{
  display:grid;gap:16px;
  grid-template-columns:minmax(0,1.55fr) minmax(0,1fr);
  align-items:start;
}

/* ---------- course rows ---------- */
.course-list{display:flex;flex-direction:column;gap:11px}
.course-row{
  display:flex;align-items:center;gap:15px;
  padding:15px 17px;border-radius:var(--radius-md);
  background:var(--surface-alt);
  border:1px solid transparent;
  transition:border-color .18s ease,transform .18s ease;
}
.course-row:hover{border-color:var(--line-strong);transform:translateY(-1px)}
.course-thumb{
  display:inline-flex;align-items:center;justify-content:center;
  width:46px;height:46px;flex:none;border-radius:12px;
  background:var(--pastel-lilac);color:var(--brand-deep);
}
.course-thumb svg{width:22px;height:22px}
.course-body{flex:1;min-width:0}
.course-title{margin:0;font-size:1rem;font-weight:700;letter-spacing:-.015em}
.course-sub{margin:3px 0 0;color:var(--muted);font-size:.79rem}
.course-side{display:flex;align-items:center;gap:14px;flex:none}
.meter{width:132px}
.meter-label{display:flex;justify-content:space-between;gap:10px;font-size:.72rem;color:var(--muted);margin-bottom:5px}
.meter-track{height:7px;border-radius:99px;background:var(--surface-sunk);overflow:hidden}
.meter-fill{display:block;height:100%;border-radius:inherit;background:var(--brand)}
.meter-fill.is-amber{background:var(--amber)}
.meter-fill.is-green{background:var(--green)}

/* ---------- subject + section cards ---------- */
.card-grid{display:grid;gap:16px;grid-template-columns:repeat(auto-fill,minmax(268px,1fr))}
.tile-card{
  position:relative;
  display:flex;flex-direction:column;gap:12px;
  padding:20px;border-radius:var(--radius-lg);
  background:var(--surface);box-shadow:var(--shadow-card);
  border:1px solid transparent;
  transition:transform .18s ease,border-color .18s ease;
}
.tile-card:hover{transform:translateY(-2px);border-color:var(--line-strong)}
.tile-card .tile-top{display:flex;align-items:center;gap:11px}
.tile-card .tile-icon{
  display:inline-flex;align-items:center;justify-content:center;
  width:42px;height:42px;border-radius:12px;
  background:var(--pastel-sky);color:var(--brand-deep);
}
.tile-card .tile-icon svg{width:21px;height:21px}
.tile-card h3{margin:0;font-size:1.05rem;font-weight:750;letter-spacing:-.015em;flex:1}
.tile-card p{margin:0;color:var(--muted);font-size:.83rem;flex:1}
.tile-card .card-meta{display:flex;gap:8px;flex-wrap:wrap;font-size:.73rem;color:var(--muted)}
/* Separators keep adjacent stat spans from running together as
   "39 cards2 chapters". */
.card-meta span+span::before{
  content:"·";margin-right:8px;color:var(--line-strong);
}

/* The whole card is the target; the arrow marks the action and slides
   on hover so the response to a click is visible before it lands. */
.tile-arrow{margin-left:auto}
.tile-card:hover .tile-arrow .cta-icon{transform:translateX(3px)}

/* ---------- icon-only action ---------- */
.icon-cta{
  display:inline-flex;align-items:center;justify-content:center;
  width:38px;height:38px;flex:none;
  border-radius:50%;
  background:var(--brand);color:#fff;
  text-decoration:none;
  transition:background .18s ease,transform .18s ease;
}
.icon-cta:hover{background:var(--brand-deep);text-decoration:none}
.icon-cta .cta-icon{
  width:16px;height:16px;flex:none;
  transition:transform .18s ease;
}
.icon-cta:hover .cta-icon{transform:translateX(2px)}

.section-list{display:flex;flex-direction:column;gap:11px}
.section-row{
  display:flex;align-items:center;gap:15px;flex-wrap:wrap;
  padding:16px 18px;border-radius:var(--radius-md);
  background:var(--surface-alt);
  border:1px solid transparent;
  transition:border-color .18s ease;
}
.section-row:hover{border-color:var(--line-strong)}
.section-row .grow{flex:1;min-width:190px}
.section-row h3{margin:0;font-size:1rem;font-weight:700}
.section-row p{margin:4px 0 0;color:var(--muted);font-size:.8rem}

/* ---------- charts ---------- */
.side-stack{display:flex;flex-direction:column;gap:16px;min-width:0}
.chart{display:flex;flex-direction:column;gap:12px}
.chart-row{display:flex;align-items:center;gap:12px}
.chart-name{width:112px;flex:none;font-size:.82rem;color:var(--ink-soft);font-weight:600}
.chart-track{flex:1;height:26px;border-radius:8px;background:var(--surface-alt);overflow:hidden}
.chart-fill{display:block;height:100%;border-radius:8px;background:var(--pastel-lilac)}
.chart-value{width:34px;flex:none;text-align:right;font-size:.84rem;font-weight:700;color:var(--ink)}
.gauge{position:relative;display:flex;justify-content:center;padding:4px 0 8px}
.gauge svg{display:block}
.gauge-read{
  position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);
  display:flex;flex-direction:column;align-items:center;text-align:center;
}
.gauge-read strong{font-size:1.7rem;font-weight:800;letter-spacing:-.04em;line-height:1}
.gauge-read span{margin-top:4px;font-size:.7rem;letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}
.cta-icon{width:15px;height:15px;flex:none}

/* ---------- empty ---------- */
.empty{
  padding:38px 24px;text-align:center;
  border:1px dashed var(--line-strong);border-radius:var(--radius-lg);
  background:var(--surface-alt);color:var(--muted);font-size:.9rem;
}
.empty strong{display:block;color:var(--ink);font-size:1rem;margin-bottom:6px}

/* ---------- mobile nav toggle ---------- */
.nav-toggle{display:none}
.scrim{
  position:fixed;inset:0;z-index:30;
  background:rgba(18,36,46,.44);
}
.scrim[hidden]{display:none}

/* ---------- responsive ---------- */
@media (max-width:1080px){
  .split{grid-template-columns:minmax(0,1fr)}
}
@media (max-width:860px){
  .shell{grid-template-columns:minmax(0,1fr)}
  .sidebar{
    position:fixed;z-index:40;top:0;left:0;
    width:min(288px,84vw);height:100dvh;
    border-radius:0 var(--radius-xl) var(--radius-xl) 0;
    transform:translateX(-102%);
    transition:transform .24s ease;
  }
  .sidebar.is-open{transform:none}
  .nav-toggle{
    display:inline-flex;align-items:center;justify-content:center;
    width:42px;height:42px;flex:none;
    border:0;border-radius:var(--radius-md);
    background:var(--surface);box-shadow:var(--shadow-card);color:var(--ink);
  }
  .nav-toggle svg{width:20px;height:20px}
  .topbar{align-items:center}
  .head{order:2;width:100%}
}
@media (max-width:560px){
  .shell{padding:14px;gap:14px}
  .panel{padding:17px}
  .stats{grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:12px}
  .stat-tile{padding:15px 16px}
  .stat-tile .tile-value{font-size:1.7rem}
  .course-row{flex-wrap:wrap}
  .course-side{width:100%;justify-content:space-between}
  .meter{width:auto;flex:1}
}
