/* ═══════════════════════════════════════════════════════════════════
   DARZ WALLAH — Design System v3 "Clean Light"
   Palette: White · Slate · Electric Blue · Clean greys
   ═══════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
  /* ── Backgrounds ─────────────────────────────────────────────── */
  --bg:         #ffffff;
  --surface:    #f8fafc;   /* slate-50 */
  --surface-2:  #f1f5f9;   /* slate-100 */
  --surface-3:  #e2e8f0;   /* slate-200 */
  --surface-overlay: rgba(255,255,255,0.92);

  /* ── Borders ─────────────────────────────────────────────────── */
  --border:       #e2e8f0;
  --border-light: #f1f5f9;
  --border-focus: rgba(59,130,246,0.6);

  /* ── Text ────────────────────────────────────────────────────── */
  --text:        #0f172a;   /* slate-900 */
  --text-muted:  #64748b;   /* slate-500 */
  --text-subtle: #94a3b8;   /* slate-400 */

  /* ── Accent — Electric Blue ──────────────────────────────────── */
  --accent:        #3b82f6;   /* blue-500 */
  --accent-hover:  #2563eb;   /* blue-600 */
  --accent-light:  #2563eb;   /* blue-600 */
  --accent-subtle: rgba(59,130,246,0.07);
  --accent-glow:   0 0 0 4px rgba(59,130,246,0.12);

  /* ── Semantic ────────────────────────────────────────────────── */
  --success:        #16a34a;
  --success-subtle: rgba(22,163,74,0.08);
  --danger:         #dc2626;
  --danger-subtle:  rgba(220,38,38,0.08);
  --warning:        #d97706;
  --warning-subtle: rgba(217,119,6,0.08);

  /* ── Shadows ─────────────────────────────────────────────────── */
  --shadow-xs: 0 1px 2px rgba(15,23,42,0.06);
  --shadow-sm: 0 2px 8px rgba(15,23,42,0.08);
  --shadow:    0 4px 16px rgba(15,23,42,0.1);
  --shadow-lg: 0 8px 32px rgba(15,23,42,0.12);
  --shadow-xl: 0 16px 48px rgba(15,23,42,0.14);
  --shadow-blue: 0 4px 20px rgba(59,130,246,0.22);

  /* ── Radius ──────────────────────────────────────────────────── */
  --radius-xs:   4px;
  --radius-sm:   8px;
  --radius:      12px;
  --radius-lg:   16px;
  --radius-xl:   20px;
  --radius-2xl:  24px;
  --radius-full: 9999px;

  /* ── Typography ──────────────────────────────────────────────── */
  --font-xs:   11px;
  --font-sm:   13px;
  --font-base: 15px;
  --font-lg:   17px;
  --font-xl:   20px;
  --font-2xl:  24px;
  --font-3xl:  30px;

  /* ── Transitions ─────────────────────────────────────────────── */
  --transition:      200ms cubic-bezier(0.4,0,0.2,1);
  --transition-slow: 350ms cubic-bezier(0.4,0,0.2,1);
}

/* ══════════════════════════════════════════════════════════════════
   RESET + BASE
   ══════════════════════════════════════════════════════════════════ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: var(--font-base);
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

body.app-shell { padding-bottom: 0; }

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

button, input, select, textarea { font: inherit; }

button {
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* Modern custom focus — replaces browser default */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
button:focus:not(:focus-visible),
a:focus:not(:focus-visible),
input:focus:not(:focus-visible) {
  outline: none;
}

