/*
  ╔══════════════════════════════════════════════════════════════╗
  ║   LSF PRO — Professional Native App Enhancement Layer       ║
  ║   Drop in AFTER style.css. Zero overwrites.                 ║
  ╚══════════════════════════════════════════════════════════════╝
*/

/* ═══════════════════════════════════════════
   1. GLOBAL MOBILE-FIRST TOUCH IMPROVEMENTS
═══════════════════════════════════════════ */

/* ── Shared keyframes relied on throughout the file ── */
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes modalPop {
  from { opacity: 0; transform: scale(0.88); }
  to   { opacity: 1; transform: scale(1); }
}
* {
  -webkit-tap-highlight-color: transparent;
}

/* Smooth momentum scrolling on iOS */
.chat-messages,
#modal-content,
.dropdown-menu,
.submissions-list,
.bento-grid,
body {
  -webkit-overflow-scrolling: touch;
}

/* Safe-area padding for notched phones */
body {
  padding-bottom: env(safe-area-inset-bottom);
}

@media (max-width: 768px) {
  body.has-bottom-nav {
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
  }
}

/* ── Touch ripple on interactive elements ── */
.btn,
.res-item,
.glass-card,
.sug-card,
.nav-links a,
.faculty-btn,
.cat-tab {
  position: relative;
  overflow: hidden;
}
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.28);
  transform: scale(0);
  animation: rippleAnim 0.5s linear;
  pointer-events: none;
}
@keyframes rippleAnim {
  to { transform: scale(4); opacity: 0; }
}

/* ── Tactile press feedback (mobile) ── */
@media (hover: none) {
  .btn:active         { transform: scale(0.96) !important; }
  .res-item:active    { transform: scale(0.97) !important; }
  .glass-card:active  { transform: translateY(-3px) scale(0.99) !important; }
  .sug-card:active    { transform: translateY(-1px) scale(0.98) !important; }
}

/* ═══════════════════════════════════════════
   2. NEWS TICKER — FULLY REMOVED
   The ticker component has been deleted from
   all page templates. These stubs ensure any
   lingering .news-ticker containers in cached
   HTML collapse silently.
═══════════════════════════════════════════ */
.news-ticker,
#news-ticker,
[data-ticker],
.news-ticker-wrap,
.ticker-container,
.pro-ticker {
  display: none !important;
  height: 0 !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
  pointer-events: none !important;
}

/* ═══════════════════════════════════════════
   3. NATIVE CONFIRM MODAL
═══════════════════════════════════════════ */
.lsf-confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 18, 37, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 99999;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  animation: overlayFadeIn 0.22s ease;
}
@keyframes overlayFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.lsf-confirm-overlay.closing {
  animation: overlayFadeOut 0.22s ease forwards;
}
@keyframes overlayFadeOut {
  to { opacity: 0; }
}

.lsf-confirm-sheet {
  background: var(--card);
  border-radius: 28px 28px 0 0;
  width: 100%;
  max-width: 520px;
  padding: 8px 0 calc(24px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 48px rgba(26,18,37,0.18);
  animation: sheetSlideUp 0.32s cubic-bezier(0.32, 0.72, 0, 1);
  position: relative;
  overflow: hidden;
}
.lsf-confirm-sheet::before {
  content: '';
  display: block;
  width: 36px; height: 5px;
  background: var(--border);
  border-radius: 99px;
  margin: 12px auto 20px;
}
@keyframes sheetSlideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.lsf-confirm-sheet.closing {
  animation: sheetSlideDown 0.26s cubic-bezier(0.32, 0.72, 0, 1) forwards;
}
@keyframes sheetSlideDown {
  to { transform: translateY(100%); }
}

/* Desktop: center popup instead of bottom sheet */
@media (min-width: 560px) {
  .lsf-confirm-overlay {
    align-items: center;
    padding: 24px;
  }
  .lsf-confirm-sheet {
    border-radius: var(--r-xl);
    max-width: 420px;
    animation: modalPop 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
    padding: 0 0 8px;
  }
  .lsf-confirm-sheet::before { display: none; }
}

.lsf-confirm-icon-wrap {
  text-align: center;
  padding: 8px 0 16px;
}
.lsf-confirm-icon {
  width: 64px; height: 64px;
  border-radius: 50%;
  margin: 0 auto;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.7rem;
}
.lsf-confirm-icon.danger  { background: rgba(239,68,68,0.1);  }
.lsf-confirm-icon.warning { background: var(--sun-light);    }
.lsf-confirm-icon.info    { background: var(--indigo-light); }
.lsf-confirm-icon.success { background: var(--emerald-light);}

.lsf-confirm-body {
  padding: 0 24px 20px;
  text-align: center;
}
.lsf-confirm-title {
  font-family: 'Syne', sans-serif;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 8px;
}
.lsf-confirm-message {
  font-size: 0.88rem;
  color: var(--text-dim);
  line-height: 1.6;
}

.lsf-confirm-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 16px;
}
.lsf-confirm-btn {
  width: 100%;
  padding: 15px;
  border-radius: var(--r-lg);
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  letter-spacing: 0.2px;
}
.lsf-confirm-btn:active { transform: scale(0.97); }

