/* =========================================================================
 * css/bw-v3.css — booking widget V3
 * -------------------------------------------------------------------------
 * Styles the custom widget rendered by
 *   site/resources/views/shared/guest/_v2/booking-widget.blade.php
 * and driven by js/bw-v3.js. No shadow-DOM ::part() hacks — every element
 * is plain light DOM. A minified copy is appended to css/combined.min.css
 * (the only stylesheet guest pages load); keep both in sync.
 * Brand: #007ba8 (same accent as the funnel stepper + search button).
 * =========================================================================*/

.bw-v3 {
    --bw3-accent: #007ba8;
    --bw3-accent-dark: #006690;
    --bw3-accent-soft: rgba(0, 123, 168, .10);
    --bw3-ring: rgba(0, 123, 168, .18);
    --bw3-text: #1d1d1f;
    --bw3-muted: #6e6e73;
    --bw3-border: #d2d2d7;
    --bw3-bg-muted: #f5f5f7;
    --bw3-radius: 12px;
    --bw3-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Helvetica, Arial, sans-serif;
    font-family: var(--bw3-font);
    color: var(--bw3-text);
    -webkit-font-smoothing: antialiased;
}

.bw-v3, .bw-v3 *, .bw-v3 *::before, .bw-v3 *::after { box-sizing: border-box; }

/* hero card (overrides the older bw-v2 card look) */
.bw-v3.bw-v2--hero {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, .05);
    border-radius: 18px;
    padding: 22px;
    box-shadow: 0 12px 44px rgba(0, 0, 0, .08);
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
}

/* ---------- main grid (inputs only — 3 cols; 4 when drop-off is active) ---------- */
.bw-v3__grid {
    display: grid;
    grid-template-columns: minmax(180px, 1.5fr) minmax(200px, 1.25fr) minmax(200px, 1.25fr);
    gap: 14px;
    align-items: end;
}
.bw-v3--has-dloc .bw-v3__grid {
    grid-template-columns: repeat(4, 1fr);
}

.bw-v3__field { position: relative; min-width: 0; }

.bw-v3__label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--bw3-muted);
    margin: 0 0 7px 2px;
}

.bw-v3__label-ic { width: 14px; height: 14px; color: var(--bw3-accent); flex: 0 0 auto; }

