/* ═══════════════════════════════════════════════════════════════════
   StŠ Hub – Layout & UX Enhancement Layer
   Focus: tighter layout, better organisation, cleaner hierarchy
   ═══════════════════════════════════════════════════════════════════ */

/* ── 1. Narrow the world ─────────────────────────────────────────── */
/* 1200px was too wide; 920px is focused and readable on any screen  */
.container,
.nav-inner,
.programs-grid,
.flash-container,
.footer-inner,
.study-container {
  max-width: 920px !important;
}

.hero {
  max-width: 100% !important;          /* hero spans full width… */
}
.hero > * {
  max-width: 920px;
  margin-left: auto;
  margin-right: auto;
}


/* ── 2. Navbar – tighter, cleaner ──────────────────────────────────*/
:root { --nav-h: 52px; }

.nav-logo {
  font-size: 1.05rem !important;
  font-weight: 700 !important;
  letter-spacing: -.02em !important;
}
.nav-logo span { color: var(--accent); }

.nav-links a {
  font-size: .83rem !important;
  padding: .35rem .65rem !important;
}

.nav-search { flex: 0 1 200px !important; }
.nav-search input { font-size: .83rem !important; padding: .35rem .7rem !important; }

.btn-sm { padding: .28rem .65rem !important; font-size: .78rem !important; }


/* ── 3. Compact hero – show content above the fold ─────────────────*/
.hero {
  padding: 2.5rem 1.25rem 2rem !important;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  text-align: left !important;
}
.hero-badge {
  margin-bottom: .75rem !important;
  font-size: .75rem !important;
}
.hero h1 {
  font-size: clamp(1.5rem, 3.5vw, 2rem) !important;
  margin-bottom: .5rem !important;
}
.hero p {
  font-size: .9rem !important;
  margin-bottom: 1.1rem !important;
  max-width: 480px !important;
}
.hero-btns { justify-content: flex-start !important; }


/* ── 4. Stats row – compact, meaningful ─────────────────────────── */
.stats-row {
  display: flex !important;
  flex-wrap: nowrap !important;
  gap: 0 !important;
  background: var(--border) !important;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.stat-card {
  flex: 1;
  padding: .9rem .75rem !important;
  background: var(--bg2) !important;
  text-align: center;
  border: none !important;
}
.stat-num {
  font-size: 1.4rem !important;
  font-weight: 700 !important;
  color: var(--accent2) !important;
  display: block;
}
.stat-lbl {
  font-size: .72rem !important;
  color: var(--text2) !important;
  margin-top: .15rem !important;
}


/* ── 5. Programs grid – 3 columns max, no stretching ────────────── */
.programs-grid {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)) !important;
  gap: .75rem !important;
}

.program-card {
  padding: 1rem !important;
}
.program-card:hover {
  border-color: var(--accent) !important;
  background: var(--bg3) !important;
  transform: none !important;
  box-shadow: none !important;
  color: inherit !important;
}
.program-icon {
  font-size: 1.6rem !important;
  margin-bottom: .5rem !important;
  display: block !important;
  line-height: 1 !important;
}
.program-card h3 { font-size: .95rem !important; margin-bottom: .3rem !important; }
.program-card p  { font-size: .8rem !important; }
.program-types-list { gap: .3rem !important; margin-top: .5rem !important; }
.badge-gray { font-size: .68rem !important; padding: .1rem .4rem !important; }


/* ── 6. Subject cards – show info clearly ──────────────────────── */
.subject-card {
  display: flex !important;
  align-items: center !important;
  gap: .75rem !important;
  padding: .75rem 1rem !important;
  border-radius: var(--radius) !important;
  transition: border-color .15s, background .15s !important;
}
.subject-card:hover {
  border-color: var(--accent) !important;
  background: var(--bg3) !important;
  transform: none !important;
  box-shadow: none !important;
}
.subject-icon { font-size: 1.2rem !important; flex-shrink: 0 !important; }
.subject-card h3 {
  font-size: .9rem !important;
  margin-bottom: .2rem !important;
  white-space: normal !important;
}
.subject-meta {
  display: flex;
  gap: .6rem;
  font-size: .75rem;
  color: var(--text2);
  flex-wrap: wrap;
}
/* Force subject-grid to 2 columns always */
.subjects-grid {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)) !important;
  gap: .5rem !important;
}


