/* steadyOne app.css — new UI components, loaded AFTER style.css. */

/* ========== HEADER — force LTR so RTL never mirrors it ========== */
header, .navbar {
  direction: ltr;
}

/* ========== Header tools (search + language) ========== */
/* FIXED: order 4 = stays beside auth/profile icon (order 5), AFTER followed cats (order 3) */
.header-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 8px 0 4px;
  order: 4 !important;
}
.header-icon-btn {
  background: transparent;
  border: none;
  color: var(--text, #fff);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .2s, color .2s;
  font-size: 15px;
}
.header-icon-btn:hover { background: rgba(255,255,255,.1); color: var(--accent); }
.lang-current { font-size: 10px; font-weight: 700; margin-left: 4px; }

.auth-buttons       { order: 5 !important; }

/* ========== Active nav link (yellow) ========== */
.nav-links a { position: relative; }
.nav-links a.active { color: var(--accent) !important; }
.nav-links a.active::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -6px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}

/* ========== HERO — guarantee visible area + slide fill ========== */
.hero {
  position: relative;
  height: 70vh;
  min-height: 420px;
  overflow: hidden;
  background: linear-gradient(135deg, #0a0a12 0%, #1a1a2e 55%, #2a1a3e 100%);
}
.hero-slider {
  position: relative;
  width: 100%;
  height: 100%;
}
.hero .slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #0a0a12 0%, #1a1a2e 55%, #2a1a3e 100%);
}
.hero .slide.active { z-index: 2; }
.hero .slide-background {
  position: absolute;
  inset: 0;
  background-color: #0a0a12;
}
.hero .desktop-image,
.hero .mobile-image {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.hero .mobile-image { display: none; }
.hero .slide-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(10,10,18,.95) 0%, rgba(10,10,18,.35) 45%, transparent 100%);
  z-index: 1;
}
.hero .slide-content {
  position: absolute;
  bottom: 80px;
  left: 40px;
  right: 40px;
  max-width: 620px;
  z-index: 2;
  color: #fff;
}
.hero .slide-content h2 {
  font-size: clamp(1.6rem, 3.2vw, 2.8rem);
  font-weight: 700;
  margin: 0 0 12px;
  line-height: 1.15;
  text-shadow: 0 2px 16px rgba(0,0,0,.65);
}
.hero .slide-content p {
  font-size: clamp(.95rem, 1.4vw, 1.15rem);
  color: #d8d8e0;
  margin: 0 0 22px;
  line-height: 1.55;
  text-shadow: 0 1px 8px rgba(0,0,0,.6);
}
@media (max-width: 768px) {
  .hero { height: 60vh; min-height: 360px; }
  .hero .slide-content {
    bottom: 60px; left: 20px; right: 20px; text-align: center;
  }
  .hero .desktop-image { display: none; }
  .hero .mobile-image { display: block; }
}