/* ---------- control (closed field) ---------- */
.bw-v3__control {
    appearance: none;
    -webkit-appearance: none;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 52px;
    padding: 0 14px;
    background: #fff;
    border: 1px solid var(--bw3-border);
    border-radius: var(--bw3-radius);
    font: inherit;
    font-size: 15px;
    letter-spacing: -0.01em;
    color: var(--bw3-text);
    text-align: left;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.bw-v3__control:hover { border-color: #a1a1a6; }
.bw-v3__control:focus-visible,
.bw-v3__control[aria-expanded="true"] {
    outline: none;
    border-color: var(--bw3-accent);
    box-shadow: 0 0 0 3px var(--bw3-ring);
}

.bw-v3__control--compact { min-height: 46px; }

.bw-v3__value {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bw-v3__value.is-placeholder { color: var(--bw3-muted); font-weight: 400; }

.bw-v3__ic { width: 17px; height: 17px; color: var(--bw3-accent); flex: 0 0 auto; }

.bw-v3__chev {
    width: 16px;
    height: 16px;
    color: var(--bw3-muted);
    flex: 0 0 auto;
    transition: transform .18s ease;
}

.bw-v3__control[aria-expanded="true"] .bw-v3__chev { transform: rotate(180deg); }

/* split date | time control */
.bw-v3__control--dt { gap: 12px; }
.bw-v3__dt-part { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1 1 auto; }
.bw-v3__dt-part--time { flex: 0 0 auto; }
.bw-v3__dt-sep { width: 1px; height: 22px; background: var(--bw3-border); flex: 0 0 auto; }

/* validation shake */
.bw-v3--error .bw-v3__control {
    border-color: #d23f3f;
    box-shadow: 0 0 0 3px rgba(210, 63, 63, .15);
    animation: bw-v3-shake .3s ease;
}

@keyframes bw-v3-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* ---------- popups ---------- */
.bw-v3__pop {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 1100;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, .08);
    border-radius: 16px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, .16), 0 2px 6px rgba(0, 0, 0, .06);
    animation: bw-v3-pop .22s cubic-bezier(.32, .72, 0, 1);
}

@keyframes bw-v3-pop {
    from { opacity: 0; transform: translateY(6px) scale(.985); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.bw-v3__pop--list {
    width: max(100%, 260px);
    max-height: 330px;
    overflow-y: auto;
    padding: 6px;
    scrollbar-width: thin;
}

.bw-v3__opt {
    appearance: none;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 11px 12px;
    background: transparent;
    border: 0;
    border-radius: 10px;
    font: inherit;
    font-size: 14px;
    letter-spacing: -0.01em;
    color: var(--bw3-text);
    text-align: left;
    cursor: pointer;
    transition: background .12s ease;
}

.bw-v3__opt[hidden] { display: none; }
.bw-v3__opt:hover { background: var(--bw3-bg-muted); }
.bw-v3__opt[aria-selected="true"] { background: var(--bw3-accent-soft); color: var(--bw3-accent); font-weight: 600; }
.bw-v3__opt-ic { width: 16px; height: 16px; color: var(--bw3-muted); flex: 0 0 auto; }
.bw-v3__opt[aria-selected="true"] .bw-v3__opt-ic { color: var(--bw3-accent); }

/* right-align pickers near the right edge of the card */
.bw-v3__field--ddt .bw-v3__pop--picker { left: auto; right: 0; }

/* ---------- date + time picker ---------- */
.bw-v3__pop--picker { width: min(478px, calc(100vw - 32px)); }

.bw-v3__pk-head {
    display: flex;
    gap: 10px;
    padding: 14px 14px 12px;
    border-bottom: 1px solid rgba(0, 0, 0, .06);
}

.bw-v3__pk-date {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid var(--bw3-border);
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
}

.bw-v3__pk-date.is-placeholder { color: var(--bw3-muted); font-weight: 400; }
.bw-v3__pk-date span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.bw-v3__pk-time {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 6px 0 12px;
    border: 1px solid var(--bw3-border);
    border-radius: 10px;
}

.bw-v3__pk-timesel {
    appearance: none;
    -webkit-appearance: none;
    border: 0;
    outline: none;
    background: transparent url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236e6e73' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") right 2px center / 14px no-repeat;
    padding: 10px 20px 10px 0;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--bw3-text);
    cursor: pointer;
}

.bw-v3__pk-body {
    display: grid;
    grid-template-columns: 1fr 132px;
    gap: 14px;
    padding: 12px 14px;
}

.bw-v3__cal-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.bw-v3__cal-title { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }

.bw-v3__cal-btn {
    appearance: none;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .04);
    border: 0;
    border-radius: 50%;
    color: var(--bw3-text);
    cursor: pointer;
    transition: background .15s ease;
}

.bw-v3__cal-btn svg { width: 15px; height: 15px; }
.bw-v3__cal-btn:hover:not(:disabled) { background: rgba(0, 0, 0, .09); }
.bw-v3__cal-btn:disabled { opacity: .35; cursor: default; }

.bw-v3__cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.bw-v3__cal-wd {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 26px;
    font-size: 11px;
    font-weight: 600;
    color: var(--bw3-muted);
}

.bw-v3__cal-blank { aspect-ratio: 1 / 1; }

.bw-v3__cal-day {
    appearance: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 1 / 1;
    min-height: 32px;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 50%;
    font: inherit;
    font-size: 13px;
    color: var(--bw3-text);
    cursor: pointer;
    transition: background .12s ease, color .12s ease, transform .08s ease;
}

.bw-v3__cal-day:hover:not(:disabled) { background: rgba(0, 0, 0, .06); transform: scale(1.05); }
.bw-v3__cal-day.is-today { box-shadow: inset 0 0 0 1.5px var(--bw3-border); }
.bw-v3__cal-day.is-selected { background: var(--bw3-accent); color: #fff; font-weight: 600; box-shadow: none; }
.bw-v3__cal-day:disabled { color: #c5c5c9; cursor: default; pointer-events: none; }

.bw-v3__pk-times { display: flex; flex-direction: column; gap: 8px; }

.bw-v3__pk-times-h {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--bw3-muted);
    margin: 2px 0 2px 2px;
}

.bw-v3__chip {
    appearance: none;
    padding: 9px 10px;
    background: #fff;
    border: 1px solid var(--bw3-border);
    border-radius: 10px;
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--bw3-text);
    cursor: pointer;
    text-align: center;
    transition: border-color .12s ease, background .12s ease, color .12s ease;
}

.bw-v3__chip:hover { border-color: var(--bw3-accent); color: var(--bw3-accent); }
.bw-v3__chip.is-active { background: var(--bw3-accent); border-color: var(--bw3-accent); color: #fff; font-weight: 600; }

.bw-v3__pk-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    border-top: 1px solid rgba(0, 0, 0, .06);
}

.bw-v3__pk-cancel,
.bw-v3__pk-apply {
    appearance: none;
    min-width: 104px;
    padding: 11px 18px;
    border-radius: 980px;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s ease, color .15s ease, border-color .15s ease, opacity .15s ease;
}

.bw-v3__pk-cancel { background: #fff; border: 1px solid var(--bw3-border); color: var(--bw3-text); }
.bw-v3__pk-cancel:hover { border-color: #a1a1a6; }

.bw-v3__pk-apply { background: var(--bw3-accent); border: 1px solid var(--bw3-accent); color: #fff; }
.bw-v3__pk-apply:hover:not(:disabled) { background: var(--bw3-accent-dark); border-color: var(--bw3-accent-dark); }
.bw-v3__pk-apply:disabled { opacity: .4; cursor: default; }

/* ---------- global City / Airport type toggle (above the grid) ---------- */
.bw-v3__gtype-bar {
    display: flex;
    justify-content: center;
    margin-bottom: 18px;
}

.bw-v3__gtype {
    display: inline-flex;
    background: var(--bw3-bg-muted);
    border-radius: 980px;
    padding: 3px;
    gap: 2px;
}

.bw-v3__gtype-btn {
    appearance: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 22px;
    background: transparent;
    border: none;
    border-radius: 980px;
    font: inherit;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--bw3-muted);
    cursor: pointer;
    letter-spacing: -0.01em;
    transition: background .15s ease, color .15s ease, box-shadow .15s ease;
    white-space: nowrap;
}

.bw-v3__gtype-btn svg { width: 14px; height: 14px; flex: 0 0 auto; pointer-events: none; }

.bw-v3__gtype-btn:hover { color: var(--bw3-text); }

.bw-v3__gtype-btn.is-active {
    background: #fff;
    color: var(--bw3-accent);
    box-shadow: 0 1px 5px rgba(0, 0, 0, .13);
    font-weight: 600;
}

/* ---------- bottom bar: drop-off toggle + search button ---------- */
.bw-v3__bottom-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 14px;
}

.bw-v3__difftoggle-wrap { flex: 0 0 auto; }

/* label shown above dloc field */
.bw-v3__label--dloc { margin-bottom: 6px; }

.bw-v3__switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }

.bw-v3__switch-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.bw-v3__switch-track {
    position: relative;
    width: 42px;
    height: 24px;
    background: #d2d2d7;
    border-radius: 980px;
    flex: 0 0 auto;
    transition: background .18s ease;
}

.bw-v3__switch-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
    transition: transform .18s ease;
}

