/**
 * Form shortcode styles — popup wizard redesign (issue #685).
 *
 * @package    wp_roomcloud
 * @subpackage wp_roomcloud/public/css
 */

/* ==========================================================================
   Form wrapper
   ========================================================================== */

.roomcloud-form {
    position: relative;
}

/* ==========================================================================
   Desktop pill bar
   ========================================================================== */

.wpr-pill-bar {
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 60px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    width: 100%;
}

.wpr-pill-sep {
    display: block;
    width: 1px;
    height: 24px;
    background: #e0e0e0;
    flex-shrink: 0;
}

/* Trigger buttons */
.wpr-trigger {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    flex: 1;
    padding: 0.5rem 1.25rem;
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s ease;
    min-width: 0;
    font-family: inherit;
}

.wpr-trigger:hover,
.wpr-trigger:focus-visible {
    background: #f5f5f5;
    outline: none;
}

.wpr-trigger-label {
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #666;
    white-space: nowrap;
    line-height: 1.2;
    margin-bottom: 0.15rem;
}

.wpr-trigger-value {
    font-size: 0.875rem;
    font-weight: 500;
    color: #999;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    line-height: 1.3;
}

.wpr-trigger.has-value .wpr-trigger-value {
    color: #111;
}

/* Search (lupa) button */
.wpr-pill-search {
    display: flex!important;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    margin: 0.375rem;
    background: #00466e;
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease;
    font-size: 1rem;
}

.wpr-pill-search:hover {
    background: #003a5c;
}

.wpr-pill-search:focus-visible {
    outline: 3px solid rgba(0, 70, 110, 0.4);
    outline-offset: 2px;
}

.wpr-pill-search:active {
    transform: scale(0.95);
}

.wpr-pill-search .dashicons {
    font-size: 1.125rem;
    width: 1.125rem;
    height: 1.125rem;
    line-height: 1;
}

/* ==========================================================================
   Mobile CTA (visible only on mobile, hidden on desktop)
   ========================================================================== */

.wpr-mobile-cta {
    display: none;
}

.wpr-cta-btn {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    width: auto;
    padding: 0.625rem 1.25rem;
    background: #fff;
    color: #666;
    border: none;
    border-radius: 60px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    font-size: 0.875rem;
    font-family: inherit;
    transition: background 0.15s ease;
}

.wpr-cta-btn:hover,
.wpr-cta-btn:focus-visible {
    background: #f5f5f5;
    outline: none;
}

.wpr-cta-btn .dashicons {
    color: #999;
    font-size: 1.125rem;
    width: 1.125rem;
    height: 1.125rem;
    flex-shrink: 0;
}

.wpr-cta-summary {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    line-height: 1.3;
    text-align: left;
}

.wpr-cta-line1 {
    font-size: 0.875rem;
}

.wpr-cta-hotel {
    font-weight: 700;
}

.wpr-cta-guests {
    font-size: 0.875rem;
}

.wpr-cta-dates {
    font-size: 0.75rem;
    opacity: 0.85;
}

/* ==========================================================================
   Modal overlay
   ========================================================================== */

.wpr-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1050;
    cursor: pointer;
}

.wpr-modal-overlay.is-active {
    display: block;
}

/* ==========================================================================
   Step modals
   ========================================================================== */

/*
 * IMPORTANT: do NOT add `display` to this base rule.
 * The HTML `hidden` attribute maps to `display:none` in the UA stylesheet
 * (specificity [0,1,0]).  A class-selector author rule at the same
 * specificity but later in the cascade would override it, making all step
 * modals visible at all times.  Display is set only in the :not([hidden])
 * rule below so that `hidden` correctly hides off-screen wizard instances
 * (e.g. the [roomcloud_rooms] booking wizard).
 */
.wpr-step-modal {
    position: fixed;
    z-index: 999999;
    background: #fff;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);

    /* Desktop: centred below the header area */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    max-width: 480px;
    border-radius: 1rem;
    overflow: hidden;
    /* flex-direction and max-height are declared here for convenience;
       they have no effect while display:none is in force. */
    flex-direction: column;
    max-height: 85vh;
}

/* Shown state: JS removes the `hidden` attribute to display the modal. */
.wpr-step-modal:not([hidden]) {
    display: flex;
}

/* ==========================================================================
   Modal header
   ========================================================================== */

.wpr-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.25rem 0.75rem;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.wpr-modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #111;
    margin: 0;
    line-height: 1.3;
}

.wpr-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: #666;
    transition: background 0.15s ease, color 0.15s ease;
    flex-shrink: 0;
    font-size: 1rem;
}

