/* =====================================================================
   ZAPFLIX — DEDICATED MOBILE APP EXPERIENCE (v1)
   A separate, app-like phone UI layer (not just "shrunk desktop").
   Loaded after zapflix-liquid.css. Everything is gated behind mobile
   media queries, so desktop is untouched.
   ===================================================================== */

@media (max-width: 900px) {

  /* ---------- App chrome: compact glass top bar ---------- */
  .navbar {
    height: calc(56px + env(safe-area-inset-top, 0px)) !important;
    padding-top: env(safe-area-inset-top, 0px);
  }

  .navbar .logo {
    font-size: 21px !important;
  }

  /* ---------- Floating glass bottom tab bar (app style) ---------- */
  .zf-bottomnav {
    position: fixed !important;
    left: 14px !important;
    right: 14px !important;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px)) !important;
    width: auto !important;
    height: 62px !important;
    display: flex !important;
    align-items: center;
    justify-content: space-around;
    background: rgba(14, 14, 16, 0.74) !important;
    -webkit-backdrop-filter: blur(30px) saturate(180%) !important;
    backdrop-filter: blur(30px) saturate(180%) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 24px !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.09) !important;
    padding: 0 6px !important;
    z-index: 3000;
  }

  .zf-bottomnav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 48px;
    color: rgba(255, 255, 255, 0.60) !important;
    font-size: 10.5px !important;
    font-weight: 600 !important;
    letter-spacing: 0.01em;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.25s;
  }

  .zf-bottomnav a.active { color: #fff !important; }

  .zf-bottomnav .zf-ic {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 27px;
    border-radius: 14px;
    font-size: 16px;
    line-height: 1;
    transition: background 0.3s cubic-bezier(0.22, 0.8, 0.24, 1), box-shadow 0.3s, transform 0.3s;
  }

  .zf-bottomnav .zf-ic svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    display: block;
  }

  .zf-bottomnav a.active .zf-ic {
    background: linear-gradient(180deg, #f6121d, #c50812);
    box-shadow: 0 6px 18px rgba(229, 9, 20, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    color: #fff;
    transform: translateY(-1px);
  }

  body.zf-has-bottomnav {
    padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* ---------- Glass drawer (hamburger menu) ---------- */
  .zf-mnav-drawer {
    background: rgba(12, 12, 14, 0.82) !important;
    -webkit-backdrop-filter: blur(40px) saturate(190%) !important;
    backdrop-filter: blur(40px) saturate(190%) !important;
    border-inline-end: 1px solid rgba(255, 255, 255, 0.10) !important;
    box-shadow: 30px 0 80px rgba(0, 0, 0, 0.6) !important;
  }

  .zf-mnav-backdrop {
    background: rgba(0, 0, 0, 0.5) !important;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
  }

  .zf-mnav-links a {
    min-height: 48px;
    display: flex;
    align-items: center;
    border-radius: 12px;
    padding-inline: 14px;
    border-bottom: 0 !important;
    transition: background 0.2s;
  }

  .zf-mnav-links a:active,
  .zf-mnav-links a.active {
    background: rgba(229, 9, 20, 0.16);
    color: #fff;
  }

  /* ---------- Hero / billboard: cinematic mobile poster ---------- */
  .billboard-content .synopsis {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .billboard-buttons {
    display: flex;
    gap: 10px;
  }

  .billboard-buttons .btn {
    flex: 1;
    justify-content: center;
    min-height: 48px;
    font-size: 15px;
  }

  /* ---------- Rows: app-like snap carousels ---------- */
  .movie-row {
    scroll-snap-type: x proximity;
    scroll-padding-inline: 16px;
    scrollbar-width: none;
  }

  .movie-row::-webkit-scrollbar { display: none; }

  .movie-row .movie-card {
    scroll-snap-align: start;
  }

  /* ---------- Touch ergonomics ---------- */
  .btn,
  .btn-submit,
  .filter-btn,
  .tab-btn,
  .tab-button {
    min-height: 44px;
  }

  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="search"],
  input[type="url"],
  select,
  textarea {
    font-size: 16px !important; /* prevents iOS zoom-on-focus */
  }

  /* ---------- Content spacing ---------- */
  .content-section h2,
  .trending-section-header-left h2 {
    font-size: 19px;
  }

  .footer {
    padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px));
  }

  /* ---------- Modals become bottom sheets ---------- */
  .modal-content,
  .filter-modal {
    position: fixed !important;
    left: 10px !important;
    right: 10px !important;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px)) !important;
    top: auto !important;
    width: auto !important;
    max-width: none !important;
    max-height: 78vh !important;
    overflow-y: auto;
    border-radius: 22px !important;
    animation: zfSheetUp 0.35s cubic-bezier(0.22, 0.8, 0.24, 1);
  }

  @keyframes zfSheetUp {
    from { transform: translateY(40px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
  }

  /* ---------- Admin panel on phone ---------- */
  /* Admin pages use <div class="navbar"> (public site uses <nav class="navbar">),
     so this only affects admin: let the link row wrap instead of overflowing. */
  div.navbar {
    flex-wrap: wrap;
    height: auto !important;
    min-height: 52px;
    row-gap: 4px;
    padding: 10px 14px !important;
  }

  div.navbar a { white-space: nowrap; }

  .container {
    margin: 20px auto !important;
    padding: 0 14px !important;
  }

  .card { padding: 18px !important; }

  .header h1 { font-size: 24px !important; }

  .zf-table-scroll {
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.02);
  }

  .zf-table-scroll table { min-width: 640px; }

  /* ---------- Player on phone ---------- */
  .tbtn {
    min-width: 42px;
    min-height: 42px;
  }

  .sf-control-btn,
  .sf-ctrl-btn,
  .sf-top-btn {
    min-width: 44px !important;
    min-height: 44px !important;
  }

  .sf-progress-container {
    padding-top: 10px;
    padding-bottom: 10px;
  }
}