.lsf-confirm-btn.confirm-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  box-shadow: 0 4px 16px rgba(239,68,68,0.3);
}
.lsf-confirm-btn.confirm-danger:hover {
  box-shadow: 0 6px 22px rgba(239,68,68,0.45);
  filter: brightness(1.06);
}
.lsf-confirm-btn.confirm-primary {
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 4px 16px var(--coral-glow);
}
.lsf-confirm-btn.confirm-primary:hover {
  box-shadow: 0 6px 22px var(--coral-glow);
  filter: brightness(1.06);
}
.lsf-confirm-btn.confirm-cancel {
  background: var(--bg-alt);
  color: var(--text-dim);
  border: 1.5px solid var(--border);
}
.lsf-confirm-btn.confirm-cancel:hover {
  border-color: var(--coral);
  color: var(--coral);
  background: var(--coral-light);
}

/* ═══════════════════════════════════════════
   4. ENHANCED TOAST NOTIFICATIONS
═══════════════════════════════════════════ */
#lsf-toast-stack {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 99998;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: 360px;
  width: calc(100vw - 32px);
}

.lsf-toast {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  box-shadow: var(--shadow-md);
  pointer-events: auto;
  animation: toastIn 0.38s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(80px) scale(0.9); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}
.lsf-toast.toast-out {
  animation: toastOut 0.26s ease forwards;
}
@keyframes toastOut {
  to { opacity: 0; transform: translateX(80px) scale(0.92); max-height: 0; margin: 0; padding: 0; }
}

.lsf-toast.type-success { border-color: var(--emerald); }
.lsf-toast.type-error   { border-color: #ef4444; }
.lsf-toast.type-warning { border-color: var(--sun); }
.lsf-toast.type-info    { border-color: var(--indigo); }
.lsf-toast.type-realtime { border-color: var(--coral); }

.toast-icon-wrap {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.type-success .toast-icon-wrap { background: var(--emerald-light); }
.type-error   .toast-icon-wrap { background: rgba(239,68,68,0.1); }
.type-warning .toast-icon-wrap { background: var(--sun-light); }
.type-info    .toast-icon-wrap { background: var(--indigo-light); }
.type-realtime .toast-icon-wrap { background: var(--coral-light); }

.toast-body { flex: 1; min-width: 0; }
.toast-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 2px;
  line-height: 1.3;
}
.toast-msg {
  font-size: 0.78rem;
  color: var(--text-dim);
  line-height: 1.4;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 2px;
  border-radius: 50%;
  transition: all 0.15s;
  flex-shrink: 0;
  margin-top: -2px;
}
.toast-close:hover {
  background: var(--coral-light);
  color: var(--coral);
}

/* Progress bar at bottom of toast */
.toast-progress {
  position: absolute;
  bottom: 0; left: 0;
  height: 3px;
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  transition: width linear;
}
.type-success .toast-progress { background: var(--emerald); }
.type-error   .toast-progress { background: #ef4444; }
.type-warning .toast-progress { background: var(--sun); }
.type-info    .toast-progress { background: var(--indigo); }
.type-realtime .toast-progress { background: var(--coral); }

/* Live update badge inside notifications */
.toast-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--coral-light);
  color: var(--coral);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 99px;
  margin-top: 5px;
}
.toast-live-badge::before {
  content: '';
  width: 5px; height: 5px;
  background: var(--coral);
  border-radius: 50%;
  animation: liveFlash 1.2s infinite;
}

/* ═══════════════════════════════════════════
   5. MOBILE BOTTOM NAV BAR
═══════════════════════════════════════════ */
.lsf-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: calc(60px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  z-index: 9000;
  box-shadow: 0 -8px 32px rgba(26,18,37,0.08);
}

@media (max-width: 768px) {
  .lsf-bottom-nav { display: flex; align-items: center; }
}

.bottom-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-around;
  width: 100%;
  height: 60px;
}

