/* ============================================================
   mobile.css — TovHost Mobile UI v2 (clean rewrite)
   Single source of truth for mobile (≤768px) navigation.
   ============================================================ */

/* ── Page-level: lock horizontal scroll always ── */
html, body {
  max-width: 100vw !important;
  overflow-x: hidden !important;
}

@media (max-width: 768px) {

  /* ────────────────────────────────────────────────
     1) NAV BAR — only logo + hamburger
     ──────────────────────────────────────────────── */
  nav {
    width: 100% !important;
    max-width: 100vw !important;
    overflow: visible !important;
  }

  nav .nav-inner {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    grid-template-columns: none !important;
    height: 58px !important;
    padding: 0 14px !important;
    width: 100% !important;
    max-width: 100% !important;
    gap: 8px !important;
    box-sizing: border-box !important;
  }

  nav .logo {
    flex: 0 0 auto !important;
    justify-self: start !important;
    font-size: 1rem !important;
    letter-spacing: 1.5px !important;
  }

  nav .logo img,
  nav .logo img.logo-img {
    height: 28px !important;
    max-width: 120px !important;
  }

  nav .nav-links {
    display: none !important;
  }

  /* HIDE everything in nav-actions except the hamburger */
  nav .nav-actions {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-end !important;
    flex: 0 0 auto !important;
    gap: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
  }

  nav .nav-actions > *:not(.tov-mobile-btn) {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    position: absolute !important;
    left: -99999px !important;
    pointer-events: none !important;
  }

  /* Specific overrides for IDs that get inline styles set by JS */
  html body #loginBtn,
  html body #accDropdown,
  html body #cartBtn,
  html body #_nb_wrap,
  html body nav .mobile-menu-btn,
  html body .mobile-menu-btn,
  html body nav .nav-btn,
  html body nav .nav-btn-primary,
  html body nav .nav-btn-outline,
  html body nav .cart-pill,
  html body nav .acc-dropdown,
  html body nav .acc-trigger {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    position: absolute !important;
    left: -99999px !important;
    pointer-events: none !important;
    width: 0 !important;
    height: 0 !important;
  }

  /* Hide the legacy mm-drawer / mobile-menu-btn made by old nav.js */
  body > .mm-drawer,
  body > .mm-overlay,
  .mobile-menu-btn:not(.tov-mobile-btn) {
    display: none !important;
  }

  /* Hide notification panel popup on mobile (notifs live in drawer) */
  html body #_nb_panel {
    display: none !important;
  }

  /* ────────────────────────────────────────────────
     2) HAMBURGER BUTTON
     ──────────────────────────────────────────────── */
  .tov-mobile-btn {
    display: flex !important;
    width: 42px !important;
    height: 38px !important;
    border-radius: 10px !important;
    background: rgba(0, 101, 255, 0.10) !important;
    border: 1px solid rgba(0, 101, 255, 0.30) !important;
    color: #3384ff !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
    position: relative !important;
    overflow: visible !important;
    transition: all 0.18s ease !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .tov-mobile-btn:active {
    transform: scale(0.94) !important;
    background: rgba(0, 101, 255, 0.18) !important;
  }

  /* Red dot for notifications (legacy — kept for fallback) */
  .tov-mobile-btn .tov-mb-dot {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #ef4444;
    border: 2px solid #171b29;
    display: none;
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6);
    animation: tov-pulse 2s infinite;
  }

  /* Hide the dot when numeric count is visible (unified badge takes priority) */
  .tov-mobile-btn.has-notif .tov-mb-dot {
    display: block;
  }
  .tov-mobile-btn.has-count .tov-mb-dot {
    display: none !important;
  }

  /* Unified numeric badge: notifications + cart + tickets all combined */
  .tov-mobile-btn .tov-mb-count {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: #ef4444;
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    line-height: 1;
    display: none;
    align-items: center;
    justify-content: center;
    border: 2px solid #171b29;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.45),
                0 0 0 0 rgba(239, 68, 68, 0.55);
    animation: tov-pulse 2s infinite;
    pointer-events: none;
    z-index: 2;
  }

  @keyframes tov-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.55); }
    70%  { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
  }

  /* ────────────────────────────────────────────────
     3) HERO / SECTIONS — prevent overflow
     ──────────────────────────────────────────────── */
  .hero,
  .hero-container,
  section,
  .section,
  .container,
  .wrap,
  main,
  footer,
  header {
    max-width: 100vw !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
  }

  body > * {
    max-width: 100vw !important;
  }

  img, video, iframe, svg, canvas {
    max-width: 100% !important;
    height: auto;
  }

  /* Override: SVG icons inside our mobile drawer must keep explicit sizes */
  .tov-drawer svg,
  .tov-mobile-btn svg {
    max-width: none !important;
    height: auto;
  }
  .tov-drawer .tov-logout svg,
  .tov-drawer .tov-cta-primary svg,
  .tov-drawer .tov-cta-secondary svg,
  .tov-drawer .tov-cart svg,
  .tov-drawer .tov-link svg,
  .tov-drawer .tov-dh svg {
    width: 18px !important;
    height: 18px !important;
    max-width: 18px !important;
    flex-shrink: 0;
  }
  .tov-drawer .tov-dh-close svg {
    width: 16px !important;
    height: 16px !important;
    max-width: 16px !important;
  }
  .tov-drawer .tov-dh-logo-icon svg {
    width: 14px !important;
    height: 14px !important;
    max-width: 14px !important;
  }
  .tov-mobile-btn svg {
    width: 18px !important;
    height: 18px !important;
    max-width: 18px !important;
  }
}

