/* ============================================
   Handwritten CSS (non-Tailwind)
   ============================================
   input.css @imports this file, so output.css carries it to every page
   that loads output.css (public site, manage panel, portals); the manage
   panel and the supplier / partner portals also link it on its own.
   Unlayered: these rules beat the Tailwind layers. Keep only what is in
   use; colours come from the tokens (var(--color-...)), never a raw value.
   ============================================ */

/* --- Global --- */
html {
    scroll-behavior: smooth;
}

/* --- HTMX loading indicator --- */
.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator {
    display: inline-flex;
}

/* --- Smooth scroll offset for fixed navbar --- */
:target {
    scroll-margin-top: 5rem;
}

/* --- Performance: defer rendering of below-the-fold public sections ---
   (destination places, a place's blog posts, the home page's reviews).
   content-visibility: auto tells the browser to skip layout/paint work
   for off-screen content until the user scrolls near it.
   contain-intrinsic-size prevents layout shift from collapsed heights.
   IMPORTANT: Only apply to sections that are NEVER in the initial viewport. */
#pois-section,
#blog-section,
#reviews-section {
    content-visibility: auto;
    contain-intrinsic-size: auto none auto 600px;
}

/* --- iOS focus-zoom guard -------------------------------------------------
   Mobile Safari force-zooms the page when a focused form control's font-size
   is below 16px (the navbar search was text-sm/14px → ugly zoom jump when
   tapping it mid-scroll). Raising controls to 16px on phones is the ONLY
   accessible fix — never add maximum-scale/user-scalable to the viewport
   meta, that blocks pinch-zoom for low-vision users. !important is needed
   because Tailwind utilities (.text-sm) are classes and outrank element
   selectors. */
@media (max-width: 767px) {
    input,
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* --- Bookings filter bar: mobile layout -----------------------------------
   The phone view stacks the filter row (Tailwind flex-col). Today/Tomorrow
   and the supplier/status selects used to stay content-width, leaving an ugly
   gap on the right. sm:w-auto / sm:flex-none / contents are purged from
   output.css and can't be rebuilt (version drift), so the phone-only
   equalising is expressed here — styles.css loads after output.css. Desktop
   keeps the untouched Tailwind flex-wrap layout (this block is <640px only). */
@media (max-width: 639px) {
    #booking-filter-form .quick-dates { width: 100%; }
    #booking-filter-form .quick-dates > button { flex: 1 1 0; min-width: 0; }
    #booking-filter-form .filter-selects { width: 100%; }
    #booking-filter-form .filter-selects > div { flex: 1 1 0; min-width: 0; }
    #booking-filter-form .filter-selects select { width: 100%; min-width: 0; }
}

/* --- Visitors dashboard: 5-across summary cards on desktop ----------------
   lg:grid-cols-5 isn't in the purged Tailwind build (only 2/3/4/6 shipped) and
   output.css can't be rebuilt (version drift). Base grid-cols-2 covers mobile;
   this expresses the desktop 5-column layout. Scoped to .visitor-cards. */
@media (min-width: 1024px) {
    .visitor-cards { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

/* --- Manage panel: collapsible sidebar (desktop) --------------------------
   The bookings table is 14 columns wide and the fixed 16rem sidebar squeezed
   it. Collapsing to an icon rail hands ~11rem back to the table. The state
   lives as .nav-collapsed on <html> (set by an inline script before paint, so
   the rail never flashes wide), and the widths are plain CSS because a
   Tailwind rebuild would drift the whole output.css. Mobile is untouched —
   there the sidebar is an overlay that slides in/out. */
.admin-sidebar {
    transition-property: transform, width;
    transition-duration: 300ms;
}

/* Collapse toggle: desktop-only. `hidden lg:flex` can't do this — the purged
   output.css ships lg:flex-1 / lg:flex-row but not the bare lg:flex utility. */
.nav-toggle { display: none; }

/* --- Bookings table: collapsed ID column ---------------------------------
   Rows show a 6-char stub; clicking one reveals its full UUID. The value must
   WRAP inside the capped cell — a <td> that grows would shove every other
   column to the right, which is the space this collapse is meant to win. */
.booking-id-btn {
    display: inline-block;
    text-align: left;
    white-space: nowrap;
    line-height: 1.35;
}

.booking-id-btn.is-open {
    white-space: normal;
    overflow-wrap: anywhere;
    width: 6.5rem;
}

@media (min-width: 1024px) {
    .nav-toggle { display: flex; }
    html.nav-collapsed .admin-sidebar { width: 4.5rem; }
    html.nav-collapsed .admin-sidebar .nav-label { display: none; }
    html.nav-collapsed .admin-sidebar .nav-logo { display: none; }
    html.nav-collapsed .admin-sidebar .nav-head { justify-content: center; padding: 1rem 0.5rem; }
    html.nav-collapsed .admin-sidebar nav { padding-left: 0.5rem; padding-right: 0.5rem; }
    html.nav-collapsed .admin-sidebar nav a,
    html.nav-collapsed .admin-sidebar .nav-footer a,
    html.nav-collapsed .admin-sidebar .nav-footer button {
        justify-content: center;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    html.nav-collapsed .admin-sidebar .nav-footer { padding-left: 0.5rem; padding-right: 0.5rem; }
}

/* Native date inputs in the dark admin theme: without this Chrome draws the
   calendar icon black on the near-black field (channels filter bar). */
.dark input[type="date"] {
    color-scheme: dark;
}