/* Small phones */
@media (max-width: 480px) {
  .navbar .logo { font-size: 19px !important; }

  .billboard-content .movie-meta { font-size: 12.5px; }

  .zf-bottomnav { left: 10px !important; right: 10px !important; }
}

/* Touch devices: replace hover-lift with press feedback */
@media (hover: none) and (pointer: coarse) {
  .movie-card:active {
    transform: scale(0.97);
    transition: transform 0.15s;
  }

  .btn:active,
  .btn-submit:active,
  .chan:active,
  .episode-item:active {
    transform: scale(0.97);
    transition: transform 0.12s;
  }
}


/* ============================================================
   ZFX2 — Wave 2 mobile polish
   ============================================================ */

/* ---------- Growth popup as a bottom sheet on phones ---------- */
@media (max-width: 700px){
  .zf-growth-card{
    left:12px !important; right:12px !important;
    width:auto !important;
    bottom:calc(12px + env(safe-area-inset-bottom)) !important;
    border-radius:24px !important;
    padding:22px 18px 16px !important;
  }
  body.zf-has-bottomnav .zf-growth-card{
    bottom:calc(86px + env(safe-area-inset-bottom)) !important;
  }
  .zf-growth-primary, .zf-growth-secondary{ min-height:48px; }
  .zf-growth-title{ font-size:18px !important; }
}

@media (max-width: 900px){
  /* ---------- Rewards page mobile ---------- */
  .rewards-container{ padding:20px 14px 130px !important; }
  .rewards-container [style*="grid-template-columns: 1fr 2fr"]{
    display:flex !important; flex-direction:column !important; gap:26px !important;
  }
  .points-header{
    flex-direction:column !important; align-items:flex-start !important;
    gap:12px; padding:22px 20px !important;
  }
  .points-header h1{ font-size:24px !important; }
  .points-balance{ font-size:40px !important; }
  .store-grid{ grid-template-columns:1fr !important; gap:14px !important; }
  .earn-card, .store-item{ padding:22px 18px !important; }
  .earn-btn, .buy-btn{ min-height:48px; width:100%; }
  .active-reward-item{ flex-direction:column; gap:4px; align-items:flex-start !important; }
  .promo-header{ padding:14px !important; padding-top:calc(14px + env(safe-area-inset-top)) !important; }
  .close-promo{ min-height:44px; }

  /* ---------- Wishlist mobile ---------- */
  .zf-wish-btn{ opacity:1 !important; transform:scale(1) !important; width:38px !important; height:38px !important; }
  .zf-wish-btn svg{ width:19px !important; height:19px !important; }
  .zf-wish-toast{
    bottom:calc(90px + env(safe-area-inset-bottom)) !important;
    font-size:13.5px; padding:11px 18px;
  }
  .mylist-container{ padding:82px 14px 130px !important; }
  .mylist-title{ font-size:26px !important; }
  .mylist-grid{ grid-template-columns:repeat(auto-fill, minmax(108px, 1fr)) !important; gap:10px !important; }
  .zf-card-strip strong{ font-size:12px; }
  .zf-card-strip span{ font-size:10.5px; }
  .zf-empty-list{ padding:52px 18px; }

  /* ---------- Movie player mobile: panels become bottom sheets ---------- */
  #srvPanel, #epPanel, #subPanel{
    left:10px !important; right:10px !important; top:auto !important;
    bottom:calc(10px + env(safe-area-inset-bottom)) !important;
    width:auto !important; max-width:none !important;
    max-height:62vh !important; overflow-y:auto !important;
    border-radius:24px 24px 20px 20px !important;
    animation:zfSheetUp .28s cubic-bezier(.32,.72,.35,1);
  }
  .topbar .ttl{ max-width:30vw; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .tbtn{ min-height:42px; min-width:42px; }
  .srv-item, .ep-item{ min-height:52px; }
  .dlsub{ bottom:calc(14px + env(safe-area-inset-bottom)) !important; }
}