.bnav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex: 1;
  height: 100%;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  transition: color 0.18s;
  position: relative;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font-family: 'Inter', sans-serif;
  -webkit-tap-highlight-color: transparent;
}
.bnav-item i {
  font-size: 1.3rem;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
              color 0.18s;
}
.bnav-item:active i { transform: scale(0.85); }

.bnav-item.active {
  color: var(--coral);
}
.bnav-item.active i {
  transform: scale(1.1);
  filter: drop-shadow(0 2px 8px var(--coral-glow));
}

/* Active indicator dot */
.bnav-item.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  width: 4px; height: 4px;
  background: var(--coral);
  border-radius: 50%;
  animation: navDotPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes navDotPop {
  from { transform: scale(0); }
  to   { transform: scale(1); }
}

/* Notification badge on bottom nav */
.bnav-badge {
  position: absolute;
  top: 6px;
  right: calc(50% - 18px);
  background: var(--coral);
  color: #fff;
  font-size: 0.58rem;
  font-weight: 800;
  min-width: 16px;
  height: 16px;
  border-radius: 99px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid #fff;
  line-height: 1;
  animation: badgePop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes badgePop {
  from { transform: scale(0) rotate(-10deg); }
  to   { transform: scale(1) rotate(0deg); }
}

/* Courses sheet (replaces dropdown on mobile) */
.courses-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26,18,37,0.5);
  backdrop-filter: blur(8px);
  z-index: 9001;
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.courses-sheet-overlay.open {
  display: flex;
  animation: overlayFadeIn 0.2s ease;
}
.courses-sheet {
  background: var(--card);
  border-radius: 28px 28px 0 0;
  width: 100%;
  max-width: 520px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 0 0 calc(24px + env(safe-area-inset-bottom));
  animation: sheetSlideUp 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}
.courses-sheet-handle {
  text-align: center;
  padding: 14px 0 10px;
}
.courses-sheet-handle::after {
  content: '';
  display: inline-block;
  width: 36px; height: 5px;
  background: var(--border);
  border-radius: 99px;
}
.courses-sheet-title {
  font-family: 'Syne', sans-serif;
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-main);
  padding: 0 20px 16px;
}
.courses-sheet-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  text-decoration: none;
  transition: background 0.15s;
}
.courses-sheet-item:active { background: var(--coral-light); }
.courses-sheet-icon {
  width: 42px; height: 42px;
  border-radius: var(--r-md);
  background: var(--coral-light);
  color: var(--coral);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.courses-sheet-info .name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
}
.courses-sheet-info .sub {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 2px;
}

/* ═══════════════════════════════════════════
   6. SKELETON LOADING
═══════════════════════════════════════════ */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--border) 25%,
    rgba(26,18,37,0.04) 50%,
    var(--border) 75%
  );
  background-size: 800px 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: var(--r-md);
}

.skeleton-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.skeleton-line {
  height: 14px;
  margin-bottom: 10px;
  border-radius: 99px;
}
.skeleton-line.wide    { width: 85%; }
.skeleton-line.medium  { width: 65%; }
.skeleton-line.narrow  { width: 45%; }
.skeleton-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  margin-bottom: 16px;
}

/* ═══════════════════════════════════════════
   7. REAL-TIME UPDATE PULSE
═══════════════════════════════════════════ */

/* Article card gets a pulse when updated in real-time */
@keyframes cardFlash {
  0%   { box-shadow: var(--shadow-sm); }
  40%  { box-shadow: 0 0 0 4px var(--coral-light), var(--shadow-coral); }
  100% { box-shadow: var(--shadow-sm); }
}
.rt-updated {
  animation: cardFlash 0.9s ease !important;
}

/* New item badge */
.rt-new-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--coral);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 99px;
  margin-left: 8px;
  animation: badgePop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  vertical-align: middle;
}
.rt-new-badge::before {
  content: '';
  width: 5px; height: 5px;
  background: rgba(255,255,255,0.8);
  border-radius: 50%;
  animation: liveFlash 1.2s infinite;
}

/* Like count live update flash */
@keyframes countPop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.3); color: var(--coral); }
  100% { transform: scale(1); }
}
.count-popped {
  animation: countPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Online indicator ring */
.live-ring {
  position: relative;
  display: inline-block;
}
.live-ring::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid var(--emerald);
  animation: ringPulse 2s ease-in-out infinite;
}
@keyframes ringPulse {
  0%,100% { transform: scale(1); opacity: 0.6; }
  50%      { transform: scale(1.15); opacity: 0; }
}

