/* ==========================================================================
   EduStream - Emerald & Dark Forest Theme
   ========================================================================== */

:root {
  --bg-dark: #03140e;
  --bg-forest: #051c14;
  --bg-card: #08281d;
  --bg-card-hover: #0c3527;
  --bg-card-subtle: rgba(8, 40, 29, 0.65);
  
  --emerald-primary: #10b981;
  --emerald-hover: #059669;
  --emerald-glow: rgba(16, 185, 129, 0.35);
  --emerald-border: rgba(16, 185, 129, 0.18);
  --emerald-border-active: rgba(52, 211, 153, 0.5);

  --accent-neon: #34d399;
  --accent-amber: #fbbf24;
  --accent-rose: #f43f5e;
  
  --text-main: #f0fdf4;
  --text-muted: #86efac;
  --text-sub: rgba(240, 253, 244, 0.65);
  --text-dim: rgba(240, 253, 244, 0.4);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-family: var(--font-main);
  background-color: var(--bg-dark);
  color: var(--text-main);
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  background: radial-gradient(circle at 50% 0%, #062b1f 0%, var(--bg-dark) 70%);
  background-attachment: fixed;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
  background: #0d4231;
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--emerald-primary);
}

/* Typography Helpers */
.font-display { font-family: var(--font-display); }

/* Glassmorphism Containers */
.glass-panel {
  background: var(--bg-card-subtle);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--emerald-border);
}

.glass-nav {
  background: rgba(3, 20, 14, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--emerald-border);
}

/* App Layout Grid */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* Desktop Sidebar */
.desktop-sidebar {
  width: 260px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  background: rgba(3, 20, 14, 0.95);
  border-right: 1px solid var(--emerald-border);
  z-index: 40;
}

@media (max-width: 1024px) {
  .desktop-sidebar {
    display: none;
  }
}

/* Sidebar Logo */
.brand-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 24px 8px;
  border-bottom: 1px solid var(--emerald-border);
  text-decoration: none;
  cursor: pointer;
}

.brand-icon-wrap {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--emerald-primary), #047857);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 15px var(--emerald-glow);
  color: #fff;
  font-size: 20px;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.brand-name span {
  color: var(--accent-neon);
}

/* Navigation Links */
.nav-group {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  color: var(--text-sub);
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 600;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.nav-link i {
  font-size: 17px;
  width: 20px;
  text-align: center;
}

.nav-link:hover {
  background: var(--bg-card);
  color: var(--text-main);
  border-color: var(--emerald-border);
}

.nav-link.active {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.18), transparent);
  color: var(--accent-neon);
  border-color: var(--emerald-border-active);
  box-shadow: inset 3px 0 0 var(--accent-neon);
}

/* Main Content Wrapper */
.main-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding-bottom: 80px; /* Space for mobile bottom bar */
}

@media (min-width: 1025px) {
  .main-content {
    padding-bottom: 40px;
  }
}

/* Top Navigation Bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: rgba(3, 20, 14, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--emerald-border);
}

@media (max-width: 640px) {
  .topbar {
    padding: 0 16px;
    height: 60px;
  }
}

/* Search Bar */
.search-box-wrap {
  position: relative;
  width: 100%;
  max-width: 480px;
}

.search-input {
  width: 100%;
  height: 42px;
  background: var(--bg-card);
  border: 1px solid var(--emerald-border);
  border-radius: var(--radius-full);
  padding: 0 18px 0 42px;
  color: var(--text-main);
  font-size: 14px;
  outline: none;
  transition: all 0.25s ease;
}

.search-input:focus {
  border-color: var(--accent-neon);
  box-shadow: 0 0 16px var(--emerald-glow);
  background: var(--bg-forest);
}

.search-icon-pos {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
  pointer-events: none;
}

/* Social Buttons */
.social-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.2s ease;
}

.social-telegram {
  background: rgba(36, 161, 222, 0.15);
  border: 1px solid rgba(36, 161, 222, 0.3);
  color: #38bdf8;
}
.social-telegram:hover {
  background: rgba(36, 161, 222, 0.25);
  transform: translateY(-1px);
}

.social-whatsapp {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #4ade80;
}
.social-whatsapp:hover {
  background: rgba(34, 197, 94, 0.25);
  transform: translateY(-1px);
}

/* Filter Chips Carousel */
.filter-carousel {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding: 16px 24px;
  white-space: nowrap;
  scrollbar-width: none;
}
.filter-carousel::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  padding: 8px 16px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--emerald-border);
  color: var(--text-sub);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.filter-chip:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
  border-color: var(--emerald-border-active);
}

.filter-chip.active {
  background: var(--emerald-primary);
  color: #02140c;
  font-weight: 700;
  border-color: var(--emerald-primary);
  box-shadow: 0 0 12px var(--emerald-glow);
}

/* Batches Grid */
.batches-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  padding: 12px 24px 32px 24px;
}

@media (max-width: 640px) {
  .batches-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
    padding: 12px 14px 32px 14px;
  }
}

/* Batch Card */
.batch-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--emerald-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

.batch-card:hover {
  transform: translateY(-4px);
  border-color: var(--emerald-border-active);
  box-shadow: 0 14px 32px -8px var(--emerald-glow);
  background: var(--bg-card-hover);
}

.batch-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #020e0a;
}