/* ---------- Live TV mobile ---------- */
@media (max-width: 820px){
  .chan{ min-height:62px; padding:11px 12px !important; }
  .chan .logo{ width:44px !important; height:44px !important; }
  .side .search input{ font-size:16px !important; min-height:44px; }
  .cbtn{ width:46px !important; height:46px !important; }
  .cbtn svg{ width:26px !important; height:26px !important; }
  .vol input{ width:62px !important; }
  .controls{ padding-bottom:calc(14px + env(safe-area-inset-bottom)) !important; gap:8px !important; }
  .toast{ bottom:110px !important; max-width:88% !important; }
  .topbar{ top:calc(12px + env(safe-area-inset-top)) !important; padding:9px 16px !important; gap:10px !important; max-width:calc(100vw - 24px); }
  .chname{ font-size:14px !important; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:38vw; }
  .menu-pop{ max-height:46vh !important; }
}

/* ==================== ZFX3R: MOBILE PLAYER SHEET + ADMIN LIVE ==================== */
@media (max-width: 700px) {
    .sf-panel {
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        bottom: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        max-height: 74vh;
        border-radius: 22px 22px 0 0;
        border-left: none !important;
        border-top: 1px solid rgba(255,255,255,.15);
        transform: translateY(105%) !important;
    }
    .sf-panel.open { transform: translateY(0) !important; }
    .sf-panel::before {
        content: "";
        display: block;
        width: 44px;
        height: 5px;
        border-radius: 999px;
        background: rgba(255,255,255,.25);
        margin: 10px auto 2px;
    }
    #subtitleList, #audioList { max-height: 34vh; }
    .sf-option { min-height: 48px; display: flex; align-items: center; }
    .sfss-btn, .sfss-select { min-height: 46px; }
    .sfss-sync-btn { min-height: 44px; min-width: 56px; }
    .sf-panel input[type="range"]::-webkit-slider-thumb { width: 26px; height: 26px; }
}
@media (max-width: 900px) {
    body.zf-admin-live { overflow-x: hidden; }
    body.zf-admin-live table { display: block; overflow-x: auto; white-space: nowrap; }
    body.zf-admin-live .form-grid { display: grid; grid-template-columns: 1fr !important; }
    body.zf-admin-live input[type="text"],
    body.zf-admin-live input[type="number"],
    body.zf-admin-live select { min-height: 48px; width: 100%; }
    body.zf-admin-live #alkass_fields { flex-direction: column; }
}


/* ==================== ZFX5: MOBILE HERO + TOP10 ==================== */
@media (max-width: 700px) {
    .billboard-buttons .btn { padding: 9px 18px !important; font-size: 13px !important; min-height: 40px; }
    .play-main-btn { padding: 10px 22px !important; font-size: 14px !important; }
    .top-number-badge { font-size: 34px !important; }
    .zf-top10-chip { font-size: 10px; padding: 2px 8px; margin: 0 6px; }
}