/* ═══════════════════════════════════════════
   8. PULL-TO-REFRESH INDICATOR
═══════════════════════════════════════════ */
#ptr-indicator {
  position: fixed;
  top: -60px;
  left: 50%;
  transform: translateX(-50%);
  width: 48px; height: 48px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  transition: top 0.22s ease;
  z-index: 9999;
  color: var(--coral);
  font-size: 1.1rem;
}
#ptr-indicator.visible { top: 16px; }
#ptr-indicator.refreshing i {
  animation: spin 0.7s linear infinite;
}

/* ═══════════════════════════════════════════
   9. NOTIFICATION DOT ON NAVBAR ICON
═══════════════════════════════════════════ */
.nav-notif-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 8px; height: 8px;
  background: var(--coral);
  border-radius: 50%;
  border: 2px solid var(--bg);
  animation: badgePop 0.3s ease, liveFlash 2s 0.5s ease-in-out infinite;
}

/* ═══════════════════════════════════════════
   10. ENHANCED ARTICLE CARD COMMENT COUNT
═══════════════════════════════════════════ */
.article-comment-count,
[data-comment-count],
.comment-count-display {
  transition: opacity 0.25s ease;
}
.comment-count-loading {
  opacity: 0.4;
  pointer-events: none;
}

/* ═══════════════════════════════════════════
   11. MOBILE MODAL IMPROVEMENTS (bottom sheet)
═══════════════════════════════════════════ */
@media (max-width: 600px) {
  #material-modal {
    align-items: flex-end !important;
    padding: 0 !important;
  }
  #modal-content {
    border-radius: 28px 28px 0 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    max-height: 90vh !important;
    min-height: 40vh;
    padding: 28px 22px calc(24px + env(safe-area-inset-bottom)) !important;
    animation: sheetSlideUp 0.32s cubic-bezier(0.32, 0.72, 0, 1) !important;
    overflow-y: auto !important;
  }
  #modal-content::before {
    content: '';
    display: block;
    width: 36px; height: 5px;
    background: var(--border);
    border-radius: 99px;
    margin: 0 auto 22px;
  }

  /* Role notification modal */
  #role-notif-modal > div {
    border-radius: 28px 28px 0 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    padding: 32px 24px calc(28px + env(safe-area-inset-bottom)) !important;
    animation: sheetSlideUp 0.32s cubic-bezier(0.32, 0.72, 0, 1) !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
  }
  #role-notif-modal {
    align-items: flex-end !important;
  }
}

/* ═══════════════════════════════════════════
   12. IMPROVED MOBILE SCROLLBAR HIDING
═══════════════════════════════════════════ */
@media (max-width: 768px) {
  ::-webkit-scrollbar { display: none; }
  * { scrollbar-width: none; }
}

/* ═══════════════════════════════════════════
   13. ARTICLE CARD LIVE INTERACTION
═══════════════════════════════════════════ */
/* Ensure like/comment buttons feel native */
[onclick*="like"],
[onclick*="comment"],
.like-btn,
.comment-btn {
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}
[onclick*="like"]:active,
.like-btn:active {
  transform: scale(1.25) !important;
}

/* ═══════════════════════════════════════════
   14. LOADING OVERLAY FOR PAGE TRANSITIONS
═══════════════════════════════════════════ */
#lsf-page-loader {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
#lsf-page-loader.visible {
  opacity: 1;
  pointer-events: auto;
}
.lsf-loader-ring {
  width: 48px; height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--coral);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ═══════════════════════════════════════════
   15. SWIPE GESTURE HINT (mobile)
═══════════════════════════════════════════ */
.swipe-hint {
  display: none;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
  padding: 6px;
  letter-spacing: 0.5px;
}
@media (max-width: 600px) {
  .swipe-hint { display: block; }
}
/* ═══════════════════════════════════════════
   16. DARK THEME OVERRIDES — LSF PRO ELEMENTS
═══════════════════════════════════════════ */

/* ── Bottom nav dark ── */
[data-theme="dark"] .lsf-bottom-nav {
  background: rgba(13, 8, 24, 0.96) !important;
  border-top-color: var(--border) !important;
}

/* ── Confirm sheet dark ── */
[data-theme="dark"] .lsf-confirm-sheet {
  background: var(--card) !important;
  color: var(--text-main) !important;
  box-shadow: 0 -8px 48px rgba(0,0,0,0.55) !important;
}
[data-theme="dark"] .lsf-confirm-sheet::before {
  background: var(--border) !important;
}
[data-theme="dark"] .lsf-confirm-title {
  color: var(--text-main) !important;
}
[data-theme="dark"] .lsf-confirm-message {
  color: var(--text-dim) !important;
}
[data-theme="dark"] .lsf-confirm-btn.confirm-cancel {
  background: var(--bg-alt) !important;
  color: var(--text-dim) !important;
  border-color: var(--border) !important;
}

