/**
 * STUDY FARM 🌱 — Deep Forest & Agriculture Design System
 * Rich organic soil backgrounds, vibrant seedling emeralds, golden harvest accents,
 * smooth animations, and tactile micro-interactions.
 */

:root {
  /* Farm Soil & Deep Night Forest */
  --bg: #06110b;
  --bg-deep: #040a06;
  --bg-soil: #08160f;
  
  --surface: #0c1a13;
  --surface-card: #11221a;
  --surface-hover: #172d22;
  --surface-glass: rgba(12, 26, 19, 0.82);
  
  --border: rgba(255, 255, 255, 0.08);
  --border-light: rgba(255, 255, 255, 0.14);
  --border-accent: rgba(16, 185, 129, 0.35);
  --border-gold: rgba(245, 175, 51, 0.35);
  
  /* Seedling & Harvest Palette */
  --primary: #10b981;
  --primary-hover: #059669;
  --primary-glow: rgba(16, 185, 129, 0.3);
  
  --sprout-green: #48a623;
  --sprout-bright: #70c638;
  --accent-mint: #34d399;
  --accent-sage: #6ee7b7;
  --harvest-gold: #f5af33;
  --harvest-amber: #f59e0b;
  --accent-sky: #38bdf8;
  
  /* Typography */
  --text-main: #fcfbf4;
  --text-muted: #9db5a8;
  --text-dim: #5c7569;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;
  
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.55), 0 2px 6px -1px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 28px -4px var(--primary-glow);
  --shadow-gold-glow: 0 0 24px -4px rgba(245, 175, 51, 0.3);
  --transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-sans);
  background-color: var(--bg);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(16, 185, 129, 0.16) 0%, transparent 65%),
    radial-gradient(circle at 85% 15%, rgba(245, 175, 51, 0.08) 0%, transparent 45%),
    radial-gradient(circle at 10% 85%, rgba(5, 150, 105, 0.1) 0%, transparent 55%);
  background-attachment: fixed;
}

/* Subtle Soil Texture Grid */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
  z-index: -1;
}

/* Ambient Floating Farm Leaves Particles */
.ambient-farm-leaves {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.floating-leaf {
  position: absolute;
  bottom: -40px;
  font-size: 1.4rem;
  opacity: 0.22;
  filter: drop-shadow(0 0 8px rgba(16, 185, 129, 0.4));
  animation: driftLeaf linear infinite;
}

@keyframes driftLeaf {
  0% {
    transform: translateY(0) translateX(0) rotate(0deg);
    opacity: 0;
  }
  15% {
    opacity: 0.28;
  }
  50% {
    transform: translateY(-50vh) translateX(25px) rotate(180deg);
    opacity: 0.24;
  }
  85% {
    opacity: 0.2;
  }
  100% {
    transform: translateY(-105vh) translateX(-20px) rotate(360deg);
    opacity: 0;
  }
}

/* Links & Buttons */
a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  transition: var(--transition);
}

button:active, .control-btn:active, .btn-open-batch:active {
  transform: scale(0.97);
}

/* Icons */
.icon {
  width: 1.25rem;
  height: 1.25rem;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

/* Top Navigation Bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface-glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.25rem;
  transition: var(--transition);
}

.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

/* Brand Link & Logo */
.brand-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.brand-logo-wrap {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  padding: 2px;
  background: linear-gradient(135deg, #10b981, #f5af33);
  box-shadow: 0 0 16px var(--primary-glow);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
}

.brand-link:hover .brand-logo-wrap {
  transform: scale(1.06) rotate(-2deg);
}

.brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: calc(var(--radius-md) - 2px);
  display: block;
}

.logo-sprout-dot {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  background: #70c638;
  border: 2px solid var(--bg);
  border-radius: 50%;
  box-shadow: 0 0 8px #70c638;
}

.brand-title {
  display: flex;
  flex-direction: column;
}

.brand-name-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.brand-name {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(120deg, #fcfbf4 40%, #6ee7b7 85%, #f5af33 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-tag-pill {
  font-size: 0.6rem;
  font-weight: 800;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-sm);
  background: rgba(245, 175, 51, 0.15);
  color: var(--harvest-gold);
  border: 1px solid var(--border-gold);
  letter-spacing: 0.05em;
}

.brand-sub {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent-sage);
  letter-spacing: 0.03em;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-farm-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.85rem;
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--text-muted);
  transition: var(--transition);
}