.wpr-modal-close:hover {
    background: #f0f0f0;
    color: #111;
}

.wpr-modal-close .dashicons {
    font-size: 1.125rem;
    width: 1.125rem;
    height: 1.125rem;
    line-height: 1;
}

/* ==========================================================================
   Modal body
   ========================================================================== */

.wpr-modal-body {
    padding: 1rem 1.25rem 1.5rem;
    overflow-y: auto;
    flex: 1;
    /* Prevent the modal's internal scroll from propagating to the page when it
       reaches the top or bottom (scroll-chaining). Critical for iOS Safari. */
    overscroll-behavior: contain;
}

/* ==========================================================================
   Hotel list
   ========================================================================== */

.wpr-hotel-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.wpr-hotel-list li {
    margin: 0;
    padding: 0;
}

.wpr-hotel-option {
    display: flex!important;
    align-items: center!important;
    width: 100%!important;
    padding: 0.875rem 1rem!important;
    background: #fff!important;
    border: 1px solid #e8e8e8!important;
    border-radius: 0.75rem!important;
    cursor: pointer!important;
    text-align: left!important;
    font-size: 1rem!important;
    font-weight: 500!important;
    color: #111!important;
    font-family: inherit!important;
    transition: background 0.15s ease, border-color 0.15s ease!important;
}

.wpr-hotel-option:hover,
.wpr-hotel-option:focus-visible {
    background: #f5f9fc!important;
    border-color: #00466e!important;
    outline: none!important;
}

.wpr-hotel-option.is-selected {
    background: #f0f7fb!important;
    border-color: #00466e!important;
    color: #00466e!important;
}

/* ==========================================================================
   Dates modal — AirDatepicker inline
   ========================================================================== */

/* Widen the dates modal to comfortably contain the inline calendar. */
.wpr-step-modal[data-step="dates"] {
    max-width: 440px;
}

.wpr-step-modal[data-step="dates"] .wpr-modal-body {
    padding: 1rem 1rem 1.25rem;
    overflow: visible; /* calendar does not need inner scroll */
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Wrapper that holds the calendar + the clear button */
.wpr-air-datepicker-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
}

/* The div AirDatepicker renders into — no extra constraints needed */
.wpr-adp-container {
    width: 100%;
    display: flex;
    justify-content: center;
}

/* Override AirDatepicker CSS custom properties to match plugin colour scheme */
.wpr-adp-container .air-datepicker {
    --adp-accent-color: #00466e;
    --adp-color-secondary: #003a5c;
    --adp-cell-background-color-selected: #00466e;
    --adp-cell-background-color-selected-hover: #003a5c;
    --adp-cell-background-color-in-range: rgba(0, 70, 110, 0.1);
    --adp-cell-background-color-in-range-focused: rgba(0, 70, 110, 0.2);
    --adp-nav-action-color: #00466e;
    /* Bigger cells to match reference design */
    --adp-cell-height: 42px;
    --adp-cell-width: 42px;
    --adp-font-size: 15px;
    --adp-day-name-color: #00466e;
    border: none;
    box-shadow: none;
    font-family: inherit;
    width: 100%;
}

.wpr-adp-container .air-datepicker-nav--title {
    font-size: 1rem;
    font-weight: 600;
}

/* ==========================================================================
   Dates modal — footer (check-in / check-out display + Next button)
   ========================================================================== */

.wpr-dates-footer {
    width: 100%;
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.wpr-dates-footer-fields {
    display: flex;
    align-items: center;
    border: 1px solid #dde3e8;
    border-radius: 8px;
    overflow: hidden;
}

.wpr-dates-footer-field {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0.6rem 1rem;
    gap: 0.15rem;
}

.wpr-dates-footer-divider {
    width: 1px;
    align-self: stretch;
    background: #dde3e8;
}

.wpr-dates-footer-label {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #888;
}

.wpr-dates-footer-value {
    font-size: 0.9375rem;
    font-weight: 500;
    color: #1a2e3b;
}

.wpr-dates-next,
.wpr-guests-next,
.wpr-summary-submit {
    width: 100%!important;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
}


@media (max-width: 768px) {
    .wpr-step-modal[data-step="dates"] {
        max-width: 100%;
        z-index: 99999; /* above the daterangepicker */
    }
}

/* ==========================================================================
   Guests modal
   ========================================================================== */

.wpr-guest-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f0f0f0;
    gap: 1rem;
}

.wpr-guest-row:last-of-type {
    border-bottom: none;
}

.wpr-guest-row-label {
    font-size: 0.9375rem;
    color: #333;
    flex: 1;
}

