/*
 * The date-first booking entry point on the homepage.
 *
 * Scoped to the classes below rather than to elements, because this file loads on top of
 * the TheEvent template's style.css and Bootstrap. The accent is the site's existing blue
 * (#0087EB in style.css) so the board sits inside the current theme instead of starting a
 * second one.
 */

/* These names are kept because the selectors below are written against them, but the
   values now come from theme.css — the same tokens the seat picker and checkout read, so
   the three pages of the booking funnel cannot drift apart again. */
:root {
    --board-ink: var(--jt-ink);
    --board-muted: var(--jt-muted);
    --board-accent: var(--jt-accent);
    --board-accent-dark: var(--jt-accent-dark);
    --board-surface: var(--jt-surface);
    --board-border: var(--jt-border);
    --board-shadow: var(--jt-shadow);
    --board-radius: var(--jt-radius);
}

/* ---------- The date card ---------- */

.journey-search {
    background: var(--board-surface);
    border-radius: var(--board-radius);
    box-shadow: var(--board-shadow);
    padding: 28px 24px;
    margin-bottom: 24px;
    text-align: center;
}

.journey-search h2 {
    margin: 0 0 6px;
    font-size: 26px;
    color: var(--board-ink);
}

.journey-search p {
    margin: 0 0 20px;
    color: var(--board-muted);
}

.journey-search-form {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    align-items: stretch;
}

.journey-date-field {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1 1 260px;
    max-width: 380px;
}

.journey-date-field svg {
    position: absolute;
    left: 14px;
    width: 18px;
    height: 18px;
    color: var(--board-accent);
    pointer-events: none;
}

.journey-date-field .form-control {
    /* 16px so iOS Safari does not zoom the page when the field takes focus — it does
       that below 16px and never undoes it. */
    font-size: 16px;
    min-height: 52px;
    padding-left: 42px;
    border-radius: 10px;
    border: 1px solid var(--board-border);
    background: #fff;
    cursor: pointer;
}

.journey-search-submit {
    min-height: 52px;
    padding: 0 28px;
    border: 0;
    border-radius: 10px;
    background: var(--board-accent);
    color: #fff;
    font-weight: 600;
    font-size: 16px;
}

.journey-search-submit:hover {
    background: var(--board-accent-dark);
}

/* ---------- Empty and prompt states ---------- */

.departure-prompt,
.departure-empty {
    background: var(--board-surface);
    border: 1px dashed var(--board-border);
    border-radius: var(--board-radius);
    padding: 44px 24px;
    text-align: center;
    color: var(--board-muted);
}

.departure-prompt svg {
    width: 34px;
    height: 34px;
    color: var(--board-accent);
    margin-bottom: 12px;
}

.departure-prompt h3,
.departure-empty h3 {
    margin: 0 0 6px;
    font-size: 20px;
    color: var(--board-ink);
}

.departure-prompt p,
.departure-empty p {
    margin: 0;
}

/* ---------- The chosen-date bar ---------- */

.departure-datebar {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: center;
    justify-content: space-between;
    background: var(--board-surface);
    border-radius: var(--board-radius);
    box-shadow: var(--board-shadow);
    padding: 16px 20px;
    margin-bottom: 14px;
}

.departure-datebar p {
    margin: 0;
}

.departure-datebar-label {
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--board-muted);
}

.departure-datebar-date {
    font-size: 18px;
    font-weight: 700;
    color: var(--board-ink);
}

.departure-datebar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.departure-chip {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid var(--board-border);
    border-radius: 999px;
    background: #fff;
    color: var(--board-ink);
    font-size: 14px;
    text-decoration: none;
}

.departure-chip:hover {
    border-color: var(--board-accent);
    color: var(--board-accent);
}

.departure-chip.is-active,
.departure-chip.is-primary {
    background: var(--board-accent);
    border-color: var(--board-accent);
    color: #fff;
}

.departure-chip.is-active:hover,
.departure-chip.is-primary:hover {
    background: var(--board-accent-dark);
    color: #fff;
}

.departure-count {
    margin: 0 0 12px;
    color: var(--board-muted);
    font-size: 14px;
}

/* ---------- The board ---------- */

.departure-board {
    display: grid;
    gap: 12px;
}

.departure-row {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) minmax(220px, 2fr) minmax(190px, 1fr);
    gap: 18px;
    align-items: center;
    background: var(--board-surface);
    border: 1px solid var(--board-border);
    border-radius: var(--board-radius);
    box-shadow: var(--board-shadow);
    padding: 18px 20px;
    text-align: left;
}

.departure-row.is-soldout {
    opacity: 0.65;
}

.departure-identity h3 {
    margin: 0 0 6px;
    font-size: 17px;
    font-weight: 700;
    color: var(--board-ink);
}

.departure-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--jt-accent-soft);
    color: var(--board-accent-dark);
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-weight: 700;
}

.departure-journey {
    display: flex;
    align-items: center;
    gap: 14px;
}

.departure-leg strong {
    display: block;
    font-size: 22px;
    line-height: 1.15;
    color: var(--board-ink);
}

.departure-leg span {
    display: block;
    font-size: 14px;
    color: var(--board-muted);
}

.departure-arrow {
    color: var(--board-muted);
    font-size: 20px;
}

.departure-leg-end {
    /* The arrival time is not recorded anywhere, so the far end shows the place only —
       better than inventing a time the bus has never promised. */
    align-self: center;
}

.departure-leg-end span {
    font-size: 16px;
    color: var(--board-ink);
    font-weight: 600;
}

.departure-commercials {
    text-align: right;
}

.departure-fare {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--board-ink);
}

.departure-fare small {
    font-size: 12px;
    font-weight: 500;
    color: var(--board-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.departure-availability {
    margin: 2px 0 10px;
    font-size: 13px;
    color: var(--board-muted);
}

.departure-availability strong {
    font-weight: 700;
}

.departure-availability.is-open strong {
    color: var(--jt-success);
}

.departure-availability.is-tight strong {
    color: var(--jt-warning);
}

.departure-availability.is-soldout {
    color: var(--jt-danger);
    font-weight: 700;
}

.departure-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* 48px: this is the primary target on a phone. */
    min-height: 48px;
    min-width: 150px;
    padding: 0 22px;
    border: 0;
    border-radius: 10px;
    background: var(--board-accent);
    color: #fff;
    font-weight: 600;
    text-decoration: none;
}

.departure-cta:hover {
    background: var(--board-accent-dark);
    color: #fff;
}

.departure-cta:disabled {
    background: var(--jt-border-strong);
    color: var(--jt-muted);
}

/* ---------- Getting Off modal ---------- */

.getting-off-leg {
    margin: 0 0 14px;
    font-weight: 600;
    color: var(--board-ink);
}

#getting-off-modal .form-select {
    min-height: 48px;
    font-size: 16px;
}

#getting-off-modal .error-msg {
    color: var(--jt-danger);
    font-size: 13px;
}

/* ---------- Phones ---------- */

@media (max-width: 767.98px) {
    .departure-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .departure-commercials {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        text-align: left;
        border-top: 1px solid var(--board-border);
        padding-top: 12px;
    }

    .departure-availability {
        margin: 0;
    }

    .departure-cta {
        width: 100%;
    }

    .journey-search-form,
    .journey-date-field {
        max-width: none;
    }

    .journey-search-submit {
        width: 100%;
    }

    .departure-datebar {
        align-items: flex-start;
    }
}