.nav-farm-btn:hover, .nav-farm-btn.active {
  background: var(--surface-hover);
  border-color: var(--border-accent);
  color: var(--text-main);
  box-shadow: 0 0 14px var(--primary-glow);
}

.farm-icon-leaf {
  font-size: 1rem;
}

.farm-pill {
  font-size: 0.7rem;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.2);
  color: var(--accent-sage);
  font-weight: 800;
}

.btn-telegram.farm-btn-tg {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #fff;
  font-weight: 700;
  font-size: 0.82rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  box-shadow: 0 2px 12px rgba(2, 132, 199, 0.35);
  transition: var(--transition);
}

.btn-telegram.farm-btn-tg:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(2, 132, 199, 0.5);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  background-color: #38bdf8;
  border-radius: 50%;
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(1.35); }
}

/* Hero Section */
.hero {
  padding: 2.5rem 1.25rem 1.5rem;
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
  position: relative;
  z-index: 1;
}

.farm-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.95rem;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(245, 175, 51, 0.08));
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-sage);
  margin-bottom: 1rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.hero-title {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 0.65rem;
}

@media (min-width: 640px) {
  .hero-title {
    font-size: 2.75rem;
  }
}

.hero-gradient {
  background: linear-gradient(135deg, #fcfbf4 20%, #70c638 60%, #f5af33 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-desc {
  color: var(--text-muted);
  font-size: 0.98rem;
  max-width: 660px;
  line-height: 1.65;
}

/* Farm Quick Stats Bar */
.farm-stats-bar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-top: 1.25rem;
  padding: 0.75rem 1.25rem;
  background: var(--surface-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  max-width: 680px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.farm-stat-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 600;
}

.farm-stat-item strong {
  color: var(--text-main);
}

/* Search & Tabs Filter Bar */
.filter-bar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 1.75rem 0 1.5rem;
}

@media (min-width: 768px) {
  .filter-bar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.search-box {
  position: relative;
  flex: 1;
  max-width: 480px;
}

.search-input {
  width: 100%;
  padding: 0.8rem 1rem 0.8rem 2.8rem;
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.9rem;
  transition: var(--transition);
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18), 0 0 20px var(--primary-glow);
}

.search-icon {
  position: absolute;
  left: 0.95rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}

.clear-search-btn {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  display: none;
}

.clear-search-btn.active {
  display: block;
}

.tabs-group {
  display: inline-flex;
  padding: 0.25rem;
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  gap: 0.3rem;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  transition: var(--transition);
}

.tab-btn.active {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  box-shadow: 0 2px 14px var(--primary-glow);
}

/* Batches Grid */
.batches-section {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.25rem 3.5rem;
  width: 100%;
  flex: 1;
  position: relative;
  z-index: 1;
}

.batches-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.35rem;
}

