/**
 * DW Membership Requests — popup styles.
 *
 * Ported 1:1 from the FM Presales popup, minus everything the Reserve flow
 * does not use (order summary, card fields, liability waiver).
 *
 * Two things about the selectors:
 *
 * 1. Every rule inside the popup is scoped to `#dwmrModal`. The presales
 *    version got away with plain classes because it printed its CSS in the
 *    footer AND carried inline styles on the title and headings. This file is
 *    enqueued in the head, where an Elementor kit rule (`.elementor-kit-5 h2`,
 *    specificity 0,1,1) would beat a bare class (0,1,0) and blow up the title
 *    and the buttons. An id (1,0,0) settles it without a single !important.
 * 2. The reset block below neutralises what a theme or Elementor kit injects
 *    into headings, buttons and inputs (letter-spacing, text-transform, line
 *    height, min-height), so the popup looks the same on any page.
 *
 * Everything is prefixed dwmr- so this popup and the FM Presales popup can
 * sit on the same page without touching each other.
 */

/* ------------------------------------------------------------------ reset */

#dwmrModal,
#dwmrModal * {
    box-sizing: border-box;
}

#dwmrModal h2,
#dwmrModal h3,
#dwmrModal h4,
#dwmrModal p,
#dwmrModal span,
#dwmrModal label,
#dwmrModal button,
#dwmrModal input,
#dwmrModal select {
    font-family: inherit;
    letter-spacing: normal;
    text-transform: none;
}

#dwmrModal h2,
#dwmrModal h3,
#dwmrModal h4 {
    margin: 0;
    padding: 0;
    font-weight: normal;
    line-height: 1.3;
}

#dwmrModal p {
    margin: 0 0 10px;
    line-height: 1.4;
}

#dwmrModal button {
    box-shadow: none;
    min-height: 0;
    text-shadow: none;
}

#dwmrModal input,
#dwmrModal select {
    min-height: 0;
    height: auto;
    box-shadow: none;
    border-radius: 0;
    font-size: 14px;
    line-height: 1.4;
    color: #333;
}

/* -------------------------------------------------------------- container */

#dwmrModal {
    display: none;
    position: fixed;
    /* Above Elementor's own overlays, sticky headers and popups, which set
       high z-indexes of their own (some with !important) */
    z-index: 99999 !important;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    padding: 20px 10px;
    background-color: rgba(0, 0, 0, 0.4);
}

/*
 * Flex + `margin: auto` on the box centres it on both axes, and — unlike
 * `align-items: center` — keeps the top reachable when the popup is taller
 * than the viewport instead of cutting it off.
 */
#dwmrModal.dwmr-open {
    display: flex;
}

#dwmrModal .dwmr-modal-content {
    position: relative;
    border-radius: 8px;
    background-color: #ffffff;
    margin: auto;
    padding: 0;
    border: 1px solid #ddd;
    width: 100%;
    max-width: 770px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

#dwmrModal .dwmr-modal-container {
    margin: 0 133px auto;
    padding: 30px;
}

@media (max-width: 768px) {
    #dwmrModal .dwmr-modal-container {
        margin: 0 10px auto;
    }
}

#dwmrModal .dwmr-modal-header {
    background: #ffffff;
    border-top: 1px solid #d5d9de;
    border-bottom: 1px solid #d5d9de;
    border-top-left-radius: 3px;
    border-top-right-radius: 3px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: relative;
    margin-top: 40px;
    margin-bottom: 20px;
}

#dwmrModal .dwmr-header-bar {
    display: flex;
    justify-content: flex-start;
    position: relative;
}

#dwmrModal .dwmr-header-bar img {
    width: 180px;
    height: 60px;
    margin: 10px 30px;
}

#dwmrModal .dwmr-modal-close-btn {
    position: absolute;
    right: 10px;
    top: 10px;
    font-size: 28px;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    color: #000;
    text-decoration: none;
}

#dwmrModal .dwmr-modal-close-btn:hover {
    color: #696c74;
}

/* ----------------------------------------------------------------- screens */

#dwmrModal .dwmr-screen {
    display: none;
}

#dwmrModal .dwmr-screen.active {
    display: block;
}

/* Membership title (presales: inline styles on #fm-main-title) */
#dwmrModal .dwmr-title {
    color: #696c74;
    margin: 0 0 5px;
    font-size: 14px;
    font-weight: 200;
    line-height: 1.3;
    text-align: left;
    display: flex;
    align-items: center;
    white-space: nowrap;
    justify-content: center;
}

#dwmrModal .dwmr-title .dwmr-title-text {
    max-width: 400px;
    text-wrap: wrap;
    white-space: normal;
}

#dwmrModal .dwmr-section-heading {
    text-align: left;
    color: #333;
    font-size: 13px !important;
    font-weight: 600;
    margin: 0 0 5px;
    text-transform: uppercase !important;
}

/* Screen 1 detail rows */
#dwmrModal .dwmr-schedule {
    background-color: #ffffff;
    padding: 0;
    border-radius: 5px;
    margin-bottom: 20px;
    border: 1px solid #e0e0e0;
}

