/* ============================================================
   dashboard-mobile.css  — StreamKite Dashboard Mobile Styles
   Add <link rel="stylesheet" href="/css/dashboard-mobile.css">
   AFTER the main dashboard.css link in dashboard.html
   ============================================================ */

/* ─── BASE TOUCH IMPROVEMENTS ─────────────────────────────── */
@media (max-width: 768px) {
  html { font-size: 14px; }

  /* prevent horizontal overflow globally */
  body { overflow-x: hidden; }

  /* bigger tap targets */
  .btn      { min-height: 36px; }
  .btn-sm   { min-height: 32px; padding: 0.3rem 0.65rem; font-size: 0.75rem; }

  /* ─── TOPBAR ────────────────────────────────────────────── */
  .topbar {
    height: auto;
    flex-direction: column;
    align-items: stretch;
    padding: 0;
    gap: 0;
  }

  /* Row 1: logo + support */
  .topbar-logo {
    font-size: 1rem;
    padding: 0.6rem 1rem 0.5rem;
  }

  /* Row 2 (controls row): passkey input + buttons */
  .topbar-right {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.35rem;
    padding: 0 0.75rem 0.6rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .topbar-right::-webkit-scrollbar { display: none; }

  /* Hide server-dots on phones — saves space */
  .server-dots { display: none; }

  /* PassKey input takes all remaining space */
  .pk-input {
    flex: 1 1 0;
    min-width: 80px;
    max-width: none;
    width: auto;
    font-size: 0.72rem;
    padding: 0.38rem 0.65rem;
  }

  /* Make topbar buttons a bit smaller */
  .topbar-right .btn-sm {
    padding: 0.28rem 0.55rem;
    font-size: 0.72rem;
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* slot-lock-fab: tighten so it clears the taller topbar */
  .slot-lock-fab {
    top: auto;
    bottom: 5.5rem; /* above note-fab */
    right: 0.75rem;
    padding: 0.28rem 0.65rem 0.28rem 0.4rem;
  }
  .slf-label { font-size: 0.65rem; }

  /* ─── MAIN PADDING ──────────────────────────────────────── */
  .main {
    padding: 1rem 0.85rem 5rem;
    max-width: 100%;
  }

  /* ─── TOAST: center bottom on mobile ───────────────────── */
  #toast-rack {
    bottom: 1.25rem;
    right: 0.75rem;
    left: 0.75rem;
    align-items: center;
  }
  .toast { max-width: 100%; width: 100%; }

  /* ─── LOCKED VIEW (before login) ───────────────────────── */
  #lockedView .locked {
    margin: 1.5rem auto;
    padding: 1.75rem 1.25rem;
    border-radius: 18px;
    max-width: 100%;
  }
  .locked h2   { font-size: 1.25rem; }
  .locked p    { font-size: 0.82rem; margin-bottom: 1.25rem; }
  .locked-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    margin-bottom: 1rem;
  }
  .locked-actions .btn {
    width: 100%;
    justify-content: center;
    padding: 0.65rem 1rem;
    font-size: 0.88rem;
  }
  /* "No PassKey yet" row below locked-actions */
  #lockedView > div > div[style*="display:flex"] {
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
  }
  .pk-err { font-size: 0.75rem; }

  /* ─── PASSKEY CARD (after login) ───────────────────────── */
  .pk-card {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
  }
  .pk-left  { width: 100%; }
  .pk-right {
    width: 100%;
    justify-content: space-between;
    align-items: center;
  }
  .pk-value {
    font-size: 0.8rem;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .expiry-info { text-align: left; }

  /* validity jars: scale down */
  .validity-jars-wrap { gap: 0.6rem; margin-bottom: 0.75rem; }
  .jar-outer  { width: 40px; height: 66px; }
  .jar-neck   { width: 20px; height: 6px; }
  .jar-days-text { font-size: 0.65rem; }
  .jar-plan-label { font-size: 0.52rem; }

  /* ─── EMAIL REGISTER BOX ────────────────────────────────── */
  .email-reg {
    flex-direction: column;
    align-items: stretch;
    padding: 0.75rem 1rem;
  }
  .email-input { width: 100%; }
  #emailRegForm { flex-wrap: wrap; }
  #emailRegForm .btn { flex-shrink: 0; }

  /* ─── REFERRAL BOX ──────────────────────────────────────── */
  .ref-input-row { flex-wrap: wrap; }
  .ref-input { max-width: 100%; }

  /* ─── BANNERS ───────────────────────────────────────────── */
  .banner {
    flex-direction: column;
    align-items: flex-start;
    padding: 0.75rem 1rem;
    gap: 0.5rem;
  }
  .banner-actions { flex-wrap: wrap; gap: 0.4rem; }
  .banner-actions .btn { font-size: 0.75rem; }

  /* ─── TOOLBAR (My Streams header row) ───────────────────── */
  .toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
  }
  .toolbar h2 { font-size: 0.95rem; }

  .toolbar-right {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    align-items: center;
  }
  .search-input {
    flex: 1 1 100px;
    width: auto;
    min-width: 90px;
    font-size: 0.76rem;
  }

  /* hide view-toggle icons to save space */
  .view-toggle { width: 28px; height: 28px; font-size: 0.8rem; }

  /* ─── SLOTS GRID ────────────────────────────────────────── */
  .slots-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  /* ─── SLOT CARD ─────────────────────────────────────────── */
  .slot-actions {
    gap: 0.3rem;
    flex-wrap: wrap;
  }
  .slot-actions .btn-sm {
    padding: 0.3rem 0.55rem;
    font-size: 0.72rem;
  }
  .file-badge { max-width: 130px; }

  /* ─── USAGE WIDGET ──────────────────────────────────────── */
  .usage-widget { flex-direction: column; gap: 0.6rem; }
  .usage-plan   { min-width: 0; }
  .usage-quick  { flex-direction: row; flex-wrap: wrap; }
  .usage-quick-btn { flex: 1; min-width: 80px; }

  /* ─── ADDON SECTION ─────────────────────────────────────── */
  .addon-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
  }
  .addon-actions {
    flex-wrap: wrap;
    gap: 0.3rem;
    width: 100%;
  }
  .addon-actions .btn { font-size: 0.72rem; padding: 0.28rem 0.55rem; }

  /* ─── MODALS ────────────────────────────────────────────── */
  .modal-overlay { padding: 0.5rem; align-items: flex-end; }
  .modal {
    padding: 1.25rem 1.1rem !important;
    border-radius: 18px 18px 0 0 !important;
    max-height: 94vh;
    max-width: 100% !important;
    margin: 0;
  }
  .form-row { grid-template-columns: 1fr; gap: 0.6rem; }

  /* ─── TICKET MODAL ──────────────────────────────────────── */
  .tkt-box {
    width: 100%;
    max-width: 100%;
    border-radius: 18px 18px 0 0;
    max-height: 88vh;
  }
  .tkt-head  { padding: 1rem 1.1rem 0; }
  .tkt-body  { padding: 0.85rem 1.1rem 1.1rem; }

  /* ─── ONBOARDING / PIN MODAL ────────────────────────────── */
  .pin-modal {
    padding: 1.35rem 1.1rem !important;
    border-radius: 18px !important;
    max-width: 96vw;
  }

  /* ─── BULK PROGRESS BAR ──────────────────────────────────── */
  #bulkProgressBar > div {
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
  }

  /* ─── SET-PIN WIDGET ────────────────────────────────────── */
  .set-pin-widget {
    flex-direction: column;
    padding: 0.9rem 1rem;
    gap: 0.65rem;
  }
  .spw-icon { font-size: 1.5rem; }

  /* ─── INFO HUB ──────────────────────────────────────────── */
  /* tabs already go vertical at 600px via existing CSS */
  .info-hub { margin-top: 1rem; }

  /* ─── CHECKLIST ─────────────────────────────────────────── */
  .checklist-wrap { padding: 0.75rem 0.9rem; }

  /* ─── FAB BUTTONS (bottom-right cluster) ────────────────── */
  .theme-fab {
    bottom: 0.75rem;
    right: 0.75rem;
    width: 38px;
    height: 38px;
    font-size: 0.95rem;
  }
  .note-fab {
    bottom: 4.75rem;
    right: 0.75rem;
    width: 38px;
    height: 38px;
    font-size: 0.95rem;
  }

  /* note panel: full-width bottom sheet on mobile */
  .note-panel {
    bottom: 8.5rem;
    right: 0.75rem;
    left: 0.75rem;
    width: auto;
    min-width: 0;
    max-width: none;
    resize: none;
  }

  /* ─── HOLIDAY / PAUSE OVERLAYS ──────────────────────────── */
  .holiday-title    { font-size: 1.5rem; }
  .holiday-sub      { font-size: 0.85rem; }
  .pause-lock-title { font-size: 1.4rem; }
  .pause-lock-sub   { font-size: 0.88rem; }
  .lho-title        { font-size: 1.3rem; }
  .lho-message      { font-size: 0.82rem; padding: 0.75rem 1rem; }

  /* ─── FESTIVAL WIDGET ───────────────────────────────────── */
  #festivalWidget {
    top: auto;
    bottom: 1rem;
    left: 0.75rem;
    right: 0.75rem;
    width: auto;
    transform: none;
    max-width: none;
    padding: 1rem 1.25rem;
    border-radius: 14px;
  }

  /* ─── ADDON PKG GRID (3-col → 2-col) ───────────────────── */
  .addon-pkg-grid { grid-template-columns: repeat(2, 1fr); }

  /* ─── RENEWAL / BILLING MODAL ───────────────────────────── */
  .billing-toggle { width: 100%; justify-content: center; }

  /* ─── DOOR PANEL / FAB: already hidden at 768px ─────────── */
}


