/* =============================================================================
   OPZAC Booking Modal — Styles
   All selectors scoped under .opzac-* to avoid Travivu theme conflicts.
   ============================================================================= */

/* ─── Overlay ─────────────────────────────────────────────────────────────── */

.opzac-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

/* ─── Modal Container ─────────────────────────────────────────────────────── */

.opzac-modal {
    background: #ffffff;
    width: 100%;
    max-width: 580px;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    color: #2c3e50;
    box-sizing: border-box;
}

.opzac-modal *,
.opzac-modal *::before,
.opzac-modal *::after {
    box-sizing: border-box;
}

/* ─── Header ──────────────────────────────────────────────────────────────── */

.opzac-modal__header {
    background: #1a73e8;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.opzac-modal__title {
    color: #ffffff;
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    padding: 0;
    border: none;
    line-height: 1.3;
}

.opzac-modal__close {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    line-height: 1;
    flex-shrink: 0;
    transition: background 0.15s;
}

.opzac-modal__close:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* ─── Step Indicator ──────────────────────────────────────────────────────── */

.opzac-modal__steps {
    border-bottom: 1px solid #e8e8e8;
    padding: 16px 24px;
    flex-shrink: 0;
    background: #fff;
}

.opzac-steps {
    display: flex;
    align-items: flex-start;
    padding: 0;
    margin: 0;
    list-style: none;
}

.opzac-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.opzac-steps__connector {
    flex: 1;
    height: 2px;
    background: #e0e0e0;
    margin-top: 13px; /* align with vertical center of 28px circles */
    transition: background 0.2s;
}

.opzac-steps__connector--completed {
    background: #1a73e8;
}

.opzac-step__circle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #e0e0e0;
    color: #9e9e9e;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}

.opzac-step--active .opzac-step__circle {
    background: #1a73e8;
    color: #ffffff;
}

.opzac-step--completed .opzac-step__circle {
    background: #1a73e8;
    color: #ffffff;
}

.opzac-step__label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #9e9e9e;
    transition: color 0.2s;
    white-space: nowrap;
}

.opzac-step--active .opzac-step__label {
    color: #1a73e8;
    font-weight: 700;
}

.opzac-step--completed .opzac-step__label {
    color: #1a73e8;
}

/* ─── Modal Body ──────────────────────────────────────────────────────────── */

.opzac-modal__body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    -webkit-overflow-scrolling: touch;
}

/* ─── Modal Footer ────────────────────────────────────────────────────────── */

.opzac-modal__footer {
    border-top: 1px solid #f0f0f0;
    padding: 16px 24px;
    background: #fafafa;
    flex-shrink: 0;
}

.opzac-footer__actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.opzac-footer__actions--end {
    justify-content: flex-end;
}

.opzac-footer__actions--between {
    justify-content: space-between;
}

/* =============================================================================
   STEP 1 — Calendar
   ============================================================================= */

.opzac-calendar__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.opzac-calendar__month {
    font-size: 17px;
    font-weight: 700;
    color: #2c3e50;
    margin: 0;
    padding: 0;
}

.opzac-calendar__nav {
    display: flex;
    gap: 8px;
}

.opzac-calendar__nav-btn {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    font-size: 20px;
    line-height: 1;
    transition: background 0.1s;
}

.opzac-calendar__nav-btn:hover:not(:disabled) {
    background: #f5f6fa;
}

.opzac-calendar__nav-btn:disabled {
    color: #cccccc;
    cursor: not-allowed;
}

.opzac-calendar__grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    text-align: center;
}

.opzac-calendar__weekday {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: #9e9e9e;
    padding: 8px 0;
    letter-spacing: 0.03em;
}

.opzac-calendar__day {
    padding: 10px 4px;
    font-size: 13px;
    font-weight: 600;
    color: #2c3e50;
    cursor: pointer;
    border-radius: 6px;
    border: none;
    background: transparent;
    transition: background 0.12s;
    line-height: 1;
}

.opzac-calendar__day:hover:not(:disabled):not(.opzac-calendar__day--today):not(.opzac-calendar__day--selected) {
    background: #e8f0fd;
}

.opzac-calendar__day--empty {
    visibility: hidden;
    pointer-events: none;
}

.opzac-calendar__day--past {
    color: #cccccc;
    cursor: not-allowed;
}

.opzac-calendar__day--today {
    background: #9e9e9e;
    color: #ffffff;
    font-weight: 700;
    border-radius: 50%;
}

.opzac-calendar__day--selected {
    background: #1a73e8;
    color: #ffffff;
    font-weight: 700;
    border-radius: 50%;
}

/* When today is also selected, blue wins over grey */
.opzac-calendar__day--today.opzac-calendar__day--selected {
    background: #1a73e8;
    box-shadow: 0 2px 6px rgba(26, 115, 232, 0.35);
}

.opzac-calendar__hint {
    font-size: 13px;
    color: #7f8c8d;
    margin: 16px 0 0;
}

/* =============================================================================
   STEP 2 — Departure Cards
   ============================================================================= */

