/* ════════════════════════════════════════════════════════════════════════
   FinalVerse — Mobile Responsive CSS
   ────────────────────────────────────────────────────────────────────
   Comprehensive mobile + tablet styles. Override the desktop layout
   when viewport is ≤ 768px (tablet) and ≤ 480px (phone).

   Load AFTER all other CSS in index.html:
     <link rel="stylesheet" href="./css/fv-mobile.css">
   ════════════════════════════════════════════════════════════════════════ */


/* ────────────────────────────────────────────────────────────────────
   TABLET (≤ 768px) — comfortable single-hand use
   ──────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {

  /* ─── Navbar ─── */
  #main-nav {
    padding: .6rem .8rem !important;
    flex-wrap: wrap;
    gap: .4rem;
  }
  .logo {
    font-size: 1rem !important;
  }
  .logo svg {
    width: 28px !important;
    height: 28px !important;
  }
  .nav-pill {
    padding: .35rem .65rem !important;
    font-size: .78rem !important;
  }
  .nav-right {
    margin-left: auto;
    gap: .35rem !important;
  }
  .search-wrap {
    width: 100%;
    order: 99;
    margin-top: .4rem;
  }
  .search-wrap input,
  #searchInput {
    width: 100% !important;
    box-sizing: border-box;
    font-size: .86rem;
  }

  /* ─── Hero section ─── */
  #hero, .hero {
    min-height: 65vh !important;
    padding: 1rem !important;
  }
  .hero-title, #hero-title {
    font-size: 2rem !important;
    line-height: 1.05;
  }
  .hero-meta {
    flex-wrap: wrap;
    gap: .4rem .7rem !important;
  }
  .hero-overview, #hero-overview {
    font-size: .82rem !important;
    -webkit-line-clamp: 3;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .hero-btns {
    flex-wrap: wrap;
    gap: .5rem !important;
  }
  .hero-btns button {
    flex: 1 1 auto;
    min-width: 110px;
    font-size: .82rem !important;
    padding: .55rem 1rem !important;
  }
  .hero-dots {
    bottom: .8rem !important;
    right: 1rem !important;
  }

  /* ─── Category tabs (Home / Recently / Top / etc.) ─── */
  #cat-tabs-bar {
    padding: .5rem .8rem !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  #cat-tabs-bar::-webkit-scrollbar { display: none; }
  .cat-tab-btn {
    font-size: .76rem !important;
    padding: .45rem .8rem !important;
    flex-shrink: 0;
  }

  /* ─── Home rows ─── */
  .home-row {
    padding: 0 .8rem !important;
  }
  .home-row-title {
    font-size: 1rem !important;
    padding-bottom: .3rem !important;
  }
  .home-row-track {
    gap: .5rem !important;
  }
  .home-card {
    flex: 0 0 130px !important;
    width: 130px !important;
  }
  .home-card img {
    height: 195px !important;
  }
  .home-card-title {
    font-size: .76rem !important;
  }
  .see-all-btn, .home-row-see-all {
    font-size: .72rem !important;
    padding: .25rem .55rem !important;
  }

  /* ─── Category grid pages (Recently, Top Rated, etc.) ─── */
  #view-recent, #view-row-full, #view-all, #view-allseries, #view-soon, #view-search, #view-browse {
    padding: 1rem .8rem 3rem !important;
  }
  .cat-header {
    flex-wrap: wrap !important;
    gap: .5rem !important;
    margin-bottom: 1rem !important;
  }
  .cat-title {
    font-size: 1.3rem !important;
    letter-spacing: 1.5px !important;
  }
  .cat-back-btn {
    font-size: .8rem !important;
    padding: .35rem .7rem !important;
  }
  .cat-count {
    font-size: .72rem !important;
  }
  .cat-filters {
    width: 100%;
    order: 99;
  }

  /* ─── Filter pills ─── */
  .sf-trigger {
    font-size: .72rem !important;
    padding: .35rem .55rem !important;
  }

  /* ─── Card grid (3 columns on tablet) ─── */
  .card-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: .6rem !important;
  }
  .row-card {
    width: auto !important;
  }
  .row-card img {
    height: 220px !important;
  }
  .row-card-title {
    font-size: .76rem !important;
  }
  .row-card-meta {
    font-size: .7rem !important;
  }

  /* ─── Modal / Detail page ─── */
  .modal-content, #modal-overlay .modal-content {
    width: 95% !important;
    max-width: 95% !important;
    max-height: 92vh !important;
    margin: 1rem !important;
  }
  .detail-hero {
    min-height: 35vh !important;
  }
  .detail-title {
    font-size: 1.6rem !important;
  }
  .detail-overview {
    font-size: .84rem !important;
  }
  .detail-meta {
    flex-wrap: wrap;
    gap: .4rem !important;
  }
  .detail-actions {
    flex-wrap: wrap !important;
    gap: .5rem !important;
  }
  .detail-actions button {
    flex: 1 1 auto;
    min-width: 100px;
    font-size: .8rem !important;
  }

  /* ─── Watch page ─── */
  #watch-page {
    padding: 0 !important;
  }
  .wp-sidebar {
    width: 100% !important;
    max-height: 40vh !important;
    overflow-y: auto;
  }
  .wp-main {
    width: 100% !important;
  }
  .wp-iframe-wrap {
    aspect-ratio: 16/9;
    width: 100%;
  }

  /* ─── Admin panel — make it usable on mobile ─── */
  #admin-overlay .adm-container,
  .adm-container {
    flex-direction: column !important;
  }
  .adm-sidebar {
    width: 100% !important;
    max-height: 200px !important;
    overflow-y: auto;
    border-right: none !important;
    border-bottom: 1px solid rgba(255,255,255,.1) !important;
  }
  .adm-nav-item {
    padding: .55rem .8rem !important;
    font-size: .8rem !important;
  }
  .adm-content {
    padding: 1rem !important;
  }
  .adm-card {
    padding: .9rem !important;
  }
  .adm-card-title {
    font-size: 1rem !important;
  }
  .adm-kv-row {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  .adm-kv-label {
    width: 100% !important;
    margin-bottom: .3rem;
  }
  .adm-kv-input {
    width: 100% !important;
    box-sizing: border-box;
  }
  .adm-btn-row {
    flex-wrap: wrap;
    gap: .4rem !important;
  }
  .adm-btn {
    font-size: .8rem !important;
    padding: .45rem .8rem !important;
  }

  /* ─── Hero admin Picker controls (Batch 1) ─── */
  .fv-ct-tab, .fv-lay-tab {
    font-size: .76rem !important;
    padding: .4rem .7rem !important;
  }

  /* ─── Sort buttons in row-full pages ─── */
  .rf-sort-group {
    margin-left: 0 !important;
    padding-left: 0 !important;
    width: 100%;
    margin-top: .5rem;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  /* ─── Maintenance overlay ─── */
  #fv-maintenance-overlay h1 {
    font-size: 1.8rem !important;
  }
  #fv-maint-login-box {
    padding: 1.2rem !important;
  }

  /* ─── AI chat panel ─── */
  #fv-ai-chat-panel {
    bottom: 80px !important;
    right: 12px !important;
    left: 12px !important;
    width: auto !important;
    max-width: none !important;
    height: 70vh !important;
  }
  #fv-ai-chat-btn {
    bottom: 16px !important;
    right: 16px !important;
    width: 48px !important;
    height: 48px !important;
    font-size: 1.3rem !important;
  }
}