.batch-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.batch-card:hover .batch-thumb {
  transform: scale(1.05);
}

.batch-fav-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  background: rgba(3, 20, 14, 0.7);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 2;
}

.batch-fav-btn:hover {
  background: var(--emerald-primary);
  color: #03140e;
}

.batch-fav-btn.favorited {
  color: #ef4444;
  background: rgba(3, 20, 14, 0.9);
}

.batch-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.batch-badges-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.badge-tag {
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-exam {
  background: rgba(16, 185, 129, 0.2);
  color: var(--accent-neon);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-lang {
  background: rgba(251, 191, 36, 0.15);
  color: var(--accent-amber);
  border: 1px solid rgba(251, 191, 36, 0.25);
}

.batch-title {
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text-main);
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.batch-sub {
  font-size: 12px;
  color: var(--text-sub);
  margin-top: auto;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Batch Detail Header */
.batch-detail-header {
  padding: 24px;
  background: linear-gradient(180deg, rgba(8, 40, 29, 0.8) 0%, transparent 100%);
  border-bottom: 1px solid var(--emerald-border);
}

.batch-header-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 28px;
  align-items: center;
}

@media (max-width: 768px) {
  .batch-header-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }
}

.batch-banner-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-md);
  object-fit: cover;
  border: 1px solid var(--emerald-border-active);
  box-shadow: 0 10px 25px -5px var(--emerald-glow);
}

/* Tabs Bar */
.custom-tabs-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 24px;
  border-bottom: 1px solid var(--emerald-border);
  overflow-x: auto;
  scrollbar-width: none;
}
.custom-tabs-bar::-webkit-scrollbar {
  display: none;
}

.custom-tab-btn {
  padding: 14px 20px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-sub);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.custom-tab-btn.active {
  color: var(--accent-neon);
  border-bottom-color: var(--accent-neon);
}

/* Subject Cards Grid */
.subjects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  padding: 24px;
}

@media (max-width: 640px) {
  .subjects-grid {
    grid-template-columns: 1fr;
    padding: 16px;
  }
}

.subject-card {
  background: var(--bg-card);
  border: 1px solid var(--emerald-border);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: all 0.25s ease;
}

.subject-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--emerald-border-active);
  transform: translateX(4px);
  box-shadow: 0 8px 20px -6px var(--emerald-glow);
}

.subject-icon-box {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid var(--emerald-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-neon);
  font-size: 20px;
  flex-shrink: 0;
}

.subject-info {
  flex: 1;
  min-width: 0;
}

.subject-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.subject-meta {
  font-size: 12px;
  color: var(--text-sub);
}

/* Topic / Chapter Cards */
.topic-card {
  background: var(--bg-card);
  border: 1px solid var(--emerald-border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.2s ease;
}

.topic-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--emerald-border-active);
  transform: translateY(-2px);
}

.topic-stats-pill {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Lecture Content Cards */
.lecture-card {
  background: var(--bg-card);
  border: 1px solid var(--emerald-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.2s ease;
}

@media (min-width: 640px) {
  .lecture-card {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    gap: 16px;
  }
}

.lecture-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--emerald-border-active);
}

.lecture-left {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
}

@media (min-width: 640px) {
  .lecture-left {
    padding: 0;
    flex: 1;
    min-width: 0;
  }
}

.lecture-play-circle {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--emerald-primary), #047857);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #03140e;
  font-size: 16px;
  flex-shrink: 0;
  box-shadow: 0 0 14px var(--emerald-glow);
}

.lecture-details {
  flex: 1;
  min-width: 0;
}

.lecture-topic-title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
  line-height: 1.3;
}

.lecture-time-meta {
  font-size: 12px;
  color: var(--text-sub);
  display: flex;
  align-items: center;
  gap: 10px;
}

.lecture-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px 14px 14px;
}

@media (min-width: 640px) {
  .lecture-actions {
    padding: 0;
  }
}

.btn-watch {
  padding: 8px 18px;
  border-radius: var(--radius-full);
  background: var(--emerald-primary);
  color: #03140e;
  font-size: 13px;
  font-weight: 800;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-watch:hover {
  background: var(--accent-neon);
  box-shadow: 0 0 14px var(--emerald-glow);
  transform: translateY(-1px);
}

.btn-notes {
  padding: 8px 14px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--emerald-border);
  color: var(--text-main);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-notes:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--emerald-border-active);
}

/* Mobile Curved Bottom Bar */
.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: rgba(3, 20, 14, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--emerald-border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 50;
}

@media (min-width: 1025px) {
  .mobile-bottom-nav {
    display: none;
  }
}

.bnav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-sub);
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
  transition: all 0.2s ease;
  flex: 1;
}

.bnav-btn i {
  font-size: 19px;
}

.bnav-btn.active {
  color: var(--accent-neon);
}

/* Toast Container */
.toast-wrap {
  position: fixed;
  bottom: 80px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1000;
  pointer-events: none;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-md);
  background: rgba(6, 43, 31, 0.95);
  border: 1px solid var(--emerald-border-active);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  backdrop-filter: blur(10px);
  animation: slideUp 0.3s ease;
  pointer-events: auto;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Spinner Loader */
.spinner {
  width: 36px;
  height: 36px;
  border: 3.5px solid rgba(16, 185, 129, 0.2);
  border-top-color: var(--accent-neon);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