#dwmrModal .dwmr-schedule-item {
    padding: 7px 20px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
    color: #acb0b6;
}

#dwmrModal .dwmr-schedule-item:last-child {
    border-bottom: none;
}

#dwmrModal .dwmr-schedule-item strong {
    color: #0A7C8E;
    font-weight: bold;
}

#dwmrModal .dwmr-screen-note {
    margin: 25px 0;
    padding: 15px;
    border-radius: 5px;
    font-size: 6px;
    line-height: 1.4;
    color: #696c74;
    text-align: center;
}

/* Description toggle */
#dwmrModal .dwmr-toggle-arrow {
    margin-left: 5px;
    cursor: pointer;
    font-size: 10px;
    color: #058AB5;
    transition: transform 0.3s ease;
    flex-shrink: 0;
    user-select: none;
}

#dwmrModal .dwmr-toggle-arrow:hover {
    color: #04a3d7;
    transform: scale(1.1);
}

#dwmrModal .dwmr-toggle-arrow.rotated {
    transform: rotate(180deg);
}

#dwmrModal .dwmr-description {
    display: none;
    margin: 15px 0;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 5px;
    border-left: 4px solid #058AB5;
    text-align: left;
    font-size: 10px;
    animation: dwmrFadeIn 0.3s ease-in-out;
}

@keyframes dwmrFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#dwmrModal .dwmr-description h4 {
    margin-top: 0;
}

#dwmrModal .dwmr-description ul {
    color: #555;
}

#dwmrModal .dwmr-description li {
    margin-bottom: 5px;
}

#dwmrModal .dwmr-description p {
    color: #696c74;
    line-height: 1.5;
}

/* ------------------------------------------------------------------- form */

#dwmrModal .dwmr-input-group {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
}

#dwmrModal .dwmr-input-label {
    display: flex;
    border-bottom: 1px solid #ddd;
    flex-direction: column;
    position: relative;
    color: #a0a5ab;
    margin-top: 0;
    font-size: 14px;
    font-weight: normal;
}

#dwmrModal .dwmr-input-field {
    width: 100%;
    padding: 10px 0;
    margin-top: 10px;
    border: none !important;
    outline: none;
    background: transparent !important;
}

#dwmrModal .dwmr-input-label:focus-within,
#dwmrModal .dwmr-input-label:focus-within > span,
#dwmrModal .dwmr-input-field:not(:placeholder-shown) + span {
    font-weight: bold;
    transform: translateY(0px);
    color: #0A7C8E;
    border-color: #0A7C8E;
}

#dwmrModal .dwmr-custom-label-span {
    position: absolute;
    top: 0;
    left: 0;
    transform: translateY(30px);
    font-size: 14px;
    transition-duration: 300ms;
}

#dwmrModal .dwmr-input-field.dwmr-input-error {
    border-bottom: 1px solid #dc3545 !important;
}

#dwmrModal input.dwmr-input-field:-webkit-autofill {
    -webkit-box-shadow: 0 0 0px 1000px white inset !important;
    box-shadow: 0 0 0px 1000px white inset !important;
    -webkit-text-fill-color: #8b8d94 !important;
    transition: background-color 5000s ease-in-out 0s;
    color: #8b8d94 !important;
}

/* Honeypot — hidden from people, visible to naive bots */
#dwmrModal .dwmr-hp-field {
    position: absolute !important;
    left: -9999px !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* SMS consent (presales: .fm-sms-consent, 6px) */
#dwmrModal .dwmr-sms-consent {
    font-size: 6px;
    color: #696c74;
    text-align: center;
    line-height: 1.3;
    margin: 15px 0;
}

#dwmrModal .dwmr-sms-consent p {
    margin-bottom: 0;
}

/* Next / Reserve Now (presales: .fm-btn) */
#dwmrModal .dwmr-btn {
    background-color: #058AB5;
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    margin: 10px auto;
    width: 200px;
    max-width: 100%;
    font-size: 15px;
    font-weight: normal;
    line-height: 1.4;
    display: block;
    font-weight: 700;
}

#dwmrModal .dwmr-btn:hover {
    background-color: #04a3d7;
    color: white;
}

#dwmrModal .dwmr-btn:disabled {
    background-color: #f4f4e4 !important;
    color: #999 !important;
    cursor: not-allowed;
    opacity: 0.6;
}

#dwmrModal .dwmr-btn.enabled {
    background-color: #058AB5;
    color: white;
    cursor: pointer;
}

/* Spinner */
#dwmrModal .dwmr-spinner-container {
    display: none;
    text-align: center;
    padding: 20px;
}

#dwmrModal .dwmr-spinner-container img {
    width: 50px;
    height: 50px;
}

/* Messages */
#dwmrModal .dwmr-error {
    color: #dc3545;
    font-size: 12px;
    margin-top: 5px;
    text-align: center;
}

#dwmrModal .dwmr-success {
    color: #000;
    font-size: 14px;
    text-align: center;
    padding: 20px;
}