/* ========== Language menu ========== */
.lang-menu {
  position: fixed;
  top: 72px;
  right: 20px;
  background: var(--card-bg, #1a1a2e);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  min-width: 160px;
  box-shadow: 0 12px 32px rgba(0,0,0,.55);
  z-index: 10050;
}
.lang-menu[hidden] { display: none; }
.lang-menu button {
  background: transparent;
  border: none;
  color: var(--text, #fff);
  text-align: left;
  padding: 10px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background .2s, color .2s;
}
.lang-menu button:hover { background: var(--accent); color: #000; }
body.rtl .lang-menu { right: auto; left: 20px; }

/* ========== Search overlay ========== */
body.search-open { overflow: hidden; }
.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8,8,14,.97);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 10040;
  padding: 24px;
  overflow-y: auto;
}
.search-overlay[hidden] { display: none; }
.search-overlay-header {
  display: flex; gap: 14px;
  max-width: 1000px; margin: 0 auto 30px;
}
.search-input-wrap {
  flex: 1;
  display: flex; align-items: center; gap: 12px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 50px;
  padding: 12px 20px;
  transition: border-color .2s;
}
.search-input-wrap:focus-within { border-color: var(--accent); }
.search-input-wrap > i { color: var(--text-secondary, #aaa); font-size: 17px; }
.search-input-wrap input {
  flex: 1; background: transparent; border: none;
  color: var(--text, #fff); font-size: 17px; outline: none; padding: 6px 0;
}
.search-clear {
  background: transparent; border: none; color: var(--text-secondary, #aaa);
  cursor: pointer; font-size: 16px; padding: 4px;
}
.search-clear:hover { color: var(--accent); }
.search-close {
  background: rgba(255,255,255,.1); border: none; color: #fff;
  padding: 12px 22px; border-radius: 50px; font-weight: 600;
  cursor: pointer; transition: background .2s, color .2s;
}
.search-close:hover { background: var(--accent); color: #000; }
.search-results { max-width: 1200px; margin: 0 auto; }
.search-loading { display: flex; justify-content: center; padding: 60px 0; }
.search-empty {
  text-align: center; color: var(--text-secondary, #bbb);
  padding: 60px 20px; font-size: 17px;
}

/* ========== CSS spinner ========== */
.loading-spinner {
  width: 40px; height: 40px;
  border: 4px solid rgba(255,255,255,.12);
  border-top-color: var(--accent, #ff003c);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 24px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ========== Category pills ========== */
.category-bar { padding: 18px 0 8px; }
.category-pills {
  display: flex; gap: 10px; overflow-x: auto;
  padding: 4px 2px;
  scrollbar-width: none; -ms-overflow-style: none;
}
.category-pills::-webkit-scrollbar { display: none; }
.category-pill {
  flex: 0 0 auto;
  padding: 9px 20px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 50px;
  color: var(--text, #fff);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: background .2s, color .2s, border-color .2s;
}
.category-pill:hover { background: var(--accent); border-color: var(--accent); color: #000; }

/* ========== Section body + hover arrows ========== */
.section-body { position: relative; }
.section-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%) scale(.95);
  width: 52px; height: 52px;
  background: rgba(0,0,0,.72);
  color: #fff;
  border: none;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  z-index: 40;
  font-size: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s, background .2s, color .2s;
}
.section:hover .section-arrow { opacity: 1; pointer-events: auto; }
.section-arrow:hover {
  background: var(--accent); color: #000;
  transform: translateY(-50%) scale(1.08);
}
.section-arrow.prev { left: 12px; }
.section-arrow.next { right: 12px; }
body.rtl .section-arrow.prev { right: 12px; left: auto; }
body.rtl .section-arrow.next { left: 12px; right: auto; }

/* ========== Poster grid ========== */
.poster-grid {
  display: flex; gap: 4px;
  overflow-x: auto; padding: 8px 2px;
  scrollbar-width: none; -ms-overflow-style: none;
}
.poster-grid::-webkit-scrollbar { display: none; }
.poster-card {
  flex: 0 0 auto; width: 170px;
  color: inherit; text-decoration: none;
  transition: transform .25s ease;
}
.poster-card:hover { transform: translateY(-3px); }
.poster-card .poster-img {
  position: relative; width: 100%; aspect-ratio: 2 / 3;
  border-radius: 10px; overflow: hidden; background: #16161e;
}
.poster-card .poster-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.poster-card .poster-title {
  margin-top: 8px; font-size: 13px; font-weight: 500;
  color: var(--text, #fff);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ========== Top 10 ========== */
.top10-card {
  display: flex; align-items: flex-end;
  flex: 0 0 auto; width: 300px;
  text-decoration: none; color: inherit;
}
.top10-rank {
  font-family: 'Poppins', sans-serif;
  font-size: 96px; line-height: .85; font-weight: 900;
  color: #fff;
  -webkit-text-stroke: 3px #000;
  text-shadow: 3px 3px 0 rgba(255,0,60,.28);
  margin-right: -18px; z-index: 2;
}
.top10-card .card-img {
  width: 190px; flex: 0 0 190px; aspect-ratio: 2 / 3;
  border-radius: 10px; overflow: hidden; z-index: 1;
}
.top10-card .card-img img { width: 100%; height: 100%; object-fit: cover; }
body.rtl .top10-rank { margin-right: 0; margin-left: -18px; }

/* ========== Card size modifiers ========== */
.stream-card.card-sm { width: 220px !important; }
.stream-card.card-lg { width: 360px !important; }

/* ========== RTL — content direction only (NOT header) ========== */
body.rtl { direction: rtl; }
body.rtl .header-tools { margin: 0 12px 0 4px; }

/* ========== Tablet ========== */
@media (max-width: 992px) {
  .header-tools { gap: 4px; margin: 0 4px; }
  .header-icon-btn { width: 36px; height: 36px; font-size: 14px; }
  .lang-current { display: none; }
}

/* ========== Mobile — keep visual order: [hamburger][logo][followed][tools][auth] ========== */
@media (max-width: 768px) {
  .nav-links {
    position: fixed; inset: 0;
    background: rgba(8,8,14,.98);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 26px;
    z-index: 10030;
    transform: translateX(-100%);
    transition: transform .3s ease;
    padding: 40px; margin: 0;
  }
  .nav-links.active { transform: translateX(0); }
  .nav-links a { font-size: 22px; }
  .hamburger { z-index: 10035; }
  .hamburger span { transition: transform .25s, opacity .2s; }
  .hamburger.active span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
  .hamburger.active span:nth-child(2) { opacity: 0; }
  .hamburger.active span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

  .section-arrow { display: none !important; }
  .search-overlay-header { flex-direction: column; }
  .search-close { align-self: flex-end; }

  /* FIXED: tools now sit beside auth/profile icon */
  .header-tools {
    order: 4 !important;
    margin: 0 4px !important;
    gap: 0 !important;
  }
  .header-icon-btn {
    width: 30px !important;
    height: 30px !important;
    font-size: 12px !important;
  }
  .lang-current { display: none !important; }

  .auth-buttons {
    order: 5 !important;
    display: flex !important;
    margin-left: 0 !important;
    gap: 4px !important;
  }
  .auth-buttons .btn {
    padding: 6px 10px !important;
    font-size: 10px !important;
  }

  .search-results .stream-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    overflow-x: visible; gap: 0;
  }
  .search-results .stream-card { width: auto !important; }

  .category-nav-btn, .search-nav { display: none !important; }
}

/* ============================================================ */
/* steadyOne — scrolling arrow buttons (category bar + search)   */
/* ============================================================ */
.category-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.category-bar-wrap #category-pills { flex: 1; min-width: 0; }
.category-nav-btn {
  flex: 0 0 auto;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.18);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .2s, color .2s, transform .2s;
  font-size: 12px;
}
.category-nav-btn:hover {
  background: var(--accent); color: #000; transform: scale(1.05);
}
.category-nav-btn:disabled { opacity: .35; cursor: not-allowed; transform: none; }

.search-nav {
  display: flex; gap: 8px;
  justify-content: flex-end;
  margin-bottom: 12px;
}
.search-nav-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.18);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .2s, color .2s;
  font-size: 14px;
}
.search-nav-btn:hover { background: var(--accent); color: #000; }
.search-nav-btn:disabled { opacity: .35; cursor: not-allowed; }
.search-results .stream-grid { overflow-x: auto; scroll-behavior: smooth; }

@media (max-width: 768px) {
  .category-nav-btn, .search-nav { display: none !important; }
}

/* ============================================================ */
/* STEADYONE — MOBILE FIX PASS (arrows, search, header)         */
/* ============================================================ */

@media (max-width: 768px) {
  /* 1. Kill EVERY scrolling arrow variant on mobile */
  .stream-nav,
  .stream-nav-btn,
  .section-arrow,
  .search-nav,
  .search-nav-btn,
  .category-nav-btn {
    display: none !important;
  }

  /* 2. Hide header siblings when the menu is open so no white buttons peek out */
  .nav-links.active ~ .auth-buttons,
  .nav-links.active ~ .header-tools {
    display: none !important;
  }

  /* 3. Menu must be fully opaque and cover the viewport */
  .nav-links {
    background: #08080e !important;
    width: 100% !important;
    left: 0 !important;
    right: 0 !important;
    height: 100vh !important;
    top: 0 !important;
    bottom: 0 !important;
    transform: translateX(-100%);
    padding-top: 80px;
  }
  .nav-links.active {
    transform: translateX(0);
  }

  /* 4. Search results — clean 2-column grid of horizontal thumbnails */
  .search-results {
    padding: 0 12px 24px;
  }
  .search-results .stream-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0 !important;
    overflow-x: visible !important;
    padding: 0 !important;
    width: 100% !important;
  }
  .search-results .stream-card {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    flex: none !important;
    transform: none !important;
    margin: 0 !important;
  }
  .search-results .stream-card:hover {
    transform: translateY(-3px) !important;
  }
  .search-results .card-img {
    height: auto !important;
    aspect-ratio: 16 / 9 !important;
  }
  .search-results .card-title {
    font-size: 12px !important;
    line-height: 1.25 !important;
  }
  .search-results .card-meta {
    font-size: 10px !important;
  }
}

/* ============================================================ */
/* HAMBURGER FIX — remove white square/dot + tap highlight      */
/* Covers: native button bg, tap-highlight, focus outline,      */
/* middle-bar sliver, and UA button chrome.                     */
/* ============================================================ */
.hamburger,
.hamburger:hover,
.hamburger:focus,
.hamburger:active,
.hamburger:focus-visible {
  background: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  -webkit-tap-highlight-color: transparent !important;
  -webkit-touch-callout: none !important;
  touch-action: manipulation !important;
}

/* Keep a visible focus ring for keyboard users (accessibility), */
/* but suppress it for touch/mouse activation.                  */
.hamburger:focus-visible {
  outline: 2px solid var(--accent) !important;
  outline-offset: 2px !important;
  border-radius: 4px !important;
}

/* Cleanly collapse the middle bar when the menu is open,       */
/* so no white sliver/dot lingers near the left edge.           */
.hamburger.active span:nth-child(2) {
  opacity: 0 !important;
  left: 0 !important;
  transform: scaleX(0) !important;
  visibility: hidden !important;
}

/* Optional safety net — suppress tap-flash on all header controls */
header button,
header .header-icon-btn,
header .user-btn,
header .hamburger {
  -webkit-tap-highlight-color: transparent !important;
  -webkit-touch-callout: none !important;
}

/* ============================================================ */
/* FIXED: add breathing room between hamburger and logo (mobile) */
/* ============================================================ */
@media (max-width: 768px) {
  .hamburger {
    margin-right: 8px !important;
  }
  .logo {
    margin-left: 0 !important;
  }
}

/* ============================================================ */
/* FIXED: Make .loading-spinner visible everywhere (pure CSS)   */
/* style.css hides it with display:none !important — override.  */
/* Loaded after style.css so this wins.                         */
/* ============================================================ */
.loading-spinner {
  display: block !important;
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--accent, #F3FF05);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 24px auto;
}
/* Poster card size variants (used by sections with card_size set) */
.poster-card.card-sm { width: 130px; }
.poster-card.card-lg { width: 230px; }
