/* ============================================================
   ViralUrMusic — mobile.css  v4
   MOBILE ONLY — desktop is completely untouched
   ============================================================ */

/* ── Prevent iOS input zoom ── */
input, select, textarea, button { font-size: 16px !important; }

/* ── Touch optimization for all interactive elements ── */
.svc-chip, .qty-btn, .tab, .filter-btn, .bnav-item,
.plat-tab, .payment-card, .pm-card, .fbtn, .qp,
.pcard, .side-link, .btn, .orow {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

/* ═══════════════════════════════════════════════════════════
   MOBILE — max 768px
═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* ── Base ── */
  body { overflow-x: hidden; }
  * { box-sizing: border-box; }

  /* ── Layout shell ── */
  .dashboard { grid-template-columns: 1fr !important; }
  .main {
    padding: 70px 14px 88px !important;
    min-width: 0 !important;
    width: 100% !important;
    overflow-x: hidden !important;
  }
  .dash-topbar { display: none !important; }

  /* ── Sidebar drawer ── */
  .sidebar {
    position: fixed !important;
    left: 0; top: 0; bottom: 0;
    z-index: 400;
    width: 280px !important;
    transform: translateX(-100%) !important;
    transition: transform .3s cubic-bezier(.4,0,.2,1) !important;
    overflow-y: auto;
    background: #08090b !important;
  }
  .sidebar.open {
    transform: translateX(0) !important;
    box-shadow: 8px 0 60px rgba(0,0,0,.9) !important;
  }
  .sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.7);
    z-index: 399;
    backdrop-filter: blur(3px);
  }
  .sidebar-overlay.open { display: block !important; }

  /* ── Mobile topbar ── */
  .mobile-topbar {
    display: flex !important;
    position: fixed !important;
    top: 0; left: 0; right: 0;
    z-index: 200; height: 58px;
    align-items: center;
    padding: 0 14px; gap: 12px;
    background: rgba(5,5,5,.98) !important;
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255,255,255,.07);
  }
  .mobile-menu-btn {
    display: flex !important;
    width: 40px; height: 40px;
    border-radius: 12px;
    background: #13131a;
    border: 1px solid rgba(255,255,255,.1);
    align-items: center; justify-content: center;
    cursor: pointer; flex-shrink: 0;
  }
  .mobile-page-title {
    display: block !important;
    font-size: 17px; font-weight: 700;
    flex: 1; letter-spacing: -.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .mobile-wallet {
    display: flex !important;
    align-items: center; gap: 5px;
    font-size: 13px; font-weight: 700;
    color: var(--gold);
    background: rgba(212,175,55,.1);
    border: 1px solid rgba(212,175,55,.2);
    padding: 7px 11px; border-radius: 12px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* ── Bottom navigation ── */
  .bottom-nav {
    display: flex !important;
    position: fixed !important;
    bottom: 0; left: 0; right: 0;
    z-index: 200; height: 68px;
    align-items: center;
    justify-content: space-around;
    padding: 0 6px;
    background: rgba(5,5,5,.98) !important;
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255,255,255,.07);
  }
  .bnav-item {
    display: flex !important;
    flex-direction: column;
    align-items: center; gap: 3px;
    flex: 1; padding: 6px 4px;
    text-decoration: none;
    color: var(--muted);
    min-height: 48px; justify-content: center;
    border-radius: 14px;
  }
  .bnav-item svg { width: 22px; height: 22px; }
  .bnav-item span { font-size: 10px; font-weight: 600; }
  .bnav-item.active { color: var(--gold); }
  .bnav-item:active { transform: scale(.92); }
  .bnav-create {
    display: flex !important;
    width: 52px; height: 52px;
    background: linear-gradient(145deg,#e8c84e,#c49a1e) !important;
    border-radius: 16px;
    align-items: center; justify-content: center;
    color: #12100a !important;
    text-decoration: none; flex-shrink: 0;
    box-shadow: 0 4px 24px rgba(212,175,55,.45);
    margin-bottom: 8px;
  }
  .bnav-create:active { transform: scale(.93); }
  .bnav-create svg { width: 26px; height: 26px; }

  /* ────────────────────────────────────────────
     DASHBOARD — STATS GRID  (2×2 on mobile)
  ──────────────────────────────────────────── */
  .stats-grid,
  .admin-stats {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
    width: 100% !important;
  }

  /* Each stat card: full width, no overflow, tighter padding */
  .stat {
    padding: 14px 12px !important;
    min-height: 82px !important;
    min-width: 0 !important;          /* KEY — prevents overflow in grid */
    width: 100% !important;
    overflow: hidden !important;
  }
  .stat .s-label {
    font-size: 11px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .stat .s-value {
    font-size: 17px !important;
    font-weight: 800 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* ────────────────────────────────────────────
     DASHBOARD — 2-COL GRID → SINGLE COLUMN
  ──────────────────────────────────────────── */
  .dash-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 14px !important;
    width: 100% !important;
  }

  /* Campaign builder right panel goes below orders */
  .dash-grid > div:nth-child(2) {
    width: 100% !important;
    min-width: 0 !important;
  }

  /* ────────────────────────────────────────────
     ORDERS ROWS — prevent horizontal bleed
  ──────────────────────────────────────────── */
  .orow {
    padding: 11px 12px !important;
    gap: 10px !important;
    min-width: 0 !important;
    width: 100% !important;
  }
  .oicon {
    width: 34px !important;
    height: 34px !important;
    flex-shrink: 0 !important;
  }
  .oinfo {
    flex: 1 !important;
    min-width: 0 !important;    /* KEY — allows text-overflow ellipsis */
  }
  .oname {
    font-size: 12px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  .ometa {
    font-size: 10px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  .oamt  { font-size: 13px !important; }
  .odate { font-size: 10px !important; }

  /* ────────────────────────────────────────────
     FILTER TABS — horizontal scroll, no wrap
  ──────────────────────────────────────────── */
  /* The filter row wrapping the .fbtn elements */
  .card > div[style*="margin-bottom:14px"],
  .filter-row-wrap {
    overflow-x: auto !important;
    white-space: nowrap !important;
    scrollbar-width: none !important;
    -webkit-overflow-scrolling: touch !important;
    padding-bottom: 4px !important;
    /* Remove flex-wrap from parent if set */
    flex-wrap: nowrap !important;
  }
  .card > div[style*="margin-bottom:14px"]::-webkit-scrollbar { display: none; }

  .fbtn {
    display: inline-block !important; /* stay inline inside scroll container */
    flex-shrink: 0 !important;
    white-space: nowrap !important;
    padding: 8px 14px !important;
    font-size: 12px !important;
    margin: 0 4px 0 0 !important;
  }
  .fbtn:first-child { margin-left: 0 !important; }

  /* ────────────────────────────────────────────
     CAMPAIGN BUILDER QUICK-PICK (.qp) ROWS
  ──────────────────────────────────────────── */
  .qp {
    padding: 11px 12px !important;
    gap: 10px !important;
    min-width: 0 !important;
    width: 100% !important;
  }
  .qpicon {
    width: 36px !important;
    height: 36px !important;
    flex-shrink: 0 !important;
  }
  .qpname {
    font-size: 13px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  .qpdesc {
    font-size: 10px !important;
  }

  /* ── Cards ── */
  .card {
    padding: 14px !important;
    border-radius: 16px !important;
    min-width: 0 !important;
    width: 100% !important;
  }

  /* ── Platform tabs on campaign page — scroll horizontally ── */
  .plat-tab { flex-shrink: 0 !important; white-space: nowrap !important; }

  /* ── Service layout ── */
  .service-layout { grid-template-columns: 1fr !important; }
  .summary-card { position: static !important; }

  /* ── Chips ── */
  .svc-chip { padding: 11px 16px !important; min-height: 44px !important; }
  .qty-btn  { padding: 10px 14px !important; min-height: 42px !important; }

  /* ── Info row keep 3 col (small) ── */
  .info-row, .item-info { grid-template-columns: 1fr 1fr 1fr !important; gap: 8px !important; }
  .info-box, .iib { padding: 8px 10px !important; }
  .ib-val, .iib-val { font-size: 13px !important; }

  /* ────────────────────────────────────────────
     FUNDS PAGE — complete fix
  ──────────────────────────────────────────── */
  .funds-layout { grid-template-columns: 1fr !important; width: 100% !important; }
  .funds-topbar { display: none !important; }
  .funds-grid, .pc { display: grid !important; grid-template-columns: repeat(2,1fr) !important; gap: 8px !important; width: 100% !important; box-sizing: border-box !important; }
  .pcard, .payment-card { padding: 12px !important; min-width: 0 !important; box-sizing: border-box !important; width: 100% !important; }
  .pc-big, .pc-label { font-size: 15px !important; }
  .pc-sub, .pc-usd { font-size: 11px !important; }
  .amt-display { width: 100% !important; box-sizing: border-box !important; }
  .field .input, input.input, input[type="number"].input { width: 100% !important; box-sizing: border-box !important; }
  .btn-full { width: 100% !important; box-sizing: border-box !important; display: block !important; }
  .card form { width: 100% !important; }

  /* ── Right sidebar cols → 1 col ── */
  [style*="grid-template-columns:1fr 280px"],
  [style*="grid-template-columns:1fr 300px"],
  [style*="grid-template-columns:1fr 320px"],
  [style*="grid-template-columns:1fr 260px"],
  [style*="grid-template-columns:1fr 425px"],
  [style*="grid-template-columns:300px 1fr"],
  [style*="grid-template-columns:320px 1fr"],
  [style*="grid-template-columns:1.4fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* ── Tables scroll ── */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 12px; }
  table { font-size: 12px !important; min-width: 500px; }
  thead th { padding: 10px 12px !important; font-size: 10px !important; }
  tbody td { padding: 10px 12px !important; }

  /* ── Filter tabs scroll (generic) ── */
  .filter-row {
    overflow-x: auto !important;
    flex-wrap: nowrap !important;
    scrollbar-width: none !important;
    padding-bottom: 4px !important;
    -webkit-overflow-scrolling: touch;
  }
  .filter-row::-webkit-scrollbar { display: none; }
  .filter-btn { flex-shrink: 0 !important; white-space: nowrap !important; }

  /* ── Settings grids → 1 col ── */
  .split,
  .audience-grid,
  .two-col-layout,
  .mini-grid { grid-template-columns: 1fr !important; }

  /* ── Keep 2-col for small info pairs ── */
  .summary-mini { grid-template-columns: 1fr 1fr !important; }

  /* ── Admin ── */
  .features-grid { grid-template-columns: repeat(2,1fr) !important; }

  /* ── Form select full width ── */
  .form-select, .currency-sel { width: 100% !important; min-width: unset !important; }

  /* ── Pagination ── */
  .pagination { gap: 5px !important; flex-wrap: wrap !important; }
  .page-btn { padding: 8px 10px !important; font-size: 12px !important; }

  /* ── Flash ── */
  .flash { font-size: 13px !important; padding: 11px 14px !important; }

  /* ── Wallet pill on dashboard (hide large desktop version) ── */
  .wpill { display: none !important; }

}

/* ═══════════════════════════════════════════════════════════
   DESKTOP — hide mobile elements completely
═══════════════════════════════════════════════════════════ */
@media (min-width: 769px) {
  .bottom-nav        { display: none !important; }
  .mobile-topbar     { display: none !important; }
  .sidebar-overlay   { display: none !important; }
  .mobile-menu-btn   { display: none !important; }
  .mobile-page-title { display: none !important; }
  .mobile-wallet     { display: none !important; }
}
