/* =====================================================
   Easy Choice Finance — Mobile Polish (Sprint 2F-4)
   ===================================================== */

/* ---------- Global tweaks ---------- */
html { -webkit-text-size-adjust: 100%; }
body { font-size: 1rem; }

/* Prevent iOS zoom on input focus (need ≥16px) */
input, select, textarea, button { font-size: 16px; }

/* Larger tap targets everywhere */
.btn { min-height: 38px; }
.btn-sm { min-height: 32px; }
.nav-link { padding: 0.6rem 1rem; }

/* Make whole card-row clickable areas feel like buttons */
.tappable-row { cursor: pointer; transition: background 0.15s; }
.tappable-row:hover, .tappable-row:active { background: rgba(13,110,253,0.05); }

/* ---------- Bottom Nav (Mobile Only) ---------- */
.bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  background: #fff;
  border-top: 1px solid #dee2e6;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.05);
  z-index: 1030;
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
}
.bottom-nav-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 6px 4px; min-height: 56px;
  text-decoration: none; color: #6c757d; font-size: 0.7rem; font-weight: 500;
  transition: color 0.15s;
}
.bottom-nav a .bn-icon { font-size: 1.4rem; line-height: 1; margin-bottom: 2px; }
.bottom-nav a.active { color: #0d6efd; }
.bottom-nav a:hover { color: #0d6efd; }

/* ---------- Responsive Cards Pattern ---------- */
/* Use `.responsive-table` on a table that should become cards on mobile */
@media (max-width: 768px) {
  .responsive-table thead { display: none; }
  .responsive-table tbody, .responsive-table tr,
  .responsive-table td { display: block; width: 100%; }
  .responsive-table tr {
    background: #fff; border: 1px solid #dee2e6; border-radius: 8px;
    margin-bottom: 12px; padding: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  }
  .responsive-table td {
    padding: 4px 0; border: 0;
    display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  }
  .responsive-table td::before {
    content: attr(data-label);
    font-weight: 600; color: #6c757d; font-size: 0.8rem;
    text-transform: uppercase; letter-spacing: 0.5px;
    flex-shrink: 0;
  }
  .responsive-table td.cell-primary {
    flex-direction: column; align-items: flex-start; gap: 2px;
    border-bottom: 1px solid #f1f3f5; padding-bottom: 8px; margin-bottom: 6px;
  }
  .responsive-table td.cell-primary::before { display: none; }
  .responsive-table td.cell-primary .primary-name { font-weight: 600; font-size: 1.05rem; }
  .responsive-table td.cell-primary .primary-sub { color: #6c757d; font-size: 0.85rem; }
  .responsive-table td.cell-actions {
    justify-content: flex-end; padding-top: 8px;
    border-top: 1px solid #f1f3f5; margin-top: 6px;
  }
  .responsive-table td.cell-actions::before { display: none; }
}

/* ---------- Mobile-only adjustments ---------- */
@media (max-width: 768px) {
  /* Show bottom nav, leave room above it for content */
  body { padding-bottom: 70px; }
  .bottom-nav { display: block; }

  /* Tighter container padding */
  main.container { padding-left: 12px; padding-right: 12px; }

  /* Larger headings, less margin */
  h2 { font-size: 1.4rem; }
  h3 { font-size: 1.2rem; }
  h4 { font-size: 1.05rem; }

  /* Stat cards: stack to 2 per row instead of 4 */
  .row.g-3 .col-md-3 { flex: 0 0 50%; max-width: 50%; }

  /* Form inputs: full width by default */
  .form-control, .form-select { font-size: 16px; }

  /* Card body: less padding on mobile */
  .card-body { padding: 1rem; }

  /* Hide top nav collapse on phones (we use bottom nav instead) */
  .navbar-collapse { display: none !important; }
  .navbar-toggler { display: none !important; }

  /* Tighten navbar */
  .navbar { padding-top: 0.5rem; padding-bottom: 0.5rem; margin-bottom: 1rem !important; }
  .navbar-brand { font-size: 1rem; }
}

/* ---------- Tablet adjustments ---------- */
@media (min-width: 769px) and (max-width: 1023px) {
  .row.g-3 .col-md-3 { flex: 0 0 50%; max-width: 50%; }
}

/* ---------- Smooth scrolling ---------- */
html { scroll-behavior: smooth; }

/* ---------- Better focus states ---------- */
*:focus-visible {
  outline: 2px solid #0d6efd;
  outline-offset: 2px;
}

/* ---------- Print: hide bottom nav ---------- */
@media print { .bottom-nav { display: none !important; } }
