/* lectures.css - Modern dark theme styling matching NEP Quiz */

.gallery-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Controls & Filter Bar */
.gallery-controls {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
}

.control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 280px;
  max-width: 600px;
}

.search-box input {
  width: 100%;
  padding: 0.65rem 2.2rem 0.65rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-box input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px var(--accent-cyan-soft);
}

.clear-btn {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
}

.clear-btn:hover {
  color: var(--text-main);
}

.stats-badge {
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.filter-pills-container {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.pill-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pill-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  min-width: 75px;
}

.pill {
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pill:hover {
  color: var(--text-main);
  border-color: var(--border-strong);
  background: var(--bg-card-hover);
}

.pill.active {
  background: var(--accent-cyan-soft);
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
  font-weight: 600;
}

/* Layout */
.gallery-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 900px) {
  .gallery-layout {
    grid-template-columns: 1fr;
  }
}

/* Sidebar */
.lecture-sidebar {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 120px);
  position: sticky;
  top: 1rem;
}

.sidebar-header {
  padding: 1rem 1.25rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(22, 30, 49, 0.4);
}

.lecture-nav-list {
  overflow-y: auto;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.lecture-nav-item {
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.lecture-nav-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-subtle);
}

.lecture-nav-item.active {
  background: rgba(14, 165, 233, 0.12);
  border-color: var(--accent-cyan);
}

.nav-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.nav-badges {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

.mini-badge {
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.mini-badge.year {
  background: #2563eb22;
  color: #60a5fa;
  border: 1px solid #2563eb44;
}

.mini-badge.subj {
  background: #05966922;
  color: #34d399;
  border: 1px solid #05966944;
}

.nav-pages-count {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.nav-item-title {
  font-size: 0.85rem;
  color: var(--text-main);
  font-weight: 500;
  line-height: 1.35;
  word-break: break-all;
}

.nav-item-teacher {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Main Content Section */
.lecture-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Header Card */
.doc-header-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.doc-badge-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.badge {
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  font-weight: 600;
}

.badge-year { background: #3b82f622; color: #60a5fa; border: 1px solid #3b82f644; }
.badge-subject { background: #10b98122; color: #34d399; border: 1px solid #10b98144; }
.badge-type { background: #8b5cf622; color: #a78bfa; border: 1px solid #8b5cf644; }
.badge-teacher { background: #f59e0b22; color: #fbbf24; border: 1px solid #f59e0b44; }

.cur-doc-title {
  font-size: 1.25rem;
  color: var(--text-main);
  font-weight: 700;
  line-height: 1.3;
}

.doc-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
}

.toolbar-left, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.page-indicator {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-right: 0.5rem;
}

.tool-btn {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.45rem 0.85rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.tool-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
}

.tool-btn.nav-btn {
  background: var(--accent-cyan-soft);
  color: var(--accent-cyan);
  border-color: rgba(14, 165, 233, 0.4);
  font-weight: 600;
}

.tool-btn.nav-btn:hover {
  background: rgba(14, 165, 233, 0.25);
  border-color: var(--accent-cyan);
}

/* Slide Viewer Stage */
.slide-viewer {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.slide-stage {
  background: #000000;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  min-height: 480px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.main-slide-img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  display: block;
  user-select: none;
  transition: opacity 0.15s ease;
}

.slide-loading-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(17, 23, 38, 0.85);
  color: var(--accent-cyan);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  font-size: 0.9rem;
  pointer-events: none;
  display: none;
}

.page-slider-bar {
  padding: 0.25rem 0.5rem;
}

.page-slider-bar input[type="range"] {
  width: 100%;
  cursor: pointer;
  accent-color: var(--accent-cyan);
}

.slide-text-accordion details {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
}

.slide-text-accordion summary {
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-muted);
  user-select: none;
}

.slide-text-accordion summary:hover {
  color: var(--text-main);
}

.slide-text-content {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text-main);
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 200px;
  overflow-y: auto;
  background: var(--bg-card);
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

/* Grid Viewer (Thumbnails) */
.thumbnails-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}

.thumb-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
  display: flex;
  flex-direction: column;
}

.thumb-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-cyan);
}

.thumb-card.active {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 2px var(--accent-cyan);
}

.thumb-img-wrapper {
  background: #000;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.thumb-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb-footer {
  padding: 0.4rem 0.6rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

/* Lightbox Modal */
.lightbox-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
}

.lightbox-modal.active {
  display: flex;
}

.lightbox-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(4px);
}

.lightbox-content {
  position: relative;
  z-index: 1;
  max-width: 95vw;
  max-height: 95vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox-close {
  position: absolute;
  top: -2.5rem;
  right: 0;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
}

.lightbox-content img {
  max-width: 95vw;
  max-height: 88vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
}

.lightbox-caption {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

.badge-source {
  background: rgba(14, 165, 233, 0.2);
  color: #38bdf8;
  border: 1px solid rgba(14, 165, 233, 0.4);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.badge-source:hover {
  background: rgba(14, 165, 233, 0.35);
  border-color: #38bdf8;
  color: #fff;
  transform: translateY(-1px);
}

.lecture-nav-item:focus-visible,
.thumb-card:focus-visible,
.pill:focus-visible,
.tool-btn:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 2px;
}

.gallery-container { width: 100%; min-width: 0; }
.gallery-controls, .gallery-layout, .lecture-sidebar, .lecture-main, .viewer-panel { min-width: 0; max-width: 100%; }
.stats-badge { white-space: normal; line-height: 1.6; }
.gallery-note { font-size: 13px; color: var(--text-muted); line-height: 1.7; margin: 0; }
@media (max-width: 600px) {
 .gallery-container { padding: 16px; }
 .gallery-controls { padding: 14px; }
 .search-box { min-width: 0; width: 100%; flex-basis: 100%; }
 .control-row { min-width: 0; }
 .brand-text { min-width: 0; }
 .brand-title { font-size: 14px; }
 .brand-sub { font-size: 10px; }
 .viewer-toolbar { flex-wrap: wrap; }
 .lightbox-close { top: 4px; right: 4px; background:#111b; border-radius:8px; padding:6px; }
}

.nav-matches { font-size:12px; color:var(--accent-cyan); margin-top:8px; line-height:1.7; }

.lecture-heading {display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap;}
.lecture-heading h1 {font-size:26px;margin:0;}
.teacher-filter-row {display:flex;align-items:center;gap:12px;flex-wrap:wrap;padding-bottom:12px;border-bottom:1px solid var(--border-subtle);}
.teacher-filter-row select {width:min(100%,360px);}
.teacher-group-heading {font-size:16px;color:var(--text-main);margin:0;padding:20px 14px 10px;border-top:1px solid var(--border-subtle);}
.teacher-group-heading:first-child {border-top:0;padding-top:14px;}
@media(max-width:600px){.lecture-heading h1{font-size:23px}.lecture-heading .btn{white-space:normal;text-align:left}.teacher-filter-row select{width:100%}}
