/* mobile.css — Kabin Quote Tool
   Mobile overrides for screens ≤ 768px
   Desktop styles in styles.css are untouched.
   Print CSS in script_quote-ui.js is untouched. */

@media (max-width: 768px) {

  /* ── GLOBAL LAYOUT ─────────────────────────────────────────── */
  header {
    padding: 0 1rem;
    height: 52px;
  }

  main {
    padding: 1.25rem 1rem 6rem;
  }

  h1 {
    font-size: 1.4rem;
    letter-spacing: -0.01em;
  }

  .page-header {
    margin-bottom: 1.25rem;
  }

  .card {
    padding: 1.1rem;
    margin-bottom: 1rem;
  }

  /* ── NATIVE iOS SELECT PICKER ──────────────────────────────── */
  /* Removes the custom-styled dropdown and restores the native
     iOS bottom-sheet picker — much easier to use on a phone */
  .is-mobile select {
    -webkit-appearance: auto;
    appearance: auto;
    background-image: none;
    padding-right: 0.85rem;
  }

  /* ── PROGRESS STRIP → MOBILE STEP INDICATOR ───────────────── */
  .progress-strip {
    display: none;
  }

  #mobileStepIndicator {
    display: flex;
    align-items: center;
    background: var(--paper-warm);
    border-bottom: 1px solid var(--border);
    padding: 0 1rem;
    height: 40px;
    font-family: 'Apercu Mono Pro', 'Courier New', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent);
    flex-shrink: 0;
  }

  /* ── NAVIGATION FOOTER ─────────────────────────────────────── */
  .nav-footer {
    flex-direction: column-reverse;
    gap: 0.65rem;
    padding: 0.85rem 1rem;
    padding-bottom: calc(0.85rem + env(safe-area-inset-bottom, 0));
  }

  .nav-footer .btn {
    width: 100%;
    justify-content: center;
  }

  .nav-hint {
    display: none;
  }

  /* ── FORM ELEMENTS ─────────────────────────────────────────── */
  .field-row {
    grid-template-columns: 1fr;
  }

  input[type="text"],
  input[type="number"],
  textarea {
    font-size: 1rem; /* prevents iOS auto-zoom on focus (must be ≥ 16px) */
  }

  /* ── LINE ITEMS ─────────────────────────────────────────────── */
  .line-item {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .line-item-remove,
  .line-item-edit {
    padding: 6px 10px; /* larger tap target */
    font-size: 1.1rem;
  }

  /* ── INFO BOX ───────────────────────────────────────────────── */
  .info-box {
    font-size: 0.8rem;
  }

  /* ══════════════════════════════════════════════════════════════
     PAGE 6 — QUOTE SUMMARY
     ══════════════════════════════════════════════════════════════ */

  /* Quote card: remove border, full bleed */
  #printableQuote,
  #printableQuoteEndUser {
    border: none !important;
    border-radius: 0 !important;
    padding: 1rem !important;
  }

  /* Brand header: stack vertically on mobile */
  .q-brand-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .q-brand-contact {
    text-align: left;
  }

  /* Reduce doc label size */
  .q-doc-label {
    font-size: 1.5rem;
    letter-spacing: 0.02em;
  }

  /* Address header: single column */
  .q-address-header {
    grid-template-columns: 1fr;
    gap: 1rem 0;
  }

  .q-quotation-col {
    text-align: left;
  }

  /* ── SUMMARY TABLE: product name + line total only ─────────── */
  .summary-table {
    display: block;
  }

  /* Hide header row — labels removed on mobile */
  .summary-table thead {
    display: none;
  }

  .summary-table tbody {
    display: block;
  }

  /* Each product row becomes a flex row */
  .summary-table tbody tr {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.55rem 0.25rem;
    border-bottom: 1px solid var(--border);
  }

  /* Hide all cells by default */
  .summary-table tbody td {
    display: none;
  }

  /* Show product name (2nd column) */
  .summary-table tbody td:nth-child(2) {
    display: block;
    flex: 1;
    padding-right: 0.5rem;
  }

  /* Show line total (last column — works for both 5-col EU and 7-col dealer) */
  .summary-table tbody td:last-child {
    display: block;
    text-align: right;
    white-space: nowrap;
  }

  /* tfoot: show label + value */
  .summary-table tfoot {
    display: block;
  }

  .summary-table tfoot tr {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.55rem 0.25rem;
    border-top: 1.5px solid var(--ink);
    border-bottom: 1.5px solid var(--ink);
  }

  /* Hide all tfoot cells by default */
  .summary-table tfoot td {
    display: none;
  }

  /* Show label (first cell — "Sell Price" / "Sub-Total") */
  .summary-table tfoot td:first-child {
    display: block;
    font-family: 'Haffer', sans-serif;
    font-weight: 700;
    font-size: 0.92rem;
  }

  /* Show value (last cell) */
  .summary-table tfoot td:last-child {
    display: block;
    font-family: 'Apercu Mono Pro', 'Courier New', monospace;
    font-weight: 700;
    font-size: 0.92rem;
    text-align: right;
  }

  /* ── COST ROWS (tariffs, delivery, total, etc.) ────────────── */
  /* .q-cost-row is already display:flex — works fine on mobile */
  /* .q-total-row font slightly larger for readability */
  .q-total-row {
    font-size: 1rem;
    padding: 0.5rem 0;
  }

  /* ── FOOTER GRID: single column ─────────────────────────────── */
  .q-footer-grid {
    grid-template-columns: 1fr;
    gap: 1rem 0;
  }

  /* EU spacer: reduce on mobile */
  .q-eu-product-spacer {
    height: 30px;
  }

  /* Page 5 job summary: reduce section spacing */
  .margin-section-title {
    margin-top: 0.75rem !important;
  }

  /* Toggle buttons on page 6 */
  .quote-view-toggle {
    flex-direction: column;
    gap: 0.5rem;
  }

  .quote-view-toggle .btn {
    width: 100%;
    justify-content: center;
  }

}
