/* ══════════════════════════════════════════════════════════════════
   MOBILE.CSS — myAAmeeting  (desktop untouched above 768px)
   ══════════════════════════════════════════════════════════════════ */

/* ── 1. BASE ─────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  body { overflow-x: hidden; font-size: 15px; }
  *, *::before, *::after { -webkit-tap-highlight-color: rgba(107,76,53,0.08); }
  img, video { max-width: 100%; }

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

  /* Buttons — min 44px tap target */
  .btn { min-height: 44px; padding: 11px 20px; font-size: 0.95rem; }
  .btn--sm { min-height: 38px; padding: 8px 14px; font-size: 0.875rem; }
  .btn--full { width: 100%; justify-content: center; display: flex; }

  /* Typography */
  h1 { font-size: 1.45rem !important; }
  h2 { font-size: 1.2rem !important; }
  h3 { font-size: 1rem !important; }

  /* Forms — single column */
  .add-form-grid,
  .form-row { grid-template-columns: 1fr !important; }
  .form-control { min-height: 44px; }

  /* Cards */
  .card__header { padding: 12px 14px !important; flex-wrap: wrap; gap: 8px; }
  .card__body   { padding: 14px !important; }
}

/* ── 2. ADMIN LAYOUT ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Sidebar slides off — already handled in sidenav.css */
  .admin-main { margin-left: 0 !important; }

  /* Page hero — compact on mobile */
  .page-hero { padding: 48px 16px 16px !important; }
  .page-hero h1 { font-size: 1.3rem !important; margin-bottom: 2px; }
  .page-hero p  { font-size: 0.85rem !important; }

  /* Container padding */
  .container { padding-left: 14px !important; padding-right: 14px !important; }
}

/* ── 3. DASHBOARD ────────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* 4 col → 2 col stats */
  .dash-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
    margin-bottom: 14px !important;
  }
  .metric { padding: 12px 12px !important; }
  .metric-val { font-size: 1.65rem !important; }
  .metric-sub { font-size: 0.7rem !important; }

  /* Analytics: 2-col → stack */
  .analytics-grid { grid-template-columns: 1fr !important; gap: 12px !important; }
  .bottom-grid    { grid-template-columns: 1fr !important; gap: 12px !important; }

  /* Chart — shorter on mobile */
  .chart-bar-wrap { height: 56px !important; }

  /* Visit log — hide header, simplify rows */
  .visit-thead { display: none !important; }
  .visit-row {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 10px 14px !important;
    font-size: 0.85rem !important;
  }
  .visit-row > span:nth-child(3) { margin-left: auto; font-size: 0.75rem; color: var(--text-light); }
  .visit-row > span:nth-child(4) { display: none; }

  /* Quick actions — 1 col, full width */
  .quick-btn {
    padding: 14px 16px !important;
    font-size: 0.9rem !important;
    min-height: 48px;
  }

  /* Dashboard info bar — stack */
  .dash-info-bar,
  .dash-info-bar > div:first-child {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 6px !important;
  }
}
@media (max-width: 390px) {
  .dash-grid { grid-template-columns: 1fr !important; }
}

/* ── 4. FINANCE ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Fund cards — stack */
  .fin-funds-grid,
  [style*="grid-template-columns:repeat(auto-fit"] {
    grid-template-columns: 1fr !important;
  }
  .fund-card { padding: 14px 16px !important; }
  .fund-card-balance { font-size: 1.65rem !important; }

  /* Tabs — scrollable */
  .fin-tabs {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    flex-wrap: nowrap !important;
    margin-bottom: 0 !important;
  }
  .fin-tab { padding: 11px 16px !important; font-size: 0.85rem !important; flex-shrink: 0; }

  /* Transaction rows → card style */
  .tx-row,
  [style*="grid-template-columns:90px 80px"] {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 4px 10px !important;
    padding: 12px 14px !important;
    align-items: center !important;
    position: relative;
  }

  /* Date — small, top left */
  .tx-row > span:nth-child(1),
  .tx-date {
    font-size: 0.72rem !important;
    color: var(--text-light) !important;
    width: 100% !important;
    order: -1;
  }
  /* Type badge */
  .tx-type-badge { font-size: 0.68rem !important; }
  /* Description — full width */
  .tx-desc, .tx-row > span:nth-child(3) {
    flex: 1 1 100% !important;
    font-size: 0.9rem !important;
    font-weight: 600 !important;
    color: var(--text-dark) !important;
    order: 0;
  }
  /* Amount — right side */
  .amount-pos, .amount-neg, .amount-neutral {
    font-size: 1rem !important;
    margin-left: auto;
  }
  /* Delete btn */
  .tx-row form { margin-left: auto; }

  /* Audit rows → stack */
  .audit-row {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 4px 10px !important;
    padding: 10px 14px !important;
  }
  .audit-action-badge { font-size: 0.68rem !important; flex-shrink: 0; }

  /* Forms inside finance panes — full width */
  .fin-pane .form-row,
  .fin-pane [style*="grid-template-columns:1fr 1fr"],
  .fin-pane [style*="grid-template-columns:1fr 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
}