/* ── 7. File list rows – compact and readable ──────────────────── */
.file-list { gap: .35rem !important; }
.file-item {
  padding: .6rem .85rem !important;
  gap: .75rem !important;
  align-items: center !important;
  border-radius: var(--radius) !important;
  transition: border-color .12s, background .12s !important;
}
.file-item:hover { border-color: var(--border2) !important; background: var(--bg3) !important; }
.file-name { font-size: .875rem !important; }
.file-meta { font-size: .72rem !important; margin-top: .1rem !important; gap: .5rem !important; }

/* Coloured file-type badges */
.file-ext-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  padding: .15rem .4rem;
  border-radius: 5px;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text2);
  flex-shrink: 0;
}
.file-ext-badge.ext-pdf   { background:rgba(239,68,68,.1);  border-color:rgba(239,68,68,.3);  color:#f87171; }
.file-ext-badge.ext-doc,
.file-ext-badge.ext-docx  { background:rgba(59,130,246,.1); border-color:rgba(59,130,246,.3); color:#93c5fd; }
.file-ext-badge.ext-ppt,
.file-ext-badge.ext-pptx  { background:rgba(249,115,22,.1); border-color:rgba(249,115,22,.3); color:#fb923c; }
.file-ext-badge.ext-xls,
.file-ext-badge.ext-xlsx  { background:rgba(34,197,94,.1);  border-color:rgba(34,197,94,.3);  color:#86efac; }
.file-ext-badge.ext-mp4,
.file-ext-badge.ext-mkv   { background:rgba(168,85,247,.1); border-color:rgba(168,85,247,.3); color:#c4b5fd; }
.file-ext-badge.ext-png,
.file-ext-badge.ext-jpg,
.file-ext-badge.ext-jpeg  { background:rgba(20,184,166,.1); border-color:rgba(20,184,166,.3); color:#5eead4; }
.file-ext-badge.ext-zip,
.file-ext-badge.ext-rar   { background:rgba(245,158,11,.1); border-color:rgba(245,158,11,.3); color:#fcd34d; }


/* ── 8. Page header – compact with clear breadcrumb ────────────── */
.page-header {
  padding: 1rem 1.25rem .9rem !important;
  margin-bottom: 1rem !important;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
}
.page-header h1 { font-size: 1.25rem !important; }
.page-header p  { font-size: .82rem !important; margin-top: .2rem !important; }

.breadcrumb { font-size: .78rem !important; margin-bottom: .4rem !important; }


/* ── 9. Section header – clear label bar ───────────────────────── */
.section-header {
  padding: .6rem 0 .5rem !important;
  margin-bottom: .75rem !important;
  border-bottom: 1px solid var(--border);
}
.section-header h2 { font-size: 1rem !important; font-weight: 600 !important; }


/* ── 10. Tabs – clear, compact ──────────────────────────────────── */
.content-tabs {
  background: var(--bg2);
  border-bottom: 2px solid var(--border) !important;
  margin-bottom: 1rem !important;
  padding: 0 !important;
  gap: 0 !important;
}
.tab-btn, .tab-link {
  padding: .55rem .9rem !important;
  font-size: .83rem !important;
  font-weight: 500 !important;
  color: var(--text2) !important;
  background: none;
  border: none;
  border-bottom: 2px solid transparent !important;
  cursor: pointer;
  transition: color .12s, border-color .12s !important;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  margin-bottom: -2px;
}
.tab-btn:hover,  .tab-link:hover  { color: var(--text) !important; }
.tab-btn.active, .tab-link.active {
  color: var(--text) !important;
  border-bottom-color: var(--accent) !important;
  font-weight: 600 !important;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }


/* ── 11. Sort bar ────────────────────────────────────────────────── */
.sort-bar {
  display: flex !important;
  align-items: center !important;
  gap: .4rem !important;
  flex-wrap: wrap !important;
  margin-bottom: .75rem !important;
  font-size: .8rem !important;
}
.sort-btn {
  font-size: .78rem !important;
  padding: .25rem .6rem !important;
}
.sort-btn:hover,
.sort-btn.active { background: var(--accent) !important; color: #fff !important; border-color: var(--accent) !important; }


/* ── 12. Year tabs ───────────────────────────────────────────────── */
.year-tab {
  padding: .3rem .75rem !important;
  font-size: .82rem !important;
  font-weight: 600 !important;
}
.year-tab:hover,
.year-tab.active { background: var(--accent) !important; border-color: var(--accent) !important; color: #fff !important; }

.year-nav {
  gap: .4rem !important;
  margin-bottom: 1.25rem !important;
}


/* ── 13. Video grid – 3 cols, compact thumbnails ───────────────── */
.video-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)) !important;
  gap: .75rem !important;
}
.video-card-body { padding: .65rem !important; }
.video-card-title { font-size: .85rem !important; }
.video-card-meta  { font-size: .72rem !important; }


/* ── 14. Deck grid – tighter ──────────────────────────────────── */
.deck-grid {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)) !important;
  gap: .65rem !important;
}
.deck-card { padding: .85rem !important; }
.deck-card h4 { font-size: .85rem !important; }


/* ── 15. Cards generic hover – no lift, just border ────────────── */
.card:hover {
  border-color: var(--border2) !important;
  box-shadow: none !important;
  transform: none !important;
}


/* ── 16. Buttons – cleaner sizing ──────────────────────────────── */
.btn {
  padding: .42rem .95rem !important;
  font-size: .85rem !important;
}
.btn-primary {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
}
.btn-primary:hover {
  background: var(--accent2) !important;
  border-color: var(--accent2) !important;
  color: #fff !important;
  box-shadow: none !important;
  transform: none !important;
}
.btn-lg { padding: .55rem 1.25rem !important; font-size: .9rem !important; }


/* ── 17. Auth page – centered, compact ─────────────────────────── */
.auth-container { min-height: 65vh !important; padding: 2rem 1rem !important; }
.auth-box { padding: 1.75rem 1.5rem !important; max-width: 400px !important; }
.auth-logo { font-size: 1.6rem !important; font-weight: 800 !important; letter-spacing: -.04em !important; }


/* ── 18. Profile layout – sidebar narrower ─────────────────────── */
.profile-layout { grid-template-columns: 230px 1fr !important; }
.profile-sidebar { padding: 1.25rem !important; }


/* ── 19. Settings layout – sidebar narrower ──────────────────────*/
.settings-layout { grid-template-columns: 175px 1fr !important; }
.settings-nav-link { font-size: .875rem !important; padding: .7rem 1rem !important; }
.settings-nav-link:hover,
.settings-nav-link.active { background: var(--accent) !important; color: #fff !important; }
.settings-section { padding: 1.25rem !important; margin-bottom: 1rem !important; }
.settings-section h2 { font-size: 1rem !important; margin-bottom: .9rem !important; }


/* ── 20. Admin ──────────────────────────────────────────────────── */
.admin-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)) !important; gap: .65rem !important; }
.stat-tile { padding: 1rem !important; }
.stat-tile .num { font-size: 1.75rem !important; }
.admin-nav a { font-size: .83rem !important; padding: .35rem .7rem !important; }
.admin-nav a:hover,
.admin-nav a.active { background: var(--accent) !important; color: #fff !important; }
.data-table th { font-size: .78rem !important; }
.data-table td { font-size: .83rem !important; }


/* ── 21. Footer – minimal ───────────────────────────────────────── */
.footer { padding: .85rem 1.25rem !important; }
.footer-inner { font-size: .78rem !important; }


/* ── 22. Main content top padding ──────────────────────────────── */
.main-content { padding: 0 !important; }


/* ── 23. Empty state – smaller ──────────────────────────────────── */
.empty-state { padding: 2rem 1.25rem !important; }
.empty-state .empty-icon { font-size: 1.75rem !important; }
.empty-state p { font-size: .85rem !important; }


/* ── 24. Mobile Drawer – tighter ───────────────────────────────── */
.mobile-drawer-inner { padding: .75rem .9rem 1.5rem !important; gap: .6rem !important; }
.mobile-nav-item { font-size: .9rem !important; padding: .7rem .9rem !important; }


/* ── 25. Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar          { width: 5px; height: 5px; }
::-webkit-scrollbar-track    { background: var(--bg); }
::-webkit-scrollbar-thumb    { background: var(--bg4); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }


/* ── 26. Search page ───────────────────────────────────────────── */
.search-form-big { display:flex; gap:.6rem; margin-bottom:1.25rem; }
.search-input-big {
  flex: 1;
  padding: .65rem .9rem !important;
  font-size: .95rem !important;
  border-radius: var(--radius) !important;
}
.search-input-big:focus { border-color: var(--accent) !important; box-shadow: none !important; }


/* ── 27. SOV list – compact ──────────────────────────────────────  */
.sov-list { gap: .5rem !important; }
.sov-item { padding: .75rem !important; }


/* ── 28. Like buttons ───────────────────────────────────────────── */
.like-btn { font-size: .8rem !important; padding: .25rem .6rem !important; }


/* ── 29. Upload tabs ───────────────────────────────────────────── */
.upload-tab.active { background: var(--accent) !important; border-color: var(--accent) !important; }


/* ── 30. Responsive ──────────────────────────────────────────────  */
@media(max-width: 600px) {
  .stats-row { flex-wrap: wrap !important; }
  .stat-card { flex: 1 1 calc(50% - 1px) !important; }
  .programs-grid {
    grid-template-columns: 1fr !important;
  }
  .subjects-grid {
    grid-template-columns: 1fr !important;
  }
  .profile-layout { grid-template-columns: 1fr !important; }
  .settings-layout { grid-template-columns: 1fr !important; }
}


/* ── 31. Folder tags & folder bar ─────────────────────────────── */
.folder-tag {
  display: inline-flex; align-items: center; gap: .25rem;
  background: var(--surface-3, #2a2a3c);
  border: 1px solid var(--border, #333);
  border-radius: 12px; padding: .15rem .6rem;
  font-size: .78rem; color: var(--text-muted, #aaa);
}

/* ── 32. Link tab items ───────────────────────────────────────── */
.link-item:hover { border-color: var(--accent) !important; }
.link-title:hover { text-decoration: underline; }


/* ── 33. NOVO! Marquee – responsive ──────────────────────────────── */
@media(max-width: 480px) {
  .novo-badge { font-size: .72rem !important; }
  .novo-item  { padding: 0 .8rem !important; }
}

/* ── 35. Upload CTA bar (bottom of each tab) ─────────────────────── */
.upload-cta {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
}
.upload-cta .btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}

/* ── 36. Nav admin button – neutral ghost (no accent border) ──────── */
.nav-admin-btn {
  color: var(--text2) !important;
  border-color: transparent !important;
  background: transparent !important;
}
.nav-admin-btn:hover {
  color: var(--text) !important;
  background: var(--bg3) !important;
  border-color: transparent !important;
}

/* ── 37. Program icon SVG sizing in program cards ─────────────────── */
.program-icon .icon,
.program-icon svg {
  width: 1.6rem !important;
  height: 1.6rem !important;
  color: var(--accent2);
}
.program-card:hover .program-icon svg { color: var(--accent); }

/* ── 38. Nav icons consistent colour (never accent) ──────────────── */
.nav-links a .icon { color: inherit; }
.nav-auth .btn-ghost .icon { color: inherit; }

/* ── 39. Fix nav-auth link/button colours ────────────────────────────
   Global `a { color: var(--accent2) }` in style.css colours every <a>
   with the accent colour (purple in the user's theme). The .btn-ghost
   class has higher CSS specificity but browser cascade edge cases can
   let the global rule win. Force the correct colours with !important.   */
.btn-ghost {
  color: var(--text2) !important;
  background: transparent !important;
  border-color: transparent !important;
  text-decoration: none !important;
}
.btn-ghost:hover {
  color: var(--text) !important;
  background: var(--bg3) !important;
  text-decoration: none !important;
}
/* Extra: target nav-auth links directly regardless of btn class */
.nav-auth > a,
.nav-auth > button {
  color: var(--text2) !important;
  text-decoration: none !important;
}
.nav-auth > a:hover,
.nav-auth > button:hover {
  color: var(--text) !important;
  text-decoration: none !important;
}
/* Admin button: slightly elevated opacity to stand out */
.nav-admin-btn {
  color: var(--text2) !important;
  border-color: transparent !important;
  background: transparent !important;
  text-decoration: none !important;
}

/* ── 34. Mobile padding safety ───────────────────────────────────── */
@media(max-width: 480px) {
  /* Prevent site-header quick stats from overflowing */
  .site-quick-stats {
    min-width: 0 !important;
    width: 100% !important;
  }
  /* Auth box full-width on tiny screens */
  .auth-box {
    max-width: 100% !important;
    margin: 0 !important;
  }
  /* Upload tabs don't overflow */
  .upload-tabs {
    overflow-x: auto !important;
    flex-wrap: nowrap !important;
  }
}

/* ══════════════════════════════════════════════════════════
   35. UX-v27: user-friendly additions
   ══════════════════════════════════════════════════════════ */

/* ── Password toggle button ─────────────────────────────── */
.pw-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.pw-wrapper .form-control {
  padding-right: 2.8rem;
}
.pw-toggle {
  position: absolute;
  right: .6rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text2);
  padding: .3rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  transition: color .15s;
  font-size: .8rem;
  white-space: nowrap;
  gap: .2rem;
}
.pw-toggle:hover { color: var(--text); }

/* ── Password strength bar ──────────────────────────────── */
.pw-strength-bar {
  height: 4px;
  border-radius: 2px;
  background: var(--bg4);
  margin-top: .4rem;
  overflow: hidden;
}
.pw-strength-fill {
  height: 100%;
  border-radius: 2px;
  transition: width .3s, background .3s;
}
.pw-strength-label {
  font-size: .75rem;
  margin-top: .2rem;
  color: var(--text3);
}
.pw-match-hint {
  font-size: .75rem;
  margin-top: .3rem;
  min-height: 1em;
}
.pw-match-ok  { color: var(--success); }
.pw-match-bad { color: var(--danger);  }

/* ── Form hints ─────────────────────────────────────────── */
.form-hint-visible {
  font-size: .8rem;
  color: var(--text2);
  margin-top: .3rem;
  display: flex;
  align-items: center;
  gap: .3rem;
}

/* ── Navbar icon button tooltips (title attr) ───────────── */
.nav-auth .btn[title] { position: relative; }

/* ── Improved flash messages ────────────────────────────── */
.flash {
  gap: .75rem;
  padding: .8rem 1rem;
  font-size: .9rem;
  border-radius: var(--radius);
  align-items: flex-start;
}
.flash-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .2rem;
}
.flash-title {
  font-weight: 600;
  font-size: .9rem;
}
.flash-close {
  min-width: 28px;
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  flex-shrink: 0;
}
.flash-close:hover { background: rgba(128,128,128,.15); }

/* Auto-dismiss timer line on success flash */
.flash-success .flash-timer {
  height: 3px;
  background: var(--success);
  opacity: .45;
  border-radius: 2px;
  margin-top: .5rem;
  animation: flashTimerShrink 6s linear forwards;
}
@keyframes flashTimerShrink {
  from { width: 100%; }
  to   { width: 0%; }
}

/* ── Empty state improvements ───────────────────────────── */
.empty-state {
  padding: 3rem 1.5rem;
  text-align: center;
}
.empty-state h3 {
  margin-bottom: .5rem;
  font-size: 1.15rem;
}
.empty-state p {
  color: var(--text2);
  margin-bottom: 1.25rem;
  max-width: 340px;
  margin-left: auto;
  margin-right: auto;
}

/* ── Better delete confirm modals ───────────────────────── */
.confirm-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0,0,0,.55);
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.confirm-modal-overlay.open { display: flex; }
.confirm-modal-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.5rem 1.5rem;
  max-width: 380px;
  width: 100%;
  text-align: center;
}
.confirm-modal-icon {
  font-size: 2.5rem;
  line-height: 1;
  margin-bottom: .75rem;
}
.confirm-modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: .5rem;
}
.confirm-modal-msg {
  font-size: .875rem;
  color: var(--text2);
  margin-bottom: 1.5rem;
}
.confirm-modal-btns {
  display: flex;
  gap: .75rem;
  justify-content: center;
}
.confirm-modal-btns .btn {
  flex: 1;
  max-width: 160px;
  justify-content: center;
}

