/* Mobile-first tweaks for gloved-thumb, in-the-truck usage:
   big tap targets, big type, generous spacing. */

:root {
    --tap: 3.25rem; /* minimum comfortable tap height */
}

body {
    font-size: 1.05rem;
    -webkit-text-size-adjust: 100%;
}

/* Keep content clear of the fixed bottom nav */
.pb-nav {
    padding-bottom: 5.5rem;
}

/* Brand / logo in the top bar */
.app-logo {
    height: 34px;
    width: auto;
    display: block;
}
.brand-sub {
    color: #6c757d;
    font-weight: 600;
    font-size: 0.95rem;
    border-left: 2px solid #dee2e6;
    padding-left: 0.5rem;
    line-height: 1;
}

/* Large, unmissable action buttons */
.btn-touch {
    min-height: var(--tap);
    font-size: 1.15rem;
    font-weight: 600;
    /* Centre the label vertically. <button>s do this natively, but
       <a class="btn"> links don't, so with min-height their text sat at
       the top. Flex makes links and buttons render identically. */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    text-align: center;
}
/* Full-width buttons (e.g. status buttons wrapped in their own <form>)
   are block-level flex, so they don't sit in a text line box — that line
   box was adding extra space under each button and uneven gaps. */
.btn-touch.w-100 {
    display: flex;
}
.btn-lg,
.btn-touch {
    border-radius: 0.75rem;
}

/* Day-of-week section headers — sticky under the top navbar so the
   current day stays visible while scrolling a long week. */
.day-header {
    position: sticky;
    top: 3.25rem;
    z-index: 5;
    background: var(--bs-body-bg);
    padding: 0.4rem 0.6rem;
    border-left: 4px solid var(--bs-primary);
    border-radius: 0.25rem;
}
.day-header.is-today {
    background: var(--bs-primary-bg-subtle, #cfe2ff);
    border-left-width: 6px;
}

/* Job cards */
.job-card {
    border-radius: 1rem;
}
.job-card .job-title {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.2;
}

/* Status pills */
.status-pill {
    font-size: 0.8rem;
    padding: 0.35em 0.7em;
    border-radius: 999px;
}

/* Bottom navigation */
.bottom-nav {
    z-index: 1030;
    padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav-item {
    color: #6c757d;
    text-decoration: none;
}
.bottom-nav-item.active {
    color: var(--bs-primary);
    font-weight: 600;
}

/* Big, legible key/value rows on the job detail page */
.detail-row {
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--bs-border-color);
}
.detail-row .label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #6c757d;
}
.detail-row .value {
    font-size: 1.15rem;
    font-weight: 500;
    word-break: break-word;
}
/* Two fields on one row (pairs listed in templates/job/job.twig) */
.detail-row-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 1rem;
}

/* ══════════════ Express Thermos branding ══════════════ */
:root {
    --bs-primary: #fc7942;
    --bs-primary-rgb: 252, 121, 66;
    --brand-ink: #131313;
}

/* Type: headings in Arboria (Adobe Fonts), body in Inter — as on the site */
body {
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--brand-ink);
}
h1, h2, h3, h4, h5, h6, .navbar-brand, .job-title {
    font-family: "arboria", "Inter", system-ui, sans-serif;
    font-weight: 700;
}

