/*
 * rapybus-search.css
 * Styles for the web booking search mask and hero CTA.
 * Requires rapybus-tokens.css.
 */

/* ── Search mask section ─────────────────────────────────── */

#search-mask {
    background: transparent;
    padding: 0 0 40px;
    margin-top: -80px;
    position: relative;
    z-index: 5;
    overflow: visible;
}

.search-card {
    background: #fff;
    border-radius: 24px;
    padding: 40px 40px 36px;
    box-shadow: 0 24px 80px rgba(9, 73, 207, 0.18), 0 4px 20px rgba(0, 0, 0, 0.10);
    border: 1.5px solid var(--rb-border);
    overflow: visible;
}

.search-card-header {
    margin-bottom: 28px;
}

.search-card-header h2 {
    font-size: clamp(1.4rem, 2.5vw, 1.9rem);
    font-weight: 700;
    color: var(--rb-dark);
    margin: 0;
}

/* ── Form row ────────────────────────────────────────────── */

.search-form-row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
}

/* ── Field wrapper ───────────────────────────────────────── */

.search-field {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.search-field--city       { flex: 2; position: relative; }
.search-field--date       { flex: 0 0 170px; }
.search-field--passengers { flex: 0 0 120px; }
.search-field--submit     { flex: 0 0 auto; }

.search-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--rb-text-muted);
    margin-bottom: 6px;
}

.search-label--hidden {
    visibility: hidden;
}

/* ── Input wrapper (icon + input) ────────────────────────── */

.search-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--rb-blue);
    font-size: 0.95rem;
    pointer-events: none;
    z-index: 1;
}

.search-input {
    flex: 1;
    min-width: 0;
    width: 100%;
    height: 50px;
    border: 1.5px solid var(--rb-border);
    border-radius: 12px;
    padding: 0 14px 0 38px;
    font-size: 0.92rem;
    color: var(--rb-dark);
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    font-family: inherit;
}

.search-input:focus {
    border-color: var(--rb-blue);
    box-shadow: 0 0 0 3px rgba(9, 73, 207, 0.1);
}

.search-input::placeholder {
    color: #b8bfcc;
}

.search-input--date {
    color-scheme: light;
    cursor: pointer;
    /* iOS Safari UA stylesheet overrides box-sizing for input[type="date"],
       causing it to overflow its container. These rules win via higher specificity. */
    box-sizing: border-box;
    max-width: 100%;
    min-width: 0;
}

/* ── Autocomplete dropdown ───────────────────────────────── */

.search-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 100%;
    width: max-content;
    max-width: min(520px, calc(100vw - 32px));
    background: #fff;
    border: 1.5px solid var(--rb-border);
    border-radius: 14px;
    box-shadow: 0 16px 48px rgba(9, 73, 207, 0.13);
    z-index: 500;
    overflow-x: hidden;
    overflow-y: auto;
    display: none;
    max-height: 320px;
}

.search-dropdown.is-open {
    display: block;
}

.search-dropdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 11px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--rb-border);
    transition: background 0.12s;
    gap: 12px;
}

.search-dropdown-item:last-child {
    border-bottom: none;
}

.search-dropdown-item:hover,
.search-dropdown-item.is-active {
    background: rgba(9, 73, 207, 0.05);
}

.sdi-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--rb-dark);
    white-space: nowrap;
}

.sdi-country {
    font-size: 0.78rem;
    color: var(--rb-text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Swap button ─────────────────────────────────────────── */

.search-swap-btn {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border-radius: 50%;
    background: rgba(9, 73, 207, 0.07);
    border: 1.5px solid rgba(9, 73, 207, 0.18);
    color: var(--rb-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, transform 0.35s;
    margin-bottom: 4px;
    font-size: 0.95rem;
}

.search-swap-btn:hover {
    background: var(--rb-blue);
    color: #fff;
    border-color: var(--rb-blue);
}

.search-swap-btn.is-spinning {
    transform: rotate(180deg);
}

/* ── Passenger stepper ───────────────────────────────────── */

.passenger-stepper {
    display: flex;
    align-items: center;
    height: 50px;
    border: 1.5px solid var(--rb-border);
    border-radius: 12px;
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
}

.passenger-stepper:focus-within {
    border-color: var(--rb-blue);
    box-shadow: 0 0 0 3px rgba(9, 73, 207, 0.1);
}

.step-btn {
    width: 38px;
    height: 100%;
    border: none;
    background: transparent;
    color: var(--rb-blue);
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
}

.step-btn:hover:not(:disabled) {
    background: rgba(9, 73, 207, 0.07);
}

.step-btn:disabled {
    color: #ccc;
    cursor: not-allowed;
}

.pax-display {
    flex: 1;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--rb-dark);
    user-select: none;
}

/* ── Submit button ───────────────────────────────────────── */

.search-btn-primary {
    height: 50px;
    padding: 0 26px;
    background: var(--rb-blue);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 0.93rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.25s, box-shadow 0.25s, transform 0.25s;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    font-family: inherit;
}

.search-btn-primary:hover {
    background: var(--rb-blue-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(9, 73, 207, 0.35);
}

.search-btn-primary i {
    font-size: 0.9rem;
    transition: transform 0.2s;
}

.search-btn-primary:hover i {
    transform: translateX(3px);
}

.search-btn-primary:disabled {
    cursor: not-allowed;
    opacity: 0.85;
    transform: none;
    box-shadow: none;
    justify-content: center;
}

@keyframes rb-bounce {
    0%, 80%, 100% { transform: translateY(0); }
    40%            { transform: translateY(-6px); }
}

.search-btn-dots {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.search-btn-dots span {
    display: inline-block;
    width: 7px;
    height: 7px;
    background: #fff;
    border-radius: 50%;
    animation: rb-bounce 1s ease-in-out infinite;
}

.search-btn-dots span:nth-child(2) { animation-delay: 0.15s; }
.search-btn-dots span:nth-child(3) { animation-delay: 0.30s; }

/* ── Validation error ────────────────────────────────────── */

.search-error {
    margin: 14px 0 0;
    font-size: 0.88rem;
    color: #e53e3e;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ── Tablet (md) ─────────────────────────────────────────── */

@media (max-width: 991px) {
    .search-field--date       { flex: 1; }
    .search-field--passengers { flex: 0 0 110px; }
}

/* ── Mobile ──────────────────────────────────────────────── */

@media (max-width: 767px) {
    #search-mask {
        margin-top: -60px;
    }

    .search-card {
        padding: 28px 20px 24px;
    }

    /* Prevents iOS Safari from auto-zooming the viewport on input focus,
       which causes the field to visually overflow the card. */
    .search-input {
        font-size: 16px;
    }

    .search-form-row {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .search-field--city,
    .search-field--date,
    .search-field--passengers,
    .search-field--submit {
        flex: none;
        width: 100%;
    }

    .search-swap-btn {
        align-self: center;
        transform: rotate(90deg);
        margin-bottom: 0;
    }

    .search-swap-btn:hover {
        transform: rotate(90deg);
    }

    .search-swap-btn.is-spinning {
        transform: rotate(270deg);
    }

    .passenger-stepper {
        width: 100%;
    }

    .search-btn-primary {
        width: 100%;
        justify-content: center;
        height: 52px;
        font-size: 1rem;
    }
}