@media (min-width: 580px) {
  .batches-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 960px) {
  .batches-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1200px) {
  .batches-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Staggered Card Entrance Animation */
@keyframes sproutIn {
  from {
    opacity: 0;
    transform: translateY(22px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Batch Card */
.batch-card {
  position: relative;
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  box-shadow: var(--shadow-card);
  animation: sproutIn 0.45s cubic-bezier(0.16, 1, 0.3, 1) backwards;
  animation-delay: calc(var(--i, 0) * 0.04s);
}

.batch-card:hover {
  transform: translateY(-6px);
  border-color: var(--border-accent);
  box-shadow: 0 16px 36px -8px rgba(16, 185, 129, 0.28), var(--shadow-card);
}

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

.batch-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.batch-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(6, 17, 11, 0.85) 0%, transparent 60%);
  display: flex;
  align-items: flex-end;
  padding: 0.75rem;
}

.batch-save-btn {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  z-index: 10;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: rgba(6, 17, 11, 0.8);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: var(--transition);
}

.batch-save-btn:hover {
  color: var(--primary);
  background: var(--surface-card);
  transform: scale(1.12);
}

.batch-save-btn.saved {
  color: var(--harvest-gold);
  background: rgba(245, 175, 51, 0.2);
  border-color: var(--harvest-gold);
}

.batch-content {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.batch-title {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 0.75rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--text-main);
  transition: color 0.2s;
}

.batch-card:hover .batch-title {
  color: var(--accent-sage);
}

.batch-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.price-current {
  font-weight: 800;
  font-size: 0.98rem;
  color: var(--harvest-gold);
}

.price-original {
  font-size: 0.75rem;
  text-decoration: line-through;
  color: var(--text-dim);
  margin-left: 0.3rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge-free {
  background: rgba(16, 185, 129, 0.16);
  color: var(--accent-sage);
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.badge-video {
  background: rgba(56, 189, 248, 0.16);
  color: var(--accent-sky);
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.badge-pdf {
  background: rgba(245, 175, 51, 0.16);
  color: var(--harvest-gold);
  border: 1px solid var(--border-gold);
}

.badge-unlocked {
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-sage);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.btn-open-batch {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.48rem 0.95rem;
  border-radius: var(--radius-sm);
  background: rgba(16, 185, 129, 0.14);
  color: var(--accent-sage);
  border: 1px solid var(--border-accent);
  font-size: 0.8rem;
  font-weight: 700;
  transition: var(--transition);
}

.btn-open-batch:hover {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  box-shadow: 0 4px 14px var(--primary-glow);
}

/* Content Explorer Page (Breadcrumb, Subjects, Topics, Lectures) */
.page-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
  width: 100%;
  flex: 1;
  position: relative;
  z-index: 1;
}

.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.breadcrumb a {
  color: var(--accent-sage);
  font-weight: 600;
  transition: var(--transition);
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb-sep {
  color: var(--text-dim);
}

.course-header-card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  margin-bottom: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  box-shadow: var(--shadow-card);
}

@media (min-width: 640px) {
  .course-header-card {
    flex-direction: row;
    align-items: center;
  }
}

.course-header-thumb {
  width: 100%;
  max-width: 240px;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-md);
  object-fit: cover;
  border: 1px solid var(--border);
}

.course-header-meta {
  flex: 1;
}

.course-header-title {
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 0.6rem;
}

/* Horizontal Subjects Bar */
.section-title {
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.subjects-scroll-row {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.85rem;
  margin-bottom: 1.75rem;
  scrollbar-width: thin;
}

.subject-chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.65rem 1.15rem;
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  transition: var(--transition);
}

.subject-chip:hover {
  border-color: var(--border-accent);
  color: var(--text-main);
}

.subject-chip.active {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.28), rgba(5, 150, 105, 0.16));
  border-color: var(--primary);
  color: var(--accent-sage);
  box-shadow: 0 0 18px var(--primary-glow);
}

.subject-video-count {
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  color: var(--text-dim);
}

.subject-chip.active .subject-video-count {
  background: rgba(16, 185, 129, 0.25);
  color: var(--accent-sage);
}

/* Topics Row */
.topics-row {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.topic-btn {
  padding: 0.48rem 0.95rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: var(--transition);
}

.topic-btn:hover {
  background: var(--surface-card);
  color: var(--text-main);
}

.topic-btn.active {
  background: var(--surface-hover);
  border-color: var(--border-accent);
  color: var(--accent-sage);
}

/* Lecture List Item */
.lectures-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.lecture-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.1rem;
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: var(--transition);
  cursor: pointer;
}

.lecture-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-accent);
  background: var(--surface-hover);
  box-shadow: var(--shadow-card);
}

.lecture-thumb-wrap {
  position: relative;
  width: 90px;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #000;
  flex-shrink: 0;
}

@media (min-width: 640px) {
  .lecture-thumb-wrap {
    width: 120px;
  }
}

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

.lecture-play-hover {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
  color: #fff;
}

.lecture-card:hover .lecture-play-hover {
  opacity: 1;
}

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

.lecture-title {
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 0.35rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-main);
}