/* ==================== ZFX5.3: MOBILE HEADER FIX (logo center + hamburger AR/EN) ==================== */
@media (max-width: 900px) {
  /* The hamburger was a flex child: in RTL (Arabic) the reversed layout pushed it
     out of view. Pin it absolutely to the start side: LEFT in English, RIGHT in Arabic. */
  .navbar { overflow: visible !important; }
  .navbar .zf-mnav-toggle {
    display: inline-flex !important;
    position: absolute !important;
    inset-inline-start: 10px !important;
    inset-inline-end: auto !important;
    top: calc(env(safe-area-inset-top, 0px) + 28px) !important;
    transform: translateY(-50%) !important;
    margin: 0 !important;
    z-index: 1002;
  }
  /* keep the open-state X animation working (transform is on the spans, not the button) */

  /* ZAPFLIX logo perfectly centered in the top bar - both languages */
  .navbar .logo {
    position: absolute !important;
    left: 50% !important;
    right: auto !important;
    top: calc(env(safe-area-inset-top, 0px) + 28px) !important;
    transform: translate(-50%, -50%) !important;
    margin: 0 !important;
    z-index: 1001;
    white-space: nowrap;
  }

  /* the right-side items stay at the inline-end, clear of the centered logo */
  .navbar .nav-right { margin-inline-start: auto; }
}

/* =====================================================================
   ZFX13: TRUE PHONE APP OVERHAUL (iPhone 15 / Galaxy S25 class, 360-430px)
   Additive layer - desktop untouched.
   ===================================================================== */
@media (max-width: 900px) {
  /* ---------- global polish ---------- */
  html { -webkit-text-size-adjust: 100%; }
  * { -webkit-tap-highlight-color: transparent; }
  body { font-size: 15px; overflow-x: hidden !important; }
  input, select, textarea { font-size: 16px !important; } /* stops iOS auto-zoom on focus */
  ::-webkit-scrollbar { width: 0; height: 0; } /* app feel: no visible scrollbars */

  /* ---------- rhythm & typography ---------- */
  .content-section { padding: 14px 4% 4px !important; }
  .section-title { font-size: 18px !important; margin-bottom: 10px !important; letter-spacing: -0.2px; }

  /* ---------- hero / billboard ---------- */
  .billboard { height: 58vh !important; min-height: 340px !important; }
  .billboard-content { max-width: 94% !important; padding-bottom: 12px; }
  .billboard-content .movie-logo { font-size: 1.55em !important; line-height: 1.15; }
  .billboard-content .synopsis { font-size: 13.5px !important; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .billboard-buttons { display: flex; gap: 10px; width: 100%; }
  .billboard-buttons .btn { flex: 1 1 0; justify-content: center; min-height: 46px !important; font-size: 14.5px !important; border-radius: 12px !important; }

  /* ---------- rows & cards ---------- */
  .movie-row { gap: 10px !important; padding-inline: 4% !important; padding-bottom: 14px !important; }
  .movie-row .movie-card { flex: 0 0 41% !important; border-radius: 12px !important; box-shadow: 0 6px 18px rgba(0,0,0,.35); }
  .card-title { font-size: 12.5px !important; }
  .card-overlay { padding: 10px !important; }

  /* ---------- movie details page ---------- */
  .movie-actions { display: flex !important; flex-wrap: wrap !important; gap: 10px !important; }
  .movie-actions .btn { flex: 1 1 46% !important; justify-content: center !important; min-height: 46px !important; font-size: 14px !important; border-radius: 12px !important; }
  .synopsis { font-size: 14px !important; line-height: 1.65 !important; }
  .cast-row { overflow-x: auto !important; scroll-snap-type: x proximity; gap: 12px !important; padding-bottom: 10px; }
  .cast-row > * { scroll-snap-align: start; }

  /* actor modal becomes an app-style bottom sheet */
  .actor-modal { position: fixed !important; left: 0 !important; right: 0 !important; bottom: 0 !important; top: auto !important;
    width: 100% !important; max-width: none !important; max-height: 78vh !important; overflow-y: auto !important;
    border-radius: 22px 22px 0 0 !important; flex-direction: column !important; padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px)) !important; }
  .actor-modal-img { width: 92px !important; height: 92px !important; border-radius: 50% !important; object-fit: cover; }
  .actor-modal-right h2 { font-size: 1.5rem !important; }

  /* ---------- auth & forms ---------- */
  .auth-box { width: 92% !important; max-width: 400px !important; padding: 28px 20px !important; border-radius: 18px !important; }

  /* ---------- thumb-sized touch targets everywhere ---------- */
  .btn, button.btn { min-height: 44px; }

  /* ---------- bottom nav labels ---------- */
  .zf-bottomnav a span:last-child { font-size: 10.5px; }
}

/* Small phones (iPhone SE / 13 mini class) */
@media (max-width: 380px) {
  .billboard-content .movie-logo { font-size: 1.35em !important; }
  .movie-row .movie-card { flex: 0 0 46% !important; }
  .section-title { font-size: 16.5px !important; }
}
