/* ============================================================
   mobile.css — iOS-native look for mobile view (< 1024px)
   Design ref: design/mobile-ui-mockup.html
   Desktop (>= 1024px) layout is untouched.
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Thai:wght@400;500;600;700;800&display=swap');

:root {
  --ios-blue: #007AFF;
  --ios-blue-grad: linear-gradient(135deg, #0A84FF 0%, #0055D4 100%);
  --ios-orange-grad: linear-gradient(135deg, #FFA726 0%, #F57C00 100%);
  --ios-green-grad: linear-gradient(135deg, #34C759 0%, #1E9E43 100%);
  --ios-red-grad: linear-gradient(135deg, #FF3B30 0%, #C62828 100%);
  --ios-bg: #F2F2F7;
  --ios-sep: #E5E5EA;
  --ios-text2: #8E8E93;
}

/* Thai-friendly font stack everywhere.
   IMPORTANT: exclude <i> so FontAwesome glyph fonts keep working. */
body,
body *:not(i):not(.fa):not(.fas):not(.far):not(.fab) {
  font-family: -apple-system, 'SF Pro Text', 'Inter', 'Noto Sans Thai', sans-serif !important;
}

@media (max-width: 1023px) {

  /* ---------- Base ---------- */
  body { background: var(--ios-bg) !important; }

  /* ---------- Header → iOS blur bar ---------- */
  header {
    background: rgba(249, 249, 251, 0.88) !important;
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 0.5px solid var(--ios-sep) !important;
  }

  /* ---------- Cards: borderless + soft shadow ---------- */
  .border-slate-100, .border-slate-200 { border-color: transparent !important; }
  .shadow-sm { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important; }
  .bg-white.rounded-2xl, .action-card { border-radius: 16px !important; }

  /* ---------- Hero cards (gradients per module) ---------- */
  .bg-indigo-600 {
    background: var(--ios-blue-grad) !important;
    border-radius: 20px;
    box-shadow: 0 8px 20px rgba(0, 122, 255, 0.25);
  }
  /* small logo squares keep tight radius */
  .w-8.bg-indigo-600, .w-9.bg-indigo-600 { border-radius: 12px; box-shadow: none; }

  /* house-expenses pages: hero → orange */
  body.ios-house .bg-indigo-600:not(.w-8):not(.w-9) {
    background: var(--ios-orange-grad) !important;
    box-shadow: 0 8px 20px rgba(255, 143, 0, 0.25);
  }
  .bg-emerald-600 {
    background: var(--ios-green-grad) !important;
    border-radius: 20px;
    box-shadow: 0 8px 20px rgba(52, 199, 89, 0.25);
  }
  .bg-amber-600, .bg-amber-500 { border-radius: 20px; }

  /* ---------- Buttons ---------- */
  .btn { border-radius: 14px !important; text-transform: none; }
  .btn-circle, .btn-square { border-radius: 12px !important; }
  .btn-primary, .btn-info {
    background: var(--ios-blue) !important;
    border-color: var(--ios-blue) !important;
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
  }
  .btn-success { box-shadow: 0 4px 12px rgba(52, 199, 89, 0.3); }
  .btn-error { box-shadow: 0 4px 12px rgba(255, 59, 48, 0.25); }

  /* ---------- Inputs / selects ---------- */
  .input, .select, .textarea, .file-input {
    border-radius: 12px !important;
    background: #fff;
    border-color: var(--ios-sep) !important;
  }
  .input:focus, .select:focus, .textarea:focus {
    border-color: var(--ios-blue) !important;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.12);
  }

  /* ---------- Badges ---------- */
  .badge { border-radius: 10px; font-weight: 700; border: none; }

  /* ---------- Modals → iOS bottom sheet ---------- */
  .modal { align-items: flex-end !important; }
  .modal-box {
    border-radius: 20px 20px 0 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-bottom: 0 !important;
    max-height: 92vh;
    padding-top: 26px;
    position: relative;
  }
  .modal-box::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 5px;
    border-radius: 3px;
    background: #C7C7CC;
  }

  /* ---------- Tables → card rows ---------- */
  .table { border-radius: 16px; overflow: hidden; }
  .table :where(thead) { background: transparent; }
  .table :where(th) { color: var(--ios-text2); font-size: 11px; letter-spacing: 0.05em; }
  .table :where(td, th) { border-color: var(--ios-sep) !important; }

  /* ---------- Bottom Tab Bar (markup injected by mobile-nav.js) ---------- */
  .btm-nav-bar {
    background: rgba(249, 249, 251, 0.92) !important;
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-top: 0.5px solid var(--ios-sep) !important;
    box-shadow: none !important;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0)) !important; }
  body.no-tabbar { padding-bottom: 0 !important; }

  .ios-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 3px;
    padding: 8px 0 10px;
    min-height: 58px;
    font-size: 10px;
    font-weight: 500;
    color: var(--ios-text2);
    text-decoration: none;
    background: none;
    border: none;
  }
  .ios-tab i { font-size: 21px; }
  .ios-tab.active { color: var(--ios-blue); font-weight: 700; }
  body.ios-house .ios-tab.active { color: #FF8F00; }

  /* center ＋ button */
  .ios-tab-center { position: relative; flex: 1; display: flex; justify-content: center; }
  .ios-tab-center a {
    position: absolute;
    top: -22px;
    width: 52px;
    height: 52px;
    border-radius: 26px;
    background: var(--ios-blue-grad);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    box-shadow: 0 6px 16px rgba(0, 122, 255, 0.4);
    text-decoration: none;
  }
  body.ios-house .ios-tab-center a {
    background: var(--ios-orange-grad);
    box-shadow: 0 6px 16px rgba(255, 143, 0, 0.4);
  }

  /* ---------- Alerts ---------- */
  .alert { border-radius: 14px !important; border: none; }

  /* ---------- Section headers ---------- */
  h2.uppercase, .section-label {
    color: var(--ios-text2) !important;
    font-weight: 700;
  }
}