/* Brand orange on Bootstrap's "primary" surfaces */
.bg-primary { background-color: #fc7942 !important; }
.text-primary { color: #d9591f !important; }   /* darkened so it stays legible on white */
.bottom-nav-item.active { color: #d9591f; }
.day-header.is-today { background: #ffe6d8; }

/* Primary button = orange fill, ink border/text (best contrast on orange) */
.btn-primary {
    --bs-btn-bg: #fc7942;           --bs-btn-border-color: #131313;
    --bs-btn-hover-bg: #ec6a30;     --bs-btn-hover-border-color: #131313;
    --bs-btn-active-bg: #e0631f;    --bs-btn-active-border-color: #131313;
    --bs-btn-disabled-bg: #fc7942;  --bs-btn-disabled-border-color: #131313;
    --bs-btn-color: #131313;        --bs-btn-hover-color: #131313;  --bs-btn-active-color: #131313;
}

/* Orange top bar */
.navbar-brandbar { background-color: #fc7942; }
.navbar-brandbar .brand-sub {
    color: rgba(255, 255, 255, 0.92);
    border-left-color: rgba(255, 255, 255, 0.45);
}

/* Squared, blocky buttons with a hard offset shadow and press-down feel */
.btn {
    --bs-btn-border-width: 2px;
    border-radius: 0;
    font-weight: 600;
    box-shadow: 3px 3px 0 0 var(--brand-ink);
    transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.btn:hover {
    box-shadow: 4px 4px 0 0 var(--brand-ink);
    transform: translate(-1px, -1px);
}
.btn:active {                       /* press INTO the shadow */
    transform: translate(3px, 3px);
    box-shadow: 0 0 0 0 var(--brand-ink);
}
.btn:disabled, .btn.disabled {
    box-shadow: 2px 2px 0 0 rgba(19, 19, 19, 0.25) !important;
    transform: none !important;
}
/* Grouped buttons (filters) sit edge-to-edge — drop the offset shadow so
   they don't cast onto each other; keep a subtle press. */
.btn-group .btn { box-shadow: none; }
.btn-group .btn:hover { transform: none; box-shadow: none; }
.btn-group .btn:active { transform: translateY(1px); }

/* Link-style buttons ("Back", "All weeks", etc.) stay plain text — no box. */
.btn-link {
    --bs-btn-border-width: 0;
    box-shadow: none !important;
    text-transform: none;
}
.btn-link:hover, .btn-link:active {
    box-shadow: none !important;
    transform: none;
}

/* The PWA install prompt (banner + pill) is created and fully styled in
   assets/js/install.js, so it never depends on this stylesheet loading. */

/* Job Details note on list cards: keep cards compact (full text on job page). */
.job-card-details {
    color: #055160;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Tap-to-call on list cards: sits above the card's stretched link. */
.job-card-phone {
    position: relative;
    z-index: 2;
    display: inline-block;
    padding: .25rem 0;           /* bigger touch target */
    font-weight: 600;
    text-decoration: none;
}

/* Label/value rows on job cards (Order #, Window Type, Supplier #, Telephone #).
   The label column sizes itself to the longest label. */
.job-card-meta {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: .25rem .75rem;
    align-items: center;
    margin: .25rem 0 0;
}
.job-card-meta dt {
    font-weight: normal;
    color: var(--bs-secondary-color);
}
.job-card-meta dd {
    margin: 0;
}

/* Status row on job cards: the four step pills as an even 2x2 block */
.job-card-steps {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .375rem;
}
.job-card-steps .status-pill {
    display: block;
    text-align: center;
}
.job-card-meta dt:has(+ .job-card-steps) {
    align-self: start;   /* keep "Status:" level with the first row of pills */
    padding-top: .3em;
}

/* Extra space between groups of rows in .job-card-meta (spans both columns) */
.job-card-meta-gap {
    grid-column: 1 / -1;
    height: .5rem;
}

/* ══════════════ Job page: status pickers ══════════════ */
/* Each step shows its current status as a normal button (same look as the
   rest of the app). An invisible native <select> is stretched over it, so
   tapping the button opens the phone's own picker. */
.status-picker {
    position: relative;
}
.status-picker-face {
    position: relative;
    padding-right: 2.5rem;           /* room for the caret */
}
.status-picker-caret {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: .9em;
    opacity: .75;
}
.status-picker-select {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    font-size: 16px;                 /* stops iOS zooming in when it opens */
    -webkit-appearance: none;
    appearance: none;
}
.status-picker-select:disabled {
    opacity: 0;                      /* beats Bootstrap's select:disabled { opacity: 1 } */
    cursor: not-allowed;
}
/* The face mirrors the select's hover / press / keyboard focus */
.status-picker:hover .status-picker-face:not(.disabled) {
    box-shadow: 4px 4px 0 0 var(--brand-ink);
    transform: translate(-1px, -1px);
}
.status-picker:active .status-picker-face:not(.disabled) {
    transform: translate(3px, 3px);
    box-shadow: 0 0 0 0 var(--brand-ink);
}
.status-picker:has(.status-picker-select:focus-visible) .status-picker-face {
    outline: 3px solid var(--brand-ink);
    outline-offset: 3px;
}
/* While saving */
.status-picker:has(.status-picker-select[data-busy]) .status-picker-face {
    opacity: .6;
}

/* Land below the sticky top bar when the page returns to a saved step */
.status-step {
    scroll-margin-top: 4.5rem;
}

/* "✓ Saved" confirmation on the step that was just changed */
.status-saved-note {
    font-weight: 600;
    color: var(--bs-success-text-emphasis);
    background: var(--bs-success-bg-subtle);
    border-left: 4px solid var(--bs-success);
    padding: .45rem .7rem;
}
.status-step.is-saved {
    animation: status-saved-flash 2.4s ease-out;
}
@keyframes status-saved-flash {
    0%, 35% { background: var(--bs-success-bg-subtle); box-shadow: 0 0 0 .5rem var(--bs-success-bg-subtle); }
    100%    { background: transparent;                 box-shadow: 0 0 0 .5rem transparent; }
}
@media (prefers-reduced-motion: reduce) {
    .status-step.is-saved { animation: none; }
}

/* ══════════════ Job page: swipe between jobs ══════════════ */
/* assets/js/swipe.js moves .swipe-page sideways under the finger. */
body:has(.swipe-page) {
    overflow-x: hidden;              /* no sideways scrollbar while dragging */
}
.swipe-page {
    touch-action: pan-y pinch-zoom;  /* browser handles vertical scroll + zoom; we handle sideways */
}

/* "Next: Client name" / "Previous: …" labels at the screen edges, revealed
   as the page is dragged away from them. */
.swipe-hint {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1020;                   /* above the page, below the bars */
    max-width: 38vw;
    display: flex;
    flex-direction: column;
    gap: .15rem;
    padding: .6rem .75rem;
    background: var(--bs-body-bg);
    border: 2px solid var(--brand-ink);
    box-shadow: 3px 3px 0 0 var(--brand-ink);
    opacity: 0;
    pointer-events: none;
    transition: background-color .15s;
}
.swipe-hint-prev { left: .5rem; align-items: flex-start; }
.swipe-hint-next { right: .5rem; align-items: flex-end; text-align: right; }
.swipe-hint-arrow { font-size: 1.4rem; line-height: 1; }
.swipe-hint-label {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--bs-secondary-color);
}
.swipe-hint-title {
    font-weight: 700;
    line-height: 1.2;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
/* Past the point where letting go opens that job */
.swipe-hint.is-ready {
    background: var(--bs-primary);
}
.swipe-hint.is-ready .swipe-hint-label { color: var(--brand-ink); }

/* ══════════════ Day overview map (map.php) ══════════════ */
.day-map {
    height: 55vh;
    min-height: 320px;
    border: 2px solid var(--brand-ink);
    box-shadow: 3px 3px 0 0 var(--brand-ink);
    position: relative;
    background: var(--bs-tertiary-bg);
}
.day-map-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1rem;
    color: var(--bs-secondary-color);
}

/* Day tabs: Mon 3 · Tue 5 … */
.map-day-tabs .btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.15;
    padding: .35rem 0;
}
.map-day-count {
    font-size: .75rem;
    font-weight: 500;
    opacity: .8;
}
.map-day-tabs .map-day-empty:not(.btn-primary) {
    opacity: .5;
}

/* Legend */
.map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem 1rem;
}
.map-legend-item {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
}
.map-legend-swatch {
    width: .9rem;
    height: .9rem;
    background: var(--pin);
    border: 2px solid var(--brand-ink);
}

/* Map pins: numbered badge in the progress colour + client name */
.map-pin {
    display: flex;
    align-items: stretch;
    border: 2px solid var(--brand-ink);
    background: #fff;
    box-shadow: 2px 2px 0 0 var(--brand-ink);
    font-family: "Inter", system-ui, sans-serif;
    font-size: 13px;
    line-height: 1;
    position: relative;
    transform: translateY(-6px);       /* leave room for the pointer below */
}
.map-pin::after {                      /* pointer at the exact spot */
    content: "";
    position: absolute;
    left: 50%;
    bottom: -8px;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--brand-ink);
    border-bottom: 0;
}
.map-pin-num {
    background: var(--pin);
    color: #fff;
    font-weight: 800;
    padding: 5px 7px;
    min-width: 24px;
    text-align: center;
    text-shadow: 0 0 2px rgba(0, 0, 0, .55);
}
.map-pin-name {
    padding: 5px 7px;
    font-weight: 600;
    color: var(--brand-ink);
    max-width: 9.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.map-info {
    font-family: "Inter", system-ui, sans-serif;
    max-width: 15rem;
}
.map-info-title { font-weight: 700; font-size: 1rem; }
.map-info-address { color: #6c757d; margin-top: .15rem; }
.map-info-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: .6rem;
}

/* Stop list under the map */
.map-stop-num {
    flex: none;
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--pin);
    color: #fff;
    font-weight: 800;
    border: 2px solid var(--brand-ink);
    text-shadow: 0 0 2px rgba(0, 0, 0, .55);
}
.map-stop .min-w-0 { min-width: 0; }