.wpr-guest-buttons {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.wpr-guest-buttons .wpr-decrease,
.wpr-guest-buttons .wpr-increase {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.125rem;
    line-height: 1;
    color: #333;
    font-family: inherit;
    transition: background 0.12s ease, border-color 0.12s ease;
}

/*
 * iOS toma dos toques rápidos como doble toque y hace zoom. `manipulation`
 * desactiva solo ese gesto: el pinch-zoom de la página sigue funcionando.
 */
.wpr-step-modal,
.wpr-guest-buttons,
.wpr-guest-buttons button {
    touch-action: manipulation;
}

.wpr-guest-buttons .wpr-decrease:hover,
.wpr-guest-buttons .wpr-increase:hover {
    background: #f0f0f0;
    border-color: #999;
}

.wpr-guest-buttons .wpr-count {
    font-size: 1rem;
    font-weight: 600;
    min-width: 1.5rem;
    text-align: center;
    color: #111;
}

.wpr-guests-done-wrap {
    margin-top: 1.25rem;
    text-align: right;
}

.wpr-guests-done {
    padding: 0.625rem 1.5rem;
    font-size: 0.9375rem;
}

/* ==========================================================================
   Promo modal
   ========================================================================== */

.wpr-promo-field {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.wpr-promo-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid #e0e0e0;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.wpr-promo-input:focus {
    outline: 2px solid #00466e;
    outline-offset: 1px;
    border-color: #00466e;
}

.wpr-promo-confirm {
    flex-shrink: 0;
    padding: 0.625rem 1.25rem;
    font-size: 0.9375rem;
}

/* ==========================================================================
   Summary modal
   ========================================================================== */

.wpr-summary-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 0 0 1.5rem;
    padding: 0;
}

.wpr-summary-row {
    display: flex;
    align-items: center;
    padding: 0.875rem 0;
    border-bottom: 1px solid #f0f0f0;
    gap: 0.75rem;
}

.wpr-summary-row:last-child {
    border-bottom: none;
}

.wpr-summary-row dt {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #888;
    min-width: 90px;
    flex-shrink: 0;
}

.wpr-summary-value {
    flex: 1;
    font-size: 0.9375rem;
    font-weight: 500;
    color: #111;
    margin: 0;
}

.wpr-summary-edit {
    flex-shrink: 0;
    padding: 0.25rem 0.75rem;
    font-size: 0.8125rem;
    background: transparent;
    border: 1px solid #ccc;
    border-radius: 0.375rem;
    cursor: pointer;
    color: #555;
    font-family: inherit;
    transition: background 0.12s ease, border-color 0.12s ease;
}

.wpr-summary-edit:hover {
    background: #f5f5f5;
    border-color: #999;
}

.wpr-summary-submit {
    display: block;
    width: 100%;
    padding: 0.875rem;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    background: #00466e;
    color: #fff;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background 0.15s ease;
    font-family: inherit;
    float: right;
}

.wpr-summary-submit:hover {
    background: #003a5c;
}

/* ==========================================================================
   Responsive — Mobile (≤ 768px)
   ========================================================================== */

@media (max-width: 768px) {
    /* Hide pill bar, show CTA */
    .wpr-pill-bar {
        display: none;
    }

    .wpr-mobile-cta {
        display: flex;
        justify-content: center;
        flex-direction: column;
    }

    /* Modals go fullscreen */
    .wpr-step-modal {
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        transform: none;
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    /* Objetivo táctil de 44 px, separado del botón vecino. */
    .wpr-guest-buttons {
        gap: 1rem;
    }

    .wpr-guest-buttons .wpr-decrease,
    .wpr-guest-buttons .wpr-increase {
        width: 44px;
        height: 44px;
        flex-shrink: 0;
    }

    /* iOS hace zoom al enfocar un campo de menos de 16 px. */
    .wpr-step-modal select,
    .wpr-step-modal input:not([type="hidden"]) {
        font-size: 16px;
    }
}

/* ==========================================================================
   Legacy: wpr-guests-dropdown (used by non-wizard forms only)
   ========================================================================== */

.wpr-guests-dropdown {
    position: absolute;
    top: calc(100% + 0.25rem);
    right: 0;
    min-width: 250px;
    background: #fff;
    border: 1px solid #ccc;
    padding: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 10;
    display: none;
}

.wpr-guests-dropdown .roomcloud-field {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0.25rem 0;
}

/* Legacy compact spans (non-wizard mobile) */
.wpr-guests-compact,
.wpr-date-compact {
    display: none;
}

/* Legacy non-wizard forms still use daterangepicker — keep it above any overlay. */
.daterangepicker {
    z-index: 99999;
}