.lecture-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.lecture-action-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid var(--border-accent);
  color: var(--accent-sage);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
}

.lecture-card:hover .lecture-action-btn {
  background: var(--primary);
  color: #fff;
  transform: scale(1.08);
}

/* Dedicated Player Page (`play.html`) */
.player-layout {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

@media (min-width: 960px) {
  .player-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    align-items: start;
  }
}

.player-main-col {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.video-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.8);
  border: 1px solid var(--border-light);
}

.video-container video,
.video-container iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.video-loader {
  position: absolute;
  inset: 0;
  background: rgba(6, 17, 11, 0.94);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  z-index: 20;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(16, 185, 129, 0.2);
  border-top-color: var(--primary);
  border-right-color: var(--harvest-gold);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}

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

.player-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

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

.control-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.8rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 700;
  transition: var(--transition);
}

.control-btn:hover {
  color: var(--text-main);
  border-color: var(--border-accent);
}

.control-btn.active {
  background: var(--primary);
  color: #fff;
}

.quality-select, .speed-select {
  background: var(--surface);
  color: var(--text-main);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 700;
  outline: none;
}

/* Playlist / Up Next Sidebar */
.playlist-sidebar {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  max-height: 80vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.playlist-header {
  font-size: 0.95rem;
  font-weight: 800;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Modal Popup (Telegram & PDF) */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  position: relative;
  background: var(--surface-card);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-xl);
  padding: 2.25rem 2rem;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.85), var(--shadow-glow);
  transform: translateY(24px) scale(0.96);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-card {
  transform: translateY(0) scale(1);
}

.modal-close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  color: var(--text-dim);
  padding: 0.35rem;
  border-radius: var(--radius-full);
  transition: var(--transition);
}

.modal-close-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.1);
}

.modal-logo-wrapper {
  position: relative;
  width: 76px;
  height: 76px;
  margin: 0 auto 1.25rem;
  border-radius: var(--radius-xl);
  padding: 3px;
  background: linear-gradient(135deg, #10b981, #f5af33);
  box-shadow: 0 0 26px var(--primary-glow);
}

.modal-logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: calc(var(--radius-xl) - 3px);
  display: block;
}

.modal-logo-ring {
  position: absolute;
  inset: -4px;
  border-radius: calc(var(--radius-xl) + 4px);
  border: 1px dashed rgba(16, 185, 129, 0.4);
  animation: spin 16s linear infinite;
  pointer-events: none;
}

.farm-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.8rem;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid var(--border-accent);
  color: var(--accent-sage);
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 0.85rem;
}

.modal-title {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.modal-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1.6rem;
}

.btn-modal-action.farm-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.9rem;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  border-radius: var(--radius-md);
  font-weight: 800;
  font-size: 0.95rem;
  box-shadow: 0 4px 18px var(--primary-glow);
  transition: var(--transition);
}

.btn-modal-action.farm-action-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.12);
  box-shadow: 0 6px 26px var(--primary-glow);
}

.btn-modal-dismiss {
  margin-top: 0.85rem;
  font-size: 0.82rem;
  color: var(--text-dim);
  transition: color 0.2s;
}

.btn-modal-dismiss:hover {
  color: var(--text-muted);
}

/* Toast System */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast.farm-toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.85rem 1.25rem;
  background: var(--surface-card);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6), 0 0 16px var(--primary-glow);
  animation: toastIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  transition: var(--transition);
}

.toast-emoji {
  font-size: 1.2rem;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(16px) scale(0.92); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Empty / State Views */
.state-box {
  text-align: center;
  padding: 4rem 1.5rem;
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
}

.state-emoji {
  font-size: 2.75rem;
}

.state-title {
  font-size: 1.2rem;
  font-weight: 800;
}

.state-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  max-width: 420px;
}

/* Footer */
.footer.farm-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  background: var(--bg-deep);
  padding: 2.5rem 1.25rem 2rem;
  color: var(--text-dim);
  font-size: 0.84rem;
  position: relative;
  z-index: 1;
}

.footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}

@media (min-width: 640px) {
  .footer-inner {
    flex-direction: row;
  }
}
