*{box-sizing:border-box}
[hidden]{display:none!important}

:root {
  --bg-dark: #0b241c;
  --bg-header: #0d3023;
  --bg-card: #133c2e;
  --bg-card-hover: #194838;
  --bg-folder: #144332;
  --bg-folder-hover: #1b5240;
  --border-color: #2b5240;
  --border-gold: rgba(240, 206, 129, 0.45);
  --gold-primary: #f0ce81;
  --gold-hover: #efcf88;
  --gold-bright: #ffe4a0;
  --text-main: #e8f4ed;
  --text-muted: #a3c4b1;
  --accent-green: #235942;
  --shadow-color: rgba(0, 0, 0, 0.4);
  --font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

body {
  margin: 0;
  font-family: var(--font-family);
  background-color: var(--bg-dark);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--gold-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--gold-bright);
}

/* Header */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px max(20px, calc((100vw - 1180px) / 2));
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 2px 10px var(--shadow-color);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
}

.brand {
  font-weight: 900;
  font-size: 1.5rem;
  color: var(--gold-primary);
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -0.5px;
}

.brand-icon {
  width: 34px;
  height: 34px;
  background: var(--accent-green);
  border: 1px solid var(--border-gold);
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--gold-primary);
}

nav.main-nav {
  display: flex;
  gap: 16px;
  align-items: center;
}

nav.main-nav a {
  font-size: 0.95rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 8px;
  color: #ffffff;
  transition: all 0.2s;
}

nav.main-nav a:hover, nav.main-nav a.active {
  background: rgba(240, 206, 129, 0.15);
  color: var(--gold-primary);
}

.lang-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.lang-picker select {
  min-height: 36px;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-dark);
  color: var(--gold-primary);
  font-weight: 600;
  cursor: pointer;
}

/* Main Container */
main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

/* Hero Section */
.hero {
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 24px 28px;
  background: linear-gradient(135deg, #153e2d 0%, #0d281e 100%);
  margin-bottom: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  top: -40%;
  left: -20%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(240, 206, 129, 0.08) 0%, transparent 70%);
  pointer-events: none;
}

.eyebrow {
  color: var(--gold-primary);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 6px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

h1.hero-title {
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  font-weight: 800;
  margin: 0 0 10px 0;
  color: #ffffff;
}

p.hero-desc {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 0;
  max-width: 800px;
}

/* Breadcrumbs */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 10px 16px;
  background: var(--bg-header);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.breadcrumbs a {
  color: var(--gold-primary);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.breadcrumbs a:hover {
  text-decoration: underline;
}

.breadcrumbs .separator {
  color: var(--border-color);
  opacity: 0.8;
  font-size: 0.75rem;
}

.breadcrumbs .current {
  color: #ffffff;
  font-weight: 700;
}

/* Toolbar & Filters */
.toolbar-section {
  background: var(--bg-header);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 16px 20px;
  margin-bottom: 24px;
  box-shadow: 0 2px 12px var(--shadow-color);
}

.toolbar-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 12px;
  align-items: center;
}

@media (max-width: 900px) {
  .toolbar-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 550px) {
  .toolbar-grid {
    grid-template-columns: 1fr;
  }
}

.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input-wrap svg {
  position: absolute;
  right: 14px;
  color: var(--gold-primary);
  pointer-events: none;
}

[dir="ltr"] .search-input-wrap svg {
  right: auto;
  left: 14px;
}

.search-input-wrap input {
  width: 100%;
  min-height: 44px;
  padding-right: 42px;
  padding-left: 14px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--bg-dark);
  color: #ffffff;
  font-size: 0.92rem;
  transition: border-color 0.2s;
}

[dir="ltr"] .search-input-wrap input {
  padding-right: 14px;
  padding-left: 42px;
}

.search-input-wrap input:focus {
  outline: none;
  border-color: var(--gold-primary);
}

.filter-select {
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--bg-dark);
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s;
}

.filter-select:focus {
  outline: none;
  border-color: var(--gold-primary);
}

/* Header Banners for Level 2 & Level 3 */
.section-banner {
  background: linear-gradient(135deg, #184835 0%, #103224 100%);
  border: 1px solid var(--border-gold);
  border-radius: 16px;
  padding: 20px 24px;
  margin-bottom: 24px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 4px 16px var(--shadow-color);
}

@media (max-width: 600px) {
  .section-banner {
    flex-direction: column;
    align-items: stretch;
  }
}

.banner-info h2 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--gold-primary);
  margin: 0 0 6px 0;
}

.banner-info .sheikh-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.92rem;
  color: #ffffff;
  font-weight: 600;
  margin-bottom: 6px;
}

.banner-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-green);
  border: 1px solid var(--border-gold);
  color: var(--gold-primary);
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  color: var(--gold-primary);
  padding: 8px 16px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-back:hover {
  background: var(--accent-green);
  border-color: var(--gold-primary);
  color: #ffffff;
}