#dwmrModal .dwmr-success #dwmr-success-text {
    margin-bottom: 20px !important;
}

#dwmrModal .dwmr-success h3 {
    font-size: 32px;
    margin-bottom: 10px;
    font-weight: 600;
    font-family: Montserrat, sans-serif;
}

/* --------------------------------------------------------------- triggers */

/*
 * The shortcode button lives out in the page, where an Elementor kit rule for
 * `button` (0,1,1) would beat a single class. The repeated class (0,2,0) wins
 * without !important, and style="none" leaves this class off entirely so the
 * theme owns the look.
 */
.dwmr-trigger-btn.dwmr-trigger-btn {
    display: inline-block;
    font-family: Montserrat, sans-serif;
    font-weight: 700;
    font-size: 16px;
    line-height: 100%;
    text-align: center;
    background: #058AB5;
    border-radius: 50px;
    padding: 10px 52px;
    color: #FFF;
    border: none !important;
}

.dwmr-trigger-btn.dwmr-trigger-btn:hover,
.dwmr-trigger-btn.dwmr-trigger-btn:focus {
    background-color: #058AB5;
    color: #ffffff;
}

/*
 * Disabled trigger — the Reserve flow is off for this location.
 *
 * It is the button above with one extra class: it carries the same
 * .dwmr-trigger-btn rules, so every size, font, shape and media query written
 * for the real button applies to it unchanged, and editing that rule moves
 * both. This block is only the disabled colour, so it is the place to change
 * how "off" looks. Three classes (0,3,0) so it wins over the doubled class
 * above no matter where either rule sits in the file; `background`, not
 * `background-color`, because the rule above uses the shorthand.
 *
 * The last selectors catch style="none", where the theme owns the look.
 */
.dwmr-trigger-btn.dwmr-trigger-btn.dwmr-trigger-btn-off,
.dwmr-trigger-btn.dwmr-trigger-btn.dwmr-trigger-btn-off:hover,
.dwmr-trigger-btn.dwmr-trigger-btn.dwmr-trigger-btn-off:focus,
.dwmr-trigger-unavailable button[disabled],
.dwmr-trigger-unavailable button[disabled]:hover,
.dwmr-trigger-unavailable button[disabled]:focus {
    background: #b9c0c6;
    color: #ffffff;
    cursor: not-allowed;
    opacity: 1;
    box-shadow: none;
}

/* Enclosing shortcode: the author's own markup is the trigger */
.dwmr-trigger {
    display: inline-block;
    cursor: pointer;
}

/*
 * Trigger loading state.
 *
 * Until the popup script has bound its click handler AND the content and nonce
 * have arrived over admin-ajax, every trigger is inert and shows a spinner in
 * place of its label, so a click in that first moment can not be swallowed.
 * `dwmr-ready` lands on <body> the moment the popup can really open — tied to
 * actual readiness rather than a fixed timer — with a failsafe so the buttons
 * can never spin forever.
 *
 * Covers both placements of the attribute: on the button itself, and on an
 * Elementor button wrapper (`.elementor-button` inside). Put
 * `dwmr-no-spinner` on a trigger to opt out.
 */
body:not(.dwmr-ready) [data-dw-membership]:not(.dwmr-no-spinner),
body:not(.dwmr-ready) [data-dw-membership]:not(.dwmr-no-spinner) .elementor-button {
    position: relative;
    pointer-events: none;
    color: transparent !important;
    transition: color 0.2s;
}

body:not(.dwmr-ready) [data-dw-membership]:not(.dwmr-no-spinner):not(:has(.elementor-button))::after,
body:not(.dwmr-ready) [data-dw-membership]:not(.dwmr-no-spinner) .elementor-button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: dwmr-btn-spin 0.7s linear infinite;
}

@keyframes dwmr-btn-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    body:not(.dwmr-ready) [data-dw-membership]:not(.dwmr-no-spinner):not(:has(.elementor-button))::after,
    body:not(.dwmr-ready) [data-dw-membership]:not(.dwmr-no-spinner) .elementor-button::after {
        animation: none;
    }
}

@media (max-width: 768px) {
    .dwmr-trigger-btn.dwmr-trigger-btn {
        font-size: 15px;
        padding: 7px 20px;
        border: 1px solid #FFF;
    }
    
}

/*
 * Text under the spinner. After a successful submit it reads "Redirecting…"
 * and the Reserve Now button stays hidden until the browser navigates —
 * otherwise the button came back, the form reset behind it, and the visitor
 * was left looking at a disabled button for the length of the redirect.
 */
#dwmrModal .dwmr-busy-note {
    margin-top: 10px;
    font-size: 13px;
    line-height: 1.4;
    color: #696c74;
    text-align: center;
}

/*
 * Inline field message — used by the phone check against the shared
 * /wp-json/phone/v1/validate endpoint. Red for a verdict, grey while the
 * request is in flight.
 */
#dwmrModal .dwmr-field-error {
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.4;
    color: #dc3545;
    text-align: left;
}

#dwmrModal .dwmr-field-error.dwmr-checking {
    color: #696c74;
}