/* ─── EXTRA NARROW (phones ≤ 480px) ───────────────────────── */
@media (max-width: 480px) {

  html { font-size: 13px; }

  /* Topbar: stack logo and controls on separate rows */
  .topbar-logo {
    padding: 0.55rem 0.85rem 0;
    justify-content: space-between;
  }

  .topbar-right {
    padding: 0.35rem 0.75rem 0.5rem;
    gap: 0.28rem;
  }

  /* Even tighter topbar buttons */
  .topbar-right .btn-sm {
    padding: 0.25rem 0.45rem;
    font-size: 0.68rem;
  }

  /* PassKey input */
  .pk-input { font-size: 0.68rem; padding: 0.32rem 0.5rem; }

  /* ─── LOCKED VIEW ───────────────────────────────────────── */
  .locked {
    margin: 1rem auto;
    padding: 1.35rem 1rem;
    border-radius: 14px;
  }
  .locked h2   { font-size: 1.1rem; }
  .locked p    { font-size: 0.78rem; }

  /* ─── MAIN CONTENT ──────────────────────────────────────── */
  .main { padding: 0.75rem 0.65rem 5rem; }

  /* ─── PK CARD ───────────────────────────────────────────── */
  .pk-value { font-size: 0.72rem; max-width: 150px; }

  /* ─── TOOLBAR ───────────────────────────────────────────── */
  .toolbar-right { gap: 0.25rem; }

  /* keep Add Stream + Refresh prominent */
  #addSlotBtn { flex-shrink: 0; }

  /* Hide bulk-mode buttons until bulk is toggled — they wrap badly */
  #bulkStartBtn, #bulkStopBtn, #bulkRestartBtn, #bulkDeleteBtn,
  #selectAllBtn {
    font-size: 0.68rem;
    padding: 0.25rem 0.45rem;
  }

  /* ─── SLOT ACTIONS ──────────────────────────────────────── */
  .slot-actions .btn-sm {
    padding: 0.25rem 0.45rem;
    font-size: 0.68rem;
  }

  /* ─── BANNER ────────────────────────────────────────────── */
  .banner { padding: 0.65rem 0.85rem; }
  .banner-msg { font-size: 0.78rem; }

  /* ─── UPLOAD WIDGET (main video) ────────────────────────── */
  .mv-widget { border-radius: 14px 14px 0 0; }
  .mv-widget-drop { padding: 1.25rem 1rem; }
  .mv-drop-icon { font-size: 1.5rem; }

  /* ─── PLAYLIST WIDGET ───────────────────────────────────── */
  .pl-widget { border-radius: 14px 14px 0 0; }

  /* ─── MODAL ─────────────────────────────────────────────── */
  .modal { padding: 1.1rem 0.9rem !important; }

  /* ─── VALIDITY JARS ─────────────────────────────────────── */
  .jar-outer { width: 34px; height: 56px; }
  .jar-neck  { width: 16px; }
  .jar-days-text { font-size: 0.58rem; }
  .validity-jars-wrap { gap: 0.45rem; }

  /* ─── ADDON PKG GRID (2-col → 1-col) ───────────────────── */
  .addon-pkg-grid { grid-template-columns: repeat(2, 1fr); gap: 0.4rem; }

  /* ─── FAB cluster ───────────────────────────────────────── */
  .theme-fab { bottom: 0.6rem; right: 0.6rem; }
  .note-fab  { bottom: 4.25rem; right: 0.6rem; }
  .note-panel { right: 0.6rem; left: 0.6rem; }

  /* ─── TOAST ─────────────────────────────────────────────── */
  #toast-rack { bottom: 1rem; right: 0.5rem; left: 0.5rem; }
}


/* ─── LIGHT THEME MOBILE OVERRIDES ────────────────────────── */
@media (max-width: 768px) {
  body.light-theme .topbar {
    background: rgba(255,255,255,0.98);
    box-shadow: 0 1px 8px rgba(15,23,42,0.1);
  }
  body.light-theme .pk-input {
    background: #f5f8ff;
    border-color: rgba(30,50,100,0.18);
    color: #0f172a;
  }
  body.light-theme .modal {
    background: #fff !important;
  }
}