/* Responsive Grid for Folders & Books (2 cols Mobile, 3 cols Tablet, 4 cols Desktop) */
.folders-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr); /* 2 columns on Mobile */
  gap: 14px;
  margin-bottom: 28px;
}

@media (min-width: 640px) {
  .folders-grid {
    grid-template-columns: repeat(3, 1fr); /* 3 columns on Tablet */
    gap: 16px;
  }
}

@media (min-width: 1024px) {
  .folders-grid {
    grid-template-columns: repeat(4, 1fr); /* 4 columns on Desktop */
    gap: 18px;
  }
}

/* Category Folder Card (Level 1) */
.category-folder-card {
  background: var(--bg-folder);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 18px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 140px;
  position: relative;
}

.category-folder-card:hover {
  transform: translateY(-3px);
  border-color: var(--gold-primary);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  background: var(--bg-folder-hover);
}

.category-folder-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.category-folder-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(240, 206, 129, 0.12);
  border: 1px solid var(--border-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold-primary);
  flex-shrink: 0;
}

.category-folder-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0 0 4px 0;
  line-height: 1.35;
}

.category-folder-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 10px;
  margin-top: 12px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.category-folder-badge {
  background: rgba(240, 206, 129, 0.15);
  color: var(--gold-primary);
  padding: 3px 10px;
  border-radius: 12px;
  font-weight: 700;
}

/* Series / Book Card (Level 2) */
.series-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 135px;
}

.series-card:hover {
  transform: translateY(-3px);
  border-color: var(--gold-primary);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  background: var(--bg-card-hover);
}

.series-card-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.series-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(240, 206, 129, 0.12);
  border: 1px solid var(--border-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold-primary);
  flex-shrink: 0;
}

.series-card-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 4px 0;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.series-card-sheikh {
  font-size: 0.82rem;
  color: var(--gold-primary);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Slim Compact Lesson Cards (Level 3) */
.lessons-list-compact {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lesson-card-slim {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: all 0.2s ease;
  min-height: 56px;
}

.lesson-card-slim:hover {
  border-color: var(--gold-primary);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  background: var(--bg-card-hover);
}

.lesson-slim-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.lesson-idx-badge {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(240, 206, 129, 0.12);
  border: 1px solid var(--border-gold);
  color: var(--gold-primary);
  font-weight: 800;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.lesson-slim-info {
  flex: 1;
  min-width: 0;
}

.lesson-slim-title {
  font-size: 0.96rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lesson-slim-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.type-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(35, 89, 66, 0.6);
  border: 1px solid rgba(240, 206, 129, 0.2);
  color: var(--gold-primary);
  font-size: 0.72rem;
  padding: 1px 7px;
  border-radius: 6px;
  font-weight: 600;
}

.lesson-slim-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* Compact Action Buttons */
.icon-btn-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-dark);
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: var(--gold-primary);
  color: var(--bg-dark);
  border-color: var(--gold-primary);
}

.icon-btn.primary-play {
  background: var(--gold-primary);
  color: var(--bg-dark);
  border-color: var(--gold-primary);
  width: 34px;
  height: 34px;
  border-radius: 9px;
}

.icon-btn.primary-play:hover {
  background: var(--gold-bright);
  transform: scale(1.05);
}

/* Compact Real Stats Row */
.compact-stats-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.stat-item {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.stat-item svg {
  color: var(--gold-primary);
  opacity: 0.85;
}

/* Detail Page Container */
.lesson-detail-container {
  background: var(--bg-header);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 4px 24px var(--shadow-color);
}

.detail-header {
  margin-bottom: 20px;
}

.detail-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: #ffffff;
  margin: 8px 0;
}

.detail-meta-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--gold-primary);
  font-size: 0.9rem;
  font-weight: 600;
}

.media-player-box {
  margin: 20px 0;
  background: #061510;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 16px;
}

audio, video {
  width: 100%;
  border-radius: 10px;
  outline: none;
}

iframe.video-embed {
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: 10px;
  border: 0;
}

/* Toast Popup */
.toast-notification {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--gold-primary);
  color: var(--bg-dark);
  padding: 10px 24px;
  border-radius: 30px;
  font-weight: 800;
  font-size: 0.9rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 1000;
}

.toast-notification.show {
  transform: translateX(-50%) translateY(0);
}

/* Pagination Button */
.load-more-btn {
  display: block;
  margin: 28px auto 0;
  min-height: 44px;
  padding: 10px 32px;
  background: var(--gold-primary);
  color: var(--bg-dark);
  font-weight: 800;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.2s;
  box-shadow: 0 4px 14px rgba(240, 206, 129, 0.25);
}

.load-more-btn:hover {
  background: var(--gold-bright);
  transform: translateY(-2px);
}

.load-more-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* Status message */
#status {
  text-align: center;
  font-weight: 600;
  color: var(--gold-primary);
  margin: 16px 0;
}

footer {
  padding: 24px;
  text-align: center;
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.9rem;
}