::selection {
  background: rgba(59,130,246,0.3);
  color: white;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb {
  background: var(--surface-3);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ══════════════════════════════════════════════════════════════════
   LAYOUT
   ══════════════════════════════════════════════════════════════════ */
.page-shell {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.page-title {
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.page-subtitle {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: var(--font-sm);
}

/* ══════════════════════════════════════════════════════════════════
   HEADER / NAV
   ══════════════════════════════════════════════════════════════════ */
.header, .topbar {
  position: sticky;
  top: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: var(--font-lg);
  color: var(--text);
}

.header .brand-block,
.topbar .brand-block {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header .brand-mark,
.topbar .brand-mark {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  background: var(--accent);
  color: white;
  font-size: 1rem;
  font-weight: 800;
  flex-shrink: 0;
  box-shadow: var(--shadow-blue);
}

/* ══════════════════════════════════════════════════════════════════
   BADGES + PILLS
   ══════════════════════════════════════════════════════════════════ */
.badge, .pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: var(--font-xs);
  font-weight: 700;
  letter-spacing: 0.02em;
  background: var(--accent-subtle);
  color: var(--accent-light);
  border: 1px solid rgba(59,130,246,0.2);
}

.pill-success { background: var(--success-subtle); color: var(--success); border-color: rgba(34,197,94,0.2); }
.pill-danger  { background: var(--danger-subtle);  color: var(--danger);  border-color: rgba(239,68,68,0.2); }
.pill-warning { background: var(--warning-subtle); color: var(--warning); border-color: rgba(245,158,11,0.2); }

/* ══════════════════════════════════════════════════════════════════
   CARDS + SURFACES
   ══════════════════════════════════════════════════════════════════ */
.card, .panel, .surface-card, .soft-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: var(--transition);
}

.card:hover, .panel:hover, .surface-card:hover, .soft-card:hover {
  border-color: rgba(59,130,246,0.35);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

/* ══════════════════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════════════════ */
.btn, .explore-btn, .action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-size: var(--font-sm);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary, .btn.primary, .explore-btn {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  box-shadow: var(--shadow-blue);
}
.btn-primary:hover, .btn.primary:hover, .explore-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(59,130,246,0.35);
}

.btn-secondary, .btn.secondary, .btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover, .btn.secondary:hover {
  background: var(--surface-3);
  border-color: rgba(59,130,246,0.35);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
  pointer-events: none;
}

.btn-sm { padding: 6px 12px; font-size: var(--font-xs); border-radius: var(--radius-sm); }
.btn-lg { padding: 13px 26px; font-size: var(--font-base); }

/* ══════════════════════════════════════════════════════════════════
   INPUTS + SEARCH
   ══════════════════════════════════════════════════════════════════ */
.search-box, .input, .field {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  color: var(--text);
  font-size: var(--font-base);
  outline: none;
  transition: var(--transition);
}

.search-box::placeholder, .input::placeholder, .field::placeholder {
  color: var(--text-subtle);
}

.search-box:focus, .input:focus, .field:focus {
  border-color: var(--border-focus);
  box-shadow: var(--accent-glow);
}

/* ══════════════════════════════════════════════════════════════════
   TABS
   ══════════════════════════════════════════════════════════════════ */
.tab-nav, .tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: fit-content;
}

.tab-btn, .tab {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: var(--font-sm);
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.tab-btn:hover, .tab:hover { color: var(--text); background: var(--surface-2); }

.tab-btn.active, .tab.active {
  background: var(--accent);
  color: white;
  box-shadow: var(--shadow-blue);
}

/* ══════════════════════════════════════════════════════════════════
   GRID SYSTEM
   ══════════════════════════════════════════════════════════════════ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 20px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ══════════════════════════════════════════════════════════════════
   BATCH CARDS
   ══════════════════════════════════════════════════════════════════ */
.batch {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-slow);
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.batch:hover {
  border-color: rgba(59,130,246,0.4);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.batch-thumbnail {
  position: relative;
  overflow: hidden;
  background: var(--surface-2);
  aspect-ratio: 16 / 9;
}

.batch-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--transition-slow);
}

.batch:hover .batch-thumbnail img { transform: scale(1.04); }

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

.batch-name {
  font-weight: 700;
  font-size: var(--font-base);
  line-height: 1.35;
  color: var(--text);
}

.batch-meta {
  font-size: var(--font-xs);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.batch-price {
  font-weight: 800;
  font-size: var(--font-sm);
  color: var(--accent-light);
  margin-top: auto;
}

.explore-btn {
  width: 100%;
  padding: 10px;
  border-radius: var(--radius-sm);
  justify-content: center;
}

.favorite-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  font-size: 1rem;
  z-index: 2;
  transition: var(--transition);
  cursor: pointer;
}
.favorite-btn:hover { transform: scale(1.1); }
.favorite-btn.favorited {
  background: rgba(239,68,68,0.15);
  border-color: rgba(239,68,68,0.4);
}

/* ══════════════════════════════════════════════════════════════════
   SKELETON LOADER
   ══════════════════════════════════════════════════════════════════ */
.skeleton, .skeleton-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  overflow: hidden;
}

.skel {
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  height: 14px;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}
.skel-img  { height: 160px; border-radius: var(--radius); margin-bottom: 12px; }
.skel-title { height: 18px; width: 65%; }
.skel-text  { height: 12px; }
.skel-btn   { height: 40px; border-radius: var(--radius-sm); margin-top: 6px; }

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ══════════════════════════════════════════════════════════════════
   EMPTY + ERROR STATES
   ══════════════════════════════════════════════════════════════════ */
.empty, .empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  grid-column: 1 / -1;
}
.empty-state .icon  { font-size: 48px; margin-bottom: 16px; opacity: 0.3; }
.empty-state .title { font-size: var(--font-lg); font-weight: 600; color: var(--text-subtle); margin-bottom: 6px; }

/* ══════════════════════════════════════════════════════════════════
   LIST ITEMS
   ══════════════════════════════════════════════════════════════════ */