/* ── Onboarding help strip ─────────────────────────────── */
.help-strip {
  background: color-mix(in srgb, var(--accent) 8%, var(--bg2));
  border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--border));
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  display: flex;
  gap: .75rem;
  align-items: flex-start;
}
.help-strip-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
  margin-top: .1rem;
}
.help-strip-body h4 {
  margin-bottom: .25rem;
  color: var(--text);
}
.help-strip-body p {
  font-size: .875rem;
  color: var(--text2);
  margin: 0;
}
.help-strip-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text3);
  font-size: 1.1rem;
  padding: .2rem;
  margin-left: auto;
  flex-shrink: 0;
  line-height: 1;
}
.help-strip-close:hover { color: var(--text); }

/* ── Nav label improvements: show text labels on desktop ── */
.nav-auth .btn-ghost {
  gap: .3rem;
}
@media(min-width:769px) {
  .nav-label { display: inline; }
}
@media(max-width:768px) {
  .nav-label { display: none; }
}

/* ── Screen-reader only text ────────────────────────────── */
.sr-only {
  position:absolute;width:1px;height:1px;
  padding:0;margin:-1px;overflow:hidden;
  clip:rect(0,0,0,0);white-space:nowrap;border:0;
}

/* ── Bigger touch targets on mobile ─────────────────────── */
@media(max-width:768px) {
  .btn { min-height: 44px; }
  .btn-sm { min-height: 38px; }
  .form-control { min-height: 46px; font-size: 16px; } /* prevent iOS zoom */
  .mobile-nav-item { min-height: 48px; display: flex; align-items: center; }
}