.opzac-departures__loading {
    text-align: center;
    color: #7f8c8d;
    padding: 32px 0;
    font-size: 14px;
}

.opzac-departures__list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.opzac-departure-card {
    width: 100%;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    background: #ffffff;
    border-left-width: 4px;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
    font-family: inherit;
    font-size: inherit;
}

.opzac-departure-card:hover:not([disabled]):not(.opzac-departure-card--soldout) {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.opzac-departure-card--available {
    border-left-color: #2ecc71;
    background: #f9fffe;
}

.opzac-departure-card--low {
    border-left-color: #f39c12;
    background: #fff8e1;
}

.opzac-departure-card--soldout {
    border-left-color: #e74c3c;
    background: #fff5f5;
    opacity: 0.65;
    cursor: not-allowed;
    pointer-events: none;
}

.opzac-departure-card--selected {
    border: 2px solid #1a73e8 !important;
    border-left: 2px solid #1a73e8 !important;
    background: #f0f7ff !important;
}

.opzac-departure-card__time {
    font-size: 16px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 2px;
}

.opzac-departure-card--soldout .opzac-departure-card__time {
    color: #9e9e9e;
}

.opzac-departure-card__availability {
    font-size: 13px;
    font-weight: 500;
    margin: 0;
}

.opzac-departure-card--available .opzac-departure-card__availability {
    color: #27ae60;
}

.opzac-departure-card--low .opzac-departure-card__availability {
    color: #e67e22;
}

.opzac-departure-card--soldout .opzac-departure-card__availability {
    color: #e74c3c;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.05em;
}

.opzac-departure-card__badge {
    display: inline-block;
    background: #fff3cd;
    color: #856404;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 8px;
    border-radius: 100px;
    margin-top: 4px;
}

.opzac-departure-card__radio {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #d0d0d0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: border-color 0.15s;
}

.opzac-departure-card--selected .opzac-departure-card__radio {
    border-color: #1a73e8;
}

.opzac-departure-card__radio-dot {
    display: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #1a73e8;
}

.opzac-departure-card--selected .opzac-departure-card__radio-dot {
    display: block;
}

/* =============================================================================
   STEP 3 — Passenger Counter
   ============================================================================= */

.opzac-passengers__list {
    display: flex;
    flex-direction: column;
}

.opzac-passenger-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid #f0f0f0;
    gap: 8px;
}

.opzac-passenger-row:last-of-type {
    border-bottom: none;
}

.opzac-passenger-row__info {
    flex: 1;
    min-width: 0;
}

.opzac-passenger-row__label {
    font-size: 15px;
    font-weight: 700;
    color: #2c3e50;
    margin: 0 0 2px;
}

.opzac-passenger-row__price {
    font-size: 13px;
    color: #7f8c8d;
    margin: 0;
}

.opzac-passenger-row__controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.opzac-passenger-row__subtotal {
    font-size: 13px;
    color: #555555;
    min-width: 90px;
    text-align: right;
}

.opzac-counter {
    display: flex;
    align-items: center;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    overflow: hidden;
}

.opzac-counter__btn {
    width: 32px;
    height: 32px;
    background: #f5f5f5;
    border: none;
    cursor: pointer;
    font-size: 16px;
    font-weight: 700;
    color: #333333;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.1s;
    flex-shrink: 0;
    font-family: inherit;
}

.opzac-counter__btn:hover:not(:disabled) {
    background: #e8e8e8;
}

.opzac-counter__btn:disabled {
    color: #bbbbbb;
    cursor: not-allowed;
}

.opzac-counter__value {
    width: 36px;
    text-align: center;
    font-size: 15px;
    font-weight: 700;
    color: #2c3e50;
    border-left: 1px solid #d0d0d0;
    border-right: 1px solid #d0d0d0;
    line-height: 32px;
    display: block;
}

.opzac-passengers__total {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 16px;
    margin-top: 8px;
    border-top: 2px solid #e0e0e0;
}

.opzac-passengers__total-label {
    font-size: 16px;
    color: #7f8c8d;
}

.opzac-passengers__total-amount {
    font-size: 22px;
    font-weight: 700;
    color: #f39c12;
}

.opzac-passengers__error {
    color: #e74c3c;
    font-size: 13px;
    margin-top: 10px;
    display: none;
}

/* =============================================================================
   STEP 4 — Summary
   ============================================================================= */

.opzac-summary__card {
    background: #f5f6fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.opzac-summary__title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #7f8c8d;
    margin: 0 0 16px;
    padding: 0;
}

.opzac-summary__row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 10px 0;
    border-bottom: 1px solid #e8e8e8;
    font-size: 14px;
    gap: 16px;
}

.opzac-summary__row:last-child {
    border-bottom: none;
    padding-top: 14px;
    margin-top: 4px;
}

.opzac-summary__row-label {
    color: #7f8c8d;
    flex-shrink: 0;
}

.opzac-summary__row-value {
    font-weight: 500;
    color: #2c3e50;
    text-align: right;
}