/* ── 5. ATTENDANCE ───────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Tabs — scrollable */
  .att-tabs {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    flex-wrap: nowrap !important;
  }
  .att-tab { padding: 11px 16px !important; flex-shrink: 0; font-size: 0.85rem !important; }

  /* Record attendance form — stack date/time/count */
  .att-pane [style*="display:flex; align-items:flex-end"],
  .att-form-row {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 14px !important;
    padding: 16px 14px !important;
  }
  .att-pane .form-group { width: 100% !important; margin-bottom: 0 !important; }
  .att-pane .form-group .form-control { width: 100% !important; }

  /* Attendance count stepper — bigger on mobile */
  .count-wrap { gap: 16px !important; justify-content: center; padding: 8px 0; }
  .count-btn {
    width: 52px !important;
    height: 52px !important;
    font-size: 1.5rem !important;
    border-width: 2px !important;
  }
  .count-display {
    font-size: 2.6rem !important;
    min-width: 72px !important;
  }
  .count-input {
    width: 80px !important;
    font-size: 1.8rem !important;
    text-align: center;
    padding: 8px !important;
  }

  /* Attendance table — scrollable */
  .member-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .att-table { min-width: 440px; font-size: 0.83rem !important; }
  .att-table th,
  .att-table td { padding: 9px 10px !important; }

  /* Filter row — stretch */
  .att-pane [style*="justify-content:space-between"] {
    flex-direction: column !important;
    gap: 10px !important;
    padding: 12px 14px !important;
  }
  .att-pane [style*="justify-content:space-between"] .btn { align-self: stretch; }

  /* Month filter — full width */
  #monthFilter { width: 100% !important; height: 44px !important; }

  /* Service member section */
  .service-table { min-width: 380px; font-size: 0.83rem !important; }
  .section-header { flex-wrap: wrap; gap: 8px; }

  /* Form footer (Save/Cancel row) */
  .form-footer {
    flex-direction: row !important;
    gap: 8px !important;
    padding: 12px 14px !important;
  }
  .form-footer .btn { flex: 1; }
}

/* ── 6. ADMIN PHONELIST (management page) ────────────────────────── */
@media (max-width: 768px) {
  /* Tabs — scrollable */
  .pl-tabs {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    flex-wrap: nowrap !important;
  }
  .pl-tab { padding: 11px 14px !important; flex-shrink: 0; font-size: 0.83rem !important; }

  /* Member list table — scrollable */
  .member-table { min-width: 460px; font-size: 0.83rem !important; }
  .member-table th,
  .member-table td { padding: 9px 10px !important; }
}

/* ── 7. OTHER PAGES ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Settings tabs */
  .settings-tabs, .nav-tabs {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    display: flex;
    flex-wrap: nowrap !important;
  }

  /* Inbox */
  .inbox-layout { grid-template-columns: 1fr !important; }

  /* Auth cards */
  .auth-card { padding: 22px 16px !important; }
  .container--narrow { padding: 0 14px !important; }

  /* Modals — bottom sheet */
  .modal-dialog {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    border-radius: 16px 16px 0 0 !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
  }

  /* Alerts */
  .alert { padding: 10px 14px !important; font-size: 0.87rem; }
  .system-alert { padding: 8px 14px !important; font-size: 0.82rem; }
}

/* ── 8. BOTTOM NAV SPACING ───────────────────────────────────────── */
@media (max-width: 768px) {
  /* Give main content room above the bottom nav */
  .admin-main { padding-bottom: 72px !important; }
}

/* ── TABLET (769–1024px) ─────────────────────────────────────────── */
@media (min-width: 769px) and (max-width: 1024px) {
  .dash-grid      { grid-template-columns: repeat(2, 1fr) !important; }
  .analytics-grid { grid-template-columns: 1fr !important; }
  .bottom-grid    { grid-template-columns: 1fr !important; }
}