.bw-v3__switch-input:checked + .bw-v3__switch-track { background: var(--bw3-accent); }
.bw-v3__switch-input:checked + .bw-v3__switch-track .bw-v3__switch-thumb { transform: translateX(18px); }
.bw-v3__switch-input:focus-visible + .bw-v3__switch-track { box-shadow: 0 0 0 3px var(--bw3-ring); }

.bw-v3__switch-label { font-size: 14px; font-weight: 500; color: var(--bw3-text); letter-spacing: -0.01em; }

.bw-v3__field--dloc { width: 100%; }

/* ---------- submit ---------- */
.bw-v3__actions { display: flex; align-items: center; }

.bw-v3__submit {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-width: 158px;
    height: 52px;
    padding: 0 26px;
    background: var(--bw3-accent);
    color: #fff;
    border: 0;
    border-radius: 980px;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: .01em;
    cursor: pointer;
    box-shadow: 0 2px 14px rgba(0, 123, 168, .28);
    transition: background .15s ease, transform .1s ease, box-shadow .15s ease;
}

.bw-v3__submit svg { width: 18px; height: 18px; flex: 0 0 auto; }
.bw-v3__submit:hover { background: var(--bw3-accent-dark); transform: translateY(-1px); box-shadow: 0 4px 18px rgba(0, 123, 168, .34); }
.bw-v3__submit:active { transform: translateY(0); }
.bw-v3__submit:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--bw3-ring); }