/* ────────────────────────────────────────────────────────────────────
   PHONE (≤ 480px) — compact, single-thumb friendly
   ──────────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {

  /* ─── Navbar — even tighter ─── */
  .logo span:not(.logo-icon) {
    display: none;  /* hide text logo on phone, keep icon */
  }
  #main-nav {
    padding: .5rem .6rem !important;
  }
  .nav-pill {
    padding: .3rem .55rem !important;
    font-size: .74rem !important;
  }

  /* ─── Hero — smaller still ─── */
  #hero, .hero {
    min-height: 55vh !important;
  }
  .hero-title, #hero-title {
    font-size: 1.6rem !important;
  }
  .hero-overview, #hero-overview {
    -webkit-line-clamp: 2;
  }

  /* ─── Cards: 2 columns on phone ─── */
  .card-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .row-card img {
    height: 260px !important;
  }

  /* ─── Home row cards smaller ─── */
  .home-card {
    flex: 0 0 110px !important;
    width: 110px !important;
  }
  .home-card img {
    height: 165px !important;
  }

  /* ─── Detail/Modal — full-screen ─── */
  .modal-content, #modal-overlay .modal-content {
    width: 100% !important;
    height: 100vh !important;
    max-width: 100% !important;
    max-height: 100vh !important;
    margin: 0 !important;
    border-radius: 0 !important;
  }
  .detail-title {
    font-size: 1.4rem !important;
  }

  /* ─── Cat title smaller ─── */
  .cat-title {
    font-size: 1.1rem !important;
  }

  /* ─── Pager smaller ─── */
  .pager button {
    padding: .35rem .6rem !important;
    font-size: .75rem !important;
  }

  /* ─── Reduce padding everywhere ─── */
  #view-recent, #view-row-full, #view-all, #view-allseries, #view-soon, #view-search, #view-browse {
    padding: .8rem .6rem 2.5rem !important;
  }
  .home-row {
    padding: 0 .6rem !important;
  }
}


/* ────────────────────────────────────────────────────────────────────
   TOUCH UX improvements (any size with touch)
   ──────────────────────────────────────────────────────────────────── */
@media (hover: none) and (pointer: coarse) {
  /* Larger tap targets */
  button, .nav-pill, .cat-tab-btn, .row-card {
    min-height: 36px;
  }

  /* Remove hover-only effects that don't translate to touch */
  .row-card:hover {
    transform: none;
  }

  /* Smooth scroll for swiping rows */
  .home-row-track {
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
  }
  .home-card {
    scroll-snap-align: start;
  }
}


/* ────────────────────────────────────────────────────────────────────
   FIX: prevent horizontal scrollbar on small viewports
   ──────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  html, body {
    overflow-x: hidden;
    max-width: 100vw;
  }
}

/* ────────────────────────────────────────────────────────────────────
   Gradient fade on cat-tabs-bar right edge — signals hidden overflow
   ──────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  #cat-tabs-bar {
    position: relative;
    -webkit-mask-image: linear-gradient(to right, black 85%, transparent 100%);
    mask-image: linear-gradient(to right, black 85%, transparent 100%);
  }
}

/* ────────────────────────────────────────────────────────────────────
   SVG icon alignment inside cat-tab, wf-btn buttons on mobile
   ──────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .cat-tab {
    display: inline-flex !important;
    align-items: center;
    gap: .35rem;
  }
  .cat-tab svg {
    flex-shrink: 0;
    width: 12px;
    height: 12px;
  }
  .wf-btn {
    display: inline-flex !important;
    align-items: center;
    gap: .3rem;
  }
  .stat-item svg {
    flex-shrink: 0;
  }
}