.opzac-summary__row--total .opzac-summary__row-label,
.opzac-summary__row--total .opzac-summary__row-value {
    font-size: 16px;
    font-weight: 700;
    color: #2c3e50;
}

.opzac-summary__footer {
    text-align: center;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #bdbdbd;
    margin: 16px 0 0;
}

/* =============================================================================
   Buttons
   ============================================================================= */

.opzac-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
    font-size: 14px;
    text-decoration: none;
    font-family: inherit;
    line-height: 1;
}

/* Blue navigation button (Continuar / Siguiente) */
.opzac-btn--primary {
    background: #1a73e8;
    color: #ffffff;
    padding: 10px 28px;
    min-height: 44px;
}

.opzac-btn--primary:hover:not(:disabled) {
    background: #1557b0;
    color: #ffffff;
    text-decoration: none;
}

.opzac-btn--primary:disabled {
    background: #9e9e9e;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Ghost back button (← Anterior) */
.opzac-btn--ghost {
    background: transparent;
    color: #555555;
    padding: 10px 16px;
    border: 1px solid #d0d0d0;
    min-height: 44px;
    border-radius: 6px;
}

.opzac-btn--ghost:hover {
    background: #f5f5f5;
    color: #333333;
    text-decoration: none;
}

/* Green CTA button (Proceder al Pago) — full width */
.opzac-btn--cta {
    background: #27ae60;
    color: #ffffff;
    width: 100%;
    padding: 14px;
    min-height: 52px;
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 8px;
    display: flex;
}

.opzac-btn--cta:hover:not(:disabled) {
    background: #219a52;
    color: #ffffff;
    text-decoration: none;
}

.opzac-btn--cta:disabled {
    background: #9e9e9e;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Plain back link */
.opzac-btn--back {
    display: block;
    width: 100%;
    text-align: center;
    background: transparent;
    border: none;
    color: #7f8c8d;
    font-size: 13px;
    cursor: pointer;
    padding: 10px;
    margin-top: 8px;
    font-family: inherit;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.1s;
}

.opzac-btn--back:hover {
    color: #333333;
    text-decoration: none;
}

/* =============================================================================
   Responsive — Mobile (≤ 768px)
   ============================================================================= */

@media (max-width: 768px) {
    .opzac-modal-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .opzac-modal {
        max-width: 100%;
        width: 100%;
        border-radius: 20px 20px 0 0;
        max-height: 95vh;
    }

    .opzac-modal__header {
        padding: 14px 16px;
    }

    .opzac-modal__steps {
        padding: 14px 16px;
    }

    .opzac-modal__body {
        padding: 16px;
    }

    .opzac-modal__footer {
        padding: 12px 16px;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }

    .opzac-step__label {
        font-size: 9px;
    }

    .opzac-calendar__day {
        padding: 10px 2px;
        font-size: 14px;
    }

    .opzac-passenger-row__subtotal {
        display: none;
    }

    .opzac-btn--cta {
        min-height: 56px;
        font-size: 15px;
    }
}

@media (max-width: 380px) {
    .opzac-modal__steps {
        padding: 12px 8px;
    }

    .opzac-step__label {
        font-size: 8px;
    }

    .opzac-step__circle {
        width: 24px;
        height: 24px;
        font-size: 11px;
    }

    .opzac-steps__connector {
        margin-top: 11px; /* recenter for smaller circles */
    }
}

/* =============================================================================
   Submit error (OB-008)
   ============================================================================= */

.opzac-submit-error {
    color: #e74c3c;
    font-size: 13px;
    margin-top: 12px;
    padding: 8px 12px;
    background: #fdecea;
    border-radius: 4px;
    border: 1px solid #e74c3c;
    text-align: center;
}

/* ═══════════════════════════════════════════════════════════════════════════
   LOADING OVERLAY — shown during AJAX requests (OB-025)
   z-index 999999 to appear above the booking modal overlay (99999).
   ═══════════════════════════════════════════════════════════════════════════ */

.opzac-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(13, 45, 107, 0.72);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.opzac-loading-overlay.is-visible {
    opacity: 1;
    pointer-events: all;
}

.opzac-loading-overlay__card {
    background: #fff;
    border-radius: 1rem;
    padding: 2.5rem 2.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.125rem;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
    text-align: center;
    max-width: 320px;
    width: 90%;
}

.opzac-loading-overlay__spinner {
    width: 52px;
    height: 52px;
    border: 4px solid #e5e7eb;
    border-top-color: #27ae60;
    border-radius: 50%;
    animation: opzac-modal-spin 0.75s linear infinite;
    flex-shrink: 0;
}

@keyframes opzac-modal-spin {
    to { transform: rotate(360deg); }
}

.opzac-loading-overlay__title {
    font-size: 1.0625rem;
    font-weight: 700;
    color: #0d2d6b;
    margin: 0;
    line-height: 1.3;
}

.opzac-loading-overlay__subtitle {
    font-size: 0.8125rem;
    color: #9ca3af;
    margin: 0;
    line-height: 1.55;
}
