/* MDYouTube — UI v2 */

:root {
  --red: #ff2d2d;
  --red-dark: #d91f1f;
  --red-glow: rgba(255,45,45,0.18);
  --bg: #0a0a0a;
  --surface: #111111;
  --surface2: #1a1a1a;
  --surface3: #222222;
  --border: #272727;
  --border2: #333333;
  --text: #f0f0f0;
  --text2: #b0b0b0;
  --muted: #666666;
  --radius: 14px;
  --radius-sm: 8px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ══════════════════════════════════════════
   NAVBAR
══════════════════════════════════════════ */
.navbar {
  background: rgba(10,10,10,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.logo-md {
  background: var(--red);
  color: #fff;
  font-weight: 900;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  box-shadow: 0 0 12px var(--red-glow);
}

/* ── Navbar search ── */
.search-wrap {
  display: flex;
  align-items: center;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 30px;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
  max-width: 500px;
  width: 100%;
}

.search-wrap:focus-within {
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-glow);
}

.search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  padding: 0.5rem 1rem;
  color: var(--text);
  font-size: 0.88rem;
  font-family: inherit;
}

.search-input::placeholder { color: var(--muted); }

.search-btn {
  background: transparent;
  border: none;
  padding: 0.5rem 0.9rem;
  cursor: pointer;
  color: var(--text2);
  transition: color 0.15s;
  display: flex;
  align-items: center;
}

.search-btn:hover { color: var(--red); }

/* ══════════════════════════════════════════
   HERO
══════════════════════════════════════════ */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 5rem 1.5rem 2.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

/* Subtle radial glow behind hero */
.hero::before {
  content: '';
  position: absolute;
  top: -60px;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 400px;
  background: radial-gradient(ellipse at center, rgba(255,45,45,0.08) 0%, transparent 70%);
  pointer-events: none;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 20px;
  padding: 0.3rem 0.9rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 1.5rem;
  letter-spacing: 0.02em;
}

.hero-eyebrow span { color: var(--red); }

.hero-title {
  font-size: clamp(2.2rem, 6vw, 4rem);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}

.hero-title .accent {
  background: linear-gradient(135deg, #ff2d2d 0%, #ff6b6b 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  color: var(--text2);
  font-size: 1rem;
  margin-bottom: 2.5rem;
  max-width: 420px;
  line-height: 1.6;
}

/* ── Hero form ── */
.hero-form {
  display: flex;
  width: 100%;
  max-width: 640px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}

.hero-form:focus-within {
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-glow), 0 4px 24px rgba(0,0,0,0.4);
}

.hero-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  padding: 1rem 1.25rem;
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
}

.hero-input::placeholder { color: var(--muted); }

.hero-btn {
  background: var(--red);
  border: none;
  padding: 1rem 1.6rem;
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
  font-family: inherit;
  letter-spacing: 0.01em;
}

.hero-btn:hover { background: var(--red-dark); }

/* ── Features strip ── */
.features {
  display: flex;
  justify-content: center;
  gap: 0;
  flex-wrap: wrap;
  padding: 2.5rem 1.5rem 4rem;
  max-width: 700px;
  margin: 0 auto;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text2);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.5rem 1.1rem;
  border-right: 1px solid var(--border);
}

.feature-item:last-child { border-right: none; }
.feature-icon { font-size: 1rem; }

/* ── Error box ── */
.error-box {
  background: rgba(255,45,45,0.07);
  border: 1px solid rgba(255,45,45,0.25);
  border-radius: var(--radius-sm);
  padding: 1.1rem 1.4rem;
  color: #ff7070;
  text-align: center;
  margin-top: 1rem;
  font-size: 0.9rem;
  line-height: 1.6;
}

/* ══════════════════════════════════════════
   WATCH PAGE
══════════════════════════════════════════ */
.watch-layout {
  max-width: 900px;
  margin: 2rem auto;
  padding: 0 1.25rem 3rem;
}

/* ── Loading ── */
.htmx-indicator { display: none; }

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 4rem 2rem;
  color: var(--text2);
  font-size: 0.9rem;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border2);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

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

/* ── Video card ── */
.video-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1.25rem;
  display: flex;
  gap: 0;
}

.video-thumb-wrap {
  position: relative;
  flex-shrink: 0;
  width: 280px;
  aspect-ratio: 16/9;
  background: #000;
  overflow: hidden;
}

.video-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.video-duration {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0,0,0,0.88);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 5px;
  letter-spacing: 0.02em;
}

.video-meta {
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}

.video-title {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.01em;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-sub {
  color: var(--text2);
  font-size: 0.82rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.video-sub .yt-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--red);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.8rem;
  margin-top: 0.25rem;
  width: fit-content;
}

.video-sub .yt-link:hover { text-decoration: underline; }

/* ── Download panels ── */
.panels-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.panel-header {
  padding: 0.8rem 1.1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 0.88rem;
  background: var(--surface2);
}

.panel-header .icon { font-size: 1rem; }

.badge-rec {
  margin-left: auto;
  background: var(--red-glow);
  color: var(--red);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  border: 1px solid rgba(255,45,45,0.3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ── Format rows ── */
.format-row {
  display: flex;
  align-items: center;
  padding: 0.65rem 1.1rem;
  border-bottom: 1px solid var(--border);
  gap: 0.6rem;
  transition: background 0.1s;
}

.format-row:last-child { border-bottom: none; }
.format-row:hover { background: var(--surface2); }

.format-row.is-rec {
  background: rgba(255,45,45,0.04);
  border-left: 2px solid var(--red);
}

.format-row.is-rec:hover { background: rgba(255,45,45,0.08); }

.fmt-label {
  font-weight: 600;
  font-size: 0.82rem;
  min-width: 110px;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.fmt-label .star {
  color: var(--red);
  font-size: 0.65rem;
}

.fmt-meta {
  color: var(--muted);
  font-size: 0.75rem;
  flex: 1;
  line-height: 1.4;
}

.dl-btn {
  background: var(--surface3);
  color: var(--text);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 0.38rem 0.85rem;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
  text-decoration: none;
  display: inline-block;
  font-family: inherit;
}

.dl-btn:hover {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.dl-btn.loading {
  opacity: 0.6;
  pointer-events: none;
}

/* ── Back link ── */
.back-link {
  display: flex;
  justify-content: center;
  padding: 1.5rem 0 0.5rem;
}

.back-link a {
  color: var(--muted);
  font-size: 0.82rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: color 0.15s;
}

.back-link a:hover { color: var(--text2); }

/* ══════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════ */
@media (max-width: 700px) {
  .panels-grid { grid-template-columns: 1fr; }

  .video-card { flex-direction: column; }
  .video-thumb-wrap { width: 100%; aspect-ratio: 16/9; }

  .navbar .search-wrap { display: none; }

  .features { gap: 0; }
  .feature-item { padding: 0.4rem 0.7rem; font-size: 0.78rem; }
}

@media (max-width: 480px) {
  .hero-title { font-size: 1.9rem; }
  .hero-form { border-radius: var(--radius-sm); }
  .watch-layout { padding: 0 0.75rem 2rem; }
}