/* ── Courses sheet dark ── */
[data-theme="dark"] .courses-sheet {
  background: var(--card) !important;
}
[data-theme="dark"] .courses-sheet-handle::after {
  background: var(--border) !important;
}
[data-theme="dark"] .courses-sheet-title {
  color: var(--text-main) !important;
}
[data-theme="dark"] .courses-sheet-item {
  border-top-color: var(--border) !important;
}
[data-theme="dark"] .courses-sheet-info .name {
  color: var(--text-main) !important;
}
[data-theme="dark"] .courses-sheet-info .sub {
  color: var(--text-dim) !important;
}

/* ── Skeleton dark ── */
[data-theme="dark"] .skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-alt) 25%,
    rgba(237, 232, 255, 0.04) 50%,
    var(--bg-alt) 75%
  ) !important;
  background-size: 800px 100% !important;
}
[data-theme="dark"] .skeleton-card {
  background: var(--card) !important;
  border-color: var(--border) !important;
}

/* ── PTR indicator dark ── */
[data-theme="dark"] #ptr-indicator {
  background: var(--card) !important;
  border-color: var(--border) !important;
  color: var(--coral) !important;
}

/* ── Modal content inside material modal (inline styles override) ── */
[data-theme="dark"] #modal-content {
  background: var(--card) !important;
  color: var(--text-main) !important;
}
/* Inline-style close button inside modal */
[data-theme="dark"] #modal-content [style*="background:none"],
[data-theme="dark"] #modal-content [style*="background: none"] {
  color: var(--text-dim) !important;
}
/* Res-items injected by JS */
[data-theme="dark"] #modal-content .res-item {
  background: var(--bg-alt) !important;
  border-color: var(--border) !important;
  color: var(--text-dim) !important;
}
[data-theme="dark"] #modal-content .res-item:hover {
  background: var(--coral-light) !important;
  border-color: var(--coral) !important;
  color: var(--coral) !important;
}

/* ── PDF viewer container ── */
[data-theme="dark"] #pdf-viewer-modal > div {
  background: var(--card) !important;
}
[data-theme="dark"] #pdf-viewer-modal > div > div:first-child {
  background: var(--card) !important;
  border-color: var(--border) !important;
}

/* ═══════════════════════════════════════════
   17. NAVBAR VISIBILITY SAFETY NET
   Ensures the navbar is never accidentally hidden
═══════════════════════════════════════════ */
nav.navbar,
.container.navbar,
.navbar {
  display: flex !important;
  visibility: visible !important;
}
.nav-links {
  display: flex !important;
  visibility: visible !important;
  width: 100% !important;
  max-width: 100% !important;
}
/* ═══════════════════════════════════════════
   18. FACULTY CHIP STRIP — NATIVE SCROLL
   Replaces wrap-on-mobile with a single
   horizontally-scrollable chip row. Works
   automatically as admin adds more faculties.
═══════════════════════════════════════════ */

/* Scroll container behaviour — mobile only */
@media (max-width: 700px) {

  /* Outer bar: full-width card, no pill shape */
  .faculty-bar {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;        /* Firefox */
    max-width: 100% !important;
    width: 100% !important;
    border-radius: 20px !important;
    justify-content: flex-start !important;
    gap: 8px !important;
    padding: 6px 8px !important;
    /* Right-edge fade: shows there are more chips to scroll to */
    -webkit-mask-image: linear-gradient(
      to right,
      black 0%,
      black 82%,
      transparent 100%
    );
    mask-image: linear-gradient(
      to right,
      black 0%,
      black 82%,
      transparent 100%
    );
    scroll-behavior: smooth;
    scroll-snap-type: x proximity;
  }

  /* Hide native scrollbar on WebKit */
  .faculty-bar::-webkit-scrollbar {
    display: none;
  }

  /* Each chip: never shrinks, never wraps */
  .faculty-bar .faculty-btn {
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    scroll-snap-align: start;
    padding: 10px 20px !important;
    font-size: 0.84rem !important;
  }
}

/* Dark mode: ensure mask fade colour matches background */
[data-theme="dark"] .faculty-bar {
  -webkit-mask-image: linear-gradient(
    to right,
    black 0%,
    black 82%,
    transparent 100%
  );
  mask-image: linear-gradient(
    to right,
    black 0%,
    black 82%,
    transparent 100%
  );
}