.list-item, .topic-item, .subject_card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: var(--transition);
  cursor: pointer;
}

.list-item:hover, .topic-item:hover, .subject_card:hover {
  border-color: rgba(59,130,246,0.4);
  background: var(--surface-2);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

/* ══════════════════════════════════════════════════════════════════
   FOOTER
   ══════════════════════════════════════════════════════════════════ */
.footer, .app-footer {
  text-align: center;
  padding: 20px;
  color: var(--text-subtle);
  font-size: var(--font-xs);
  border-top: 1px solid var(--border-light);
  margin-top: 24px;
}
.footer strong, .app-footer strong { color: var(--text-muted); }

/* ══════════════════════════════════════════════════════════════════
   MODALS
   ══════════════════════════════════════════════════════════════════ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}
.modal-backdrop.show { display: flex; }

.modal-sheet {
  width: 100%;
  max-width: 520px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl) var(--radius-xl) var(--radius-sm) var(--radius-sm);
  padding: 24px;
  box-shadow: var(--shadow-xl);
  animation: sheet-up 0.22s ease;
}

@keyframes sheet-up {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ══════════════════════════════════════════════════════════════════
   ANIMATIONS
   ══════════════════════════════════════════════════════════════════ */
.fade-in  { animation: fade-in  0.3s ease; }
.slide-up { animation: slide-up 0.3s ease; }

@keyframes fade-in  {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes slide-up {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════════════════════════════════════════
   VIDEO PLAYER COMPONENTS
   ══════════════════════════════════════════════════════════════════ */
#player-container {
  position: relative;
  width: 100%;
  min-height: 100vh;
  background: #000;
  overflow: hidden;
}

.controls-wrapper {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  width: min(95vw, 900px);
  background: rgba(15,23,42,0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  z-index: 5;
}

.progress-bar {
  flex: 1;
  height: 6px;
  border-radius: var(--radius-full);
  overflow: hidden;
  background: var(--surface-2);
  cursor: pointer;
}

.progress-played {
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
  position: relative;
  transition: width 0.1s linear;
}

.progress-played .thumb {
  position: absolute;
  right: -4px;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: white;
  transform: translateY(-50%);
  box-shadow: 0 0 0 2px var(--accent);
}

/* ══════════════════════════════════════════════════════════════════
   TELEGRAM POPUP
   ══════════════════════════════════════════════════════════════════ */
.tg-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.55);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
  animation: fade-in 0.3s ease;
}

.tg-box {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-2xl);
  padding: 28px;
  text-align: center;
  box-shadow: var(--shadow-xl);
  animation: slide-up 0.3s ease;
}

.tg-icon {
  width: 80px; height: 80px;
  margin: 0 auto 18px;
  border-radius: var(--radius-full);
  background: var(--accent-subtle);
  border: 2px solid rgba(59,130,246,0.3);
  display: grid;
  place-items: center;
  font-size: 36px;
}

.tg-box h2 { font-size: var(--font-2xl); font-weight: 800; margin-bottom: 10px; letter-spacing: -0.02em; }
.tg-box p  { color: var(--text-muted); font-size: var(--font-sm); line-height: 1.65; margin-bottom: 22px; }

/* ══════════════════════════════════════════════════════════════════
   MAINTENANCE PAGE
   ══════════════════════════════════════════════════════════════════ */
.maintenance-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(ellipse at top, rgba(59,130,246,0.08) 0%, transparent 60%), var(--bg);
}

.maintenance-card {
  max-width: 520px;
  width: 100%;
  text-align: center;
  padding: 48px 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-xl);
  animation: slide-up 0.5s ease;
}

.maintenance-icon { font-size: 64px; margin-bottom: 24px; }

.maintenance-card h1 {
  font-size: var(--font-3xl);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
}

.maintenance-card p {
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 28px;
}

/* ══════════════════════════════════════════════════════════════════
   SEARCH SECTION
   ══════════════════════════════════════════════════════════════════ */
.search-section {
  padding: 16px 0 8px;
}

.search-wrap {
  position: relative;
}

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

.search-wrap .search-box {
  padding-left: 42px;
}

/* ══════════════════════════════════════════════════════════════════
   GLASS EFFECT
   ══════════════════════════════════════════════════════════════════ */
.glass {
  background: rgba(255,255,255,0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(226,232,240,0.8);
}

/* ══════════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .page-shell { padding: 16px; }
  .header, .topbar { padding: 12px 16px; font-size: var(--font-base); }
  .grid { grid-template-columns: 1fr; }
  .controls-wrapper { padding: 10px 12px; }
}

@media (max-width: 480px) {
  .page-shell { padding: 12px; }
  .grid { gap: 14px; }
  .tab-btn, .tab { padding: 7px 12px; font-size: var(--font-xs); }
}