/* On screens larger than mobile, hide our mobile button completely */
@media (min-width: 769px) {
  .tov-mobile-btn,
  .tov-drawer,
  .tov-overlay {
    display: none !important;
  }
}

/* ============================================================
   4) DRAWER + OVERLAY (fixed positioned, body-level)
   ============================================================ */

.tov-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 18, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  z-index: 9998;
  pointer-events: none;
}

.tov-overlay.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.tov-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 85vw;
  max-width: 340px;
  background: #1f2333;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: -16px 0 50px rgba(0, 0, 0, 0.6);
  transform: translateX(105%);
  transition: transform 0.30s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  font-family: var(--font-main, 'Inter', sans-serif);
}

.tov-drawer.open {
  transform: translateX(0);
}

/* ── Drawer Header ── */
.tov-dh {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.tov-dh-user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.tov-dh-avatar {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  object-fit: cover;
  background: linear-gradient(135deg, #1d9e75, #0f6e56);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.tov-dh-name {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.tov-dh-name-main {
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.tov-dh-name-sub {
  color: #6b7280;
  font-size: 10px;
  font-weight: 500;
}

.tov-dh-logo {
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.tov-dh-logo-icon {
  width: 24px;
  height: 24px;
  background: #0065ff;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tov-dh-logo-text {
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
}

.tov-dh-logo-text .acc {
  color: #3384ff;
}

.tov-dh-close {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #9fa6c1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
  padding: 0;
}

.tov-dh-close:active {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}

/* ── Drawer Body (scrollable) ── */
.tov-db {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tov-db::-webkit-scrollbar {
  width: 4px;
}
.tov-db::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
}

/* ── Cart pill (top of drawer) ── */
.tov-cart {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  background: rgba(0, 101, 255, 0.10);
  border: 1px solid rgba(0, 101, 255, 0.28);
  border-radius: 10px;
  margin: 4px 0 8px;
  text-decoration: none;
}

.tov-cart.show {
  display: flex;
}

.tov-cart-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #3384ff;
  font-size: 13px;
  font-weight: 600;
}

.tov-cart-count {
  background: #0065ff;
  color: #fff;
  padding: 2px 9px;
  border-radius: 11px;
  font-size: 11px;
  font-weight: 700;
}

/* ── Section header ── */
.tov-sec {
  padding: 10px 10px 4px;
  font-size: 10px;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tov-sec-badge {
  background: #ef4444;
  color: #fff;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  display: none;
}

.tov-sec-badge.show {
  display: inline-block;
}

/* ── Drawer link ── */
.tov-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  border-radius: 9px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
  min-height: 44px;
  position: relative;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  width: 100%;
  box-sizing: border-box;
}

.tov-link:active {
  background: rgba(0, 101, 255, 0.12);
}

.tov-link.active {
  background: rgba(0, 101, 255, 0.12);
  color: #5498ff;
}

.tov-link svg,
.tov-link .tov-link-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  opacity: 0.85;
}

.tov-link-label {
  flex: 1;
}

.tov-link-meta {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}

.tov-link-meta.green {
  color: #22c55e;
}

.tov-link-meta.badge {
  background: #f59e0b;
  color: #fff;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 10px;
}

.tov-link-meta.badge-red {
  background: #ef4444;
}

/* ── Notification cards inside drawer ── */
.tov-notif-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 0 2px;
}

.tov-notif {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  padding: 9px 11px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  text-decoration: none;
  transition: background 0.15s ease;
}

.tov-notif:active {
  background: rgba(0, 101, 255, 0.10);
}

.tov-notif.warning {
  background: rgba(245, 158, 11, 0.06);
  border-color: rgba(245, 158, 11, 0.20);
}

.tov-notif.danger {
  background: rgba(239, 68, 68, 0.06);
  border-color: rgba(239, 68, 68, 0.20);
}

.tov-notif-icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: rgba(0, 101, 255, 0.18);
  color: #3384ff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.tov-notif.warning .tov-notif-icon {
  background: rgba(245, 158, 11, 0.20);
  color: #f59e0b;
}