/* ---------- scrim (mobile bottom-sheet backdrop) ---------- */
.bw-v3__scrim { display: none; }
body.bw-v3-lock { overflow: hidden; }

/* =========================================================================
 * Responsive
 * =========================================================================*/

/* tablet: 2 columns */
@media (max-width: 1099px) {
    .bw-v3__grid { grid-template-columns: 1fr 1fr; }
    .bw-v3--has-dloc .bw-v3__grid { grid-template-columns: 1fr 1fr; }
    .bw-v3__field--ploc { grid-column: 1 / -1; }
    /* when drop-off is active: ploc + dloc sit side-by-side */
    .bw-v3--has-dloc .bw-v3__field--ploc { grid-column: auto; }
}

/* phone: single column, bottom-sheet popups */
@media (max-width: 640px) {
    .bw-v3.bw-v2--hero { padding: 16px; border-radius: 16px; }
    .bw-v3__grid { grid-template-columns: 1fr; gap: 12px; }
    .bw-v3--has-dloc .bw-v3__grid { grid-template-columns: 1fr; }
    .bw-v3__field--ploc { grid-column: auto; }
    .bw-v3__control { min-height: 50px; }
    .bw-v3__field--dloc { max-width: none; }
    .bw-v3__bottom-bar { flex-direction: column; align-items: stretch; gap: 12px; }

    .bw-v3__scrim {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, .42);
        z-index: 10000;
        animation: bw-v3-fade .2s ease;
    }
    .bw-v3__scrim[hidden] { display: none; }

    .bw-v3__pop {
        position: fixed;
        top: auto;
        left: 0;
        right: 0;
        bottom: 0;
        width: auto !important;
        max-width: none;
        border-radius: 20px 20px 0 0;
        max-height: 86vh;
        overflow-y: auto;
        z-index: 10010;
        animation: bw-v3-sheet .26s cubic-bezier(.32, .72, 0, 1);
        padding-bottom: env(safe-area-inset-bottom, 0);
    }

    .bw-v3__pop--list { max-height: 60vh; padding: 10px; }
    .bw-v3__opt { padding: 13px 12px; font-size: 15px; }

    .bw-v3__pk-body { grid-template-columns: 1fr; }
    .bw-v3__pk-times { flex-direction: row; flex-wrap: wrap; align-items: center; }
    .bw-v3__pk-times-h { flex: 1 1 100%; }
    .bw-v3__chip { flex: 1 1 calc(20% - 8px); min-width: 64px; }
    .bw-v3__pk-foot { position: sticky; bottom: 0; background: #fff; }
    .bw-v3__pk-cancel, .bw-v3__pk-apply { flex: 1 1 0; }
}

@keyframes bw-v3-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes bw-v3-sheet { from { transform: translateY(24px); opacity: .6; } to { transform: translateY(0); opacity: 1; } }

/* very narrow phones: tighter paddings, smaller day cells */
@media (max-width: 360px) {
    .bw-v3.bw-v2--hero { padding: 12px; }
    .bw-v3__pk-head { flex-wrap: wrap; }
    .bw-v3__cal-day { min-height: 30px; font-size: 12px; }
}

/* keep popups usable inside the bw-sticky full-screen overlay */
.bw-v2-overlay .bw-v3__pop {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: auto;
    bottom: auto;
}

@media (max-width: 640px) {
    .bw-v2-overlay .bw-v3__pop {
        position: fixed;
        top: auto;
        left: 0;
        right: 0;
        bottom: 0;
    }
}

/* accessibility: respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    .bw-v3__pop, .bw-v3__scrim { animation: none !important; }
    .bw-v3__cal-day, .bw-v3__chip, .bw-v3__chev,
    .bw-v3__switch-track, .bw-v3__switch-thumb, .bw-v3__submit { transition: none !important; }
}