.tov-notif.danger .tov-notif-icon {
  background: rgba(239, 68, 68, 0.20);
  color: #ef4444;
}

.tov-notif-body {
  flex: 1;
  min-width: 0;
}

.tov-notif-title {
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.tov-notif-time {
  color: #6b7280;
  font-size: 10px;
}

.tov-notif-empty {
  text-align: center;
  padding: 18px 10px;
  color: #6b7280;
  font-size: 12px;
}

/* ── Drawer Footer ── */
.tov-df {
  padding: 10px 14px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tov-cta-primary {
  background: #0065ff;
  color: #fff;
  padding: 12px 14px;
  border-radius: 10px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 6px 20px rgba(0, 101, 255, 0.30);
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.15s ease;
}

.tov-cta-primary:active {
  transform: scale(0.98);
}

.tov-cta-secondary {
  background: transparent;
  color: #fff;
  padding: 11px 14px;
  border-radius: 10px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease;
}

.tov-cta-secondary:active {
  background: rgba(255, 255, 255, 0.05);
}

.tov-logout {
  color: #ef4444;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  border: none;
  background: transparent;
  font-family: inherit;
  text-align: left;
  border-radius: 9px;
  width: 100%;
  box-sizing: border-box;
}

.tov-logout:active {
  background: rgba(239, 68, 68, 0.10);
}

/* ── State toggling (guest vs logged in) ── */
.tov-drawer .tov-show-guest { display: flex; }
.tov-drawer .tov-show-user  { display: none; }

.tov-drawer.user .tov-show-guest { display: none; }
.tov-drawer.user .tov-show-user  { display: flex; }

/* Ensure section blocks honor the toggle */
.tov-drawer .tov-section.tov-show-guest,
.tov-drawer .tov-section.tov-show-user {
  flex-direction: column;
}

/* When not logged in, hide certain "user-only" things */
.tov-drawer:not(.user) .tov-cart,
.tov-drawer:not(.user) .tov-notif-section,
.tov-drawer:not(.user) .tov-account-section,
.tov-drawer:not(.user) .tov-logout {
  display: none !important;
}

/* When logged in, hide guest-only CTAs */
.tov-drawer.user .tov-guest-section {
  display: none !important;
}
