/* ── DATE FIELD LAYOUT ──────────────────────────────────── */

/* NOTE: every selector below is scoped with .elementor-field-type-date
   on purpose, not just .elementor-field-group-tourdate. The "Tour
   Details" section-heading field (an HTML-type field) happens to
   share the same custom ID ("tourdate"), so it carries the identical
   .elementor-field-group-tourdate class. Without the type qualifier,
   the display:flex + align-items:flex-start below hijacked that
   heading's layout too and made it impossible to center — this is
   what was actually blocking the "Tour Details" title alignment. */
.elementor-form .elementor-field-group.elementor-field-type-date.elementor-field-group-tourdate {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
}

.elementor-form .elementor-field-type-date.elementor-field-group-tourdate > .elementor-field-label {
    width: 100% !important;
    margin-bottom: 0.75rem !important;
}

/* Center the inline calendar */
.elementor-field-type-date.elementor-field-group-tourdate .flatpickr-calendar.inline {
    width: auto !important;
    max-width: 100%;
    margin: 0 auto !important;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.18) !important;
    border-radius: 8px !important;
}

.elementor-field-type-date.elementor-field-group-tourdate .flatpickr-calendar.inline.multiMonth {
    width: auto !important;
}

/* ── DAY GRID — EXACTLY 7 COLUMNS ────────────────────────
   Flatpickr lays its days out as a flex-wrap row and caps each
   day at max-width: 39.2857px. How many days land on a row is
   therefore floor(containerWidth / 39) — NOT a guaranteed 7.
   At flatpickr's own container width (307.875px) that happens
   to give 7. But the mobile block below stretches the container
   to the full screen width, and at ~348px it fits EIGHT days
   per row — so the grid silently rendered 8 columns against 7
   weekday headers, and every row-based calculation drifted.

   CSS Grid removes the arithmetic entirely: 7 columns, always,
   at any container width, on any device. */
.elementor-field-type-date.elementor-field-group-tourdate .dayContainer {
    display: grid !important;
    grid-template-columns: repeat(7, 1fr) !important;
}

.elementor-field-type-date.elementor-field-group-tourdate .flatpickr-day {
    max-width: none !important;
    width: auto !important;
}

/* ── HIDE ORIGINAL DATE INPUT ───────────────────────────── */

.di-tourdate-hidden-input,
.di-flex-calendar-input {
    position: absolute !important;
    opacity: 0 !important;
    pointer-events: none !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
}

/* ── FLEXIBLE DATE CHECKBOX — label + Yes/No on one line ─ */

.elementor-form .elementor-field-group.elementor-field-type-checkbox.elementor-field-group-flex,
.elementor-form .elementor-field-group.elementor-field-type-radio.elementor-field-group-flex {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-wrap: wrap !important;
    gap: 0.75rem 1rem !important;
    width: 100% !important;
    text-align: center !important;
}

/* Override Elementor's labels-above full-width rule */
.elementor-form .elementor-field-group.elementor-field-group-flex > .elementor-field-label,
.elementor-labels-above .elementor-field-group.elementor-field-group-flex > .elementor-field-label {
    width: auto !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
}

.elementor-form .elementor-field-group-flex .elementor-field-subgroup {
    display: flex !important;
    align-items: center !important;
    gap: 1rem !important;
    width: auto !important;
    flex: none !important;
    flex-wrap: nowrap !important;
}

/* ── YES/NO OPTION SIZING — flexible-tour + WhatsApp fields ─
   Both fields were switched from checkbox to radio inputs. This
   keeps the same 20px visible box and ~30px tap zone the
   checkboxes had, at every screen size (previously this only
   applied inside the tablet/mobile media query, leaving desktop
   on whatever the browser's native radio/checkbox size is). The
   LABEL (which natively toggles the input on tap) carries the
   padding that creates the tap zone, not the input itself. */
.elementor-form .elementor-field-group-flex .elementor-field-option,
.elementor-form .elementor-field-group-whatsapp .elementor-field-option {
    display: flex !important;
    align-items: center !important;
    gap: 0.35rem !important;
    margin: 0 !important;
    width: auto !important;
    flex: none !important;
    min-height: 30px;
    padding: 0.35rem 0.5rem;
}

.elementor-form .elementor-field-group-flex .elementor-field-option input[type="checkbox"],
.elementor-form .elementor-field-group-flex .elementor-field-option input[type="radio"],
.elementor-form .elementor-field-group-whatsapp .elementor-field-option input[type="checkbox"],
.elementor-form .elementor-field-group-whatsapp .elementor-field-option input[type="radio"] {
    width: 20px !important;
    height: 20px !important;
    min-width: 20px !important;
    min-height: 20px !important;
    margin: 5px !important;   /* ~5px on each side → 30px tap zone */
}

.elementor-form .elementor-field-group-flex .elementor-field-option label,
.elementor-form .elementor-field-group-whatsapp .elementor-field-option label {
    padding: 5px 0;
    min-height: 30px;
    display: inline-flex;
    align-items: center;
    font-size: 1.05rem;
    cursor: pointer;
}

/* ── SECTION HEADINGS — center the raw-HTML titles ───────
   "Tour Details", "Contact Details", "Anything Else?" are all
   HTML-type fields using this class. (The "Tour Details" one
   used to inherit display:flex/align-items:flex-start from the
   date-field-group rules above because it happens to share the
   same custom ID — see the note at the top of this file. That's
   now scoped away, so this can center it directly.) */
.elementor-form .form-section-title {
    text-align: center;
}

/* ── HIDE FULLY-PADDING TRAILING ROW ────────────────────── */

.flatpickr-day.di-hide-row {
    display: none !important;
}

/* ── SWIPE ANIMATION ─────────────────────────────────────── */

@keyframes diSwipeLeft {
    from { opacity: 0;   transform: translateX(50px); }
    to   { opacity: 1;   transform: translateX(0); }
}

@keyframes diSwipeRight {
    from { opacity: 0;   transform: translateX(-50px); }
    to   { opacity: 1;   transform: translateX(0); }
}

.di-swipe-anim-left {
    animation: diSwipeLeft 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.di-swipe-anim-right {
    animation: diSwipeRight 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Respect a reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
    .di-swipe-anim-left,
    .di-swipe-anim-right {
        animation: none !important;
    }
}

/* ── MONTH NAV ARROWS — BOLDER ──────────────────────────── */

.flatpickr-calendar .flatpickr-prev-month,
.flatpickr-calendar .flatpickr-next-month {
    color: #214A63 !important;
}

.flatpickr-calendar .flatpickr-prev-month svg,
.flatpickr-calendar .flatpickr-next-month svg {
    width: 18px !important;
    height: 18px !important;
    stroke: #214A63 !important;
    stroke-width: 3px !important;
    fill: #214A63 !important;
}

/* ── FLEX INFO / INSTRUCTIONS ───────────────────────────── */

/* Explicit ordering inside the tourdate field group (a flex
   column) — guarantees calendar-first, info-second on every
   device, instead of relying on DOM insertion order, which
   some mobile browsers were rendering differently. */
.elementor-field-type-date.elementor-field-group-tourdate > .elementor-field-label {
    order: 0;
}

.di-tourdate-hidden-input {
    order: 1;
}

.di-flex-calendar {
    order: 2;
    width: 100%;
}

.di-flex-info {
    order: 3;
    width: 100%;
    margin-top: 0.75rem;
    text-align: center;
}

.di-flex-instructions {
    font-size: 0.95rem;
    line-height: 1.45;
}

.di-flex-legend {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 0.6rem;
    font-size: 0.85rem;
    line-height: 1.4;
}

.di-legend-preferred,
.di-legend-optional {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.di-legend-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.4rem;
    height: 1.4rem;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 600;
}

.di-legend-circle.preferred {
    background: #e58a2b;
    color: #fff;
}

.di-legend-circle.optional {
    background: #5797ed;
    color: #fff;
}

/* ── PREFERRED DATE COLOR OVERRIDE ──────────────────────── */

.flatpickr-day.di-preferred-date.selected,
.flatpickr-day.di-preferred-date.selected:hover {
    background: #e58a2b !important;
    border-color: #e58a2b !important;
    color: #fff !important;
}

/* ── SUBMISSION MESSAGE TEXT SIZE ────────────────────────── */

.elementor-form .elementor-message {
    font-size: 1.3rem;
}

/* ── TABLET + MOBILE ────────────────────────────────────── */

@media (max-width: 1024px) {

    /* Calendar text ~15% larger */
    .flatpickr-calendar.inline {
        font-size: 16.1px !important;   /* 14px base * 1.15 */
    }

    .flatpickr-calendar.inline .flatpickr-day {
        font-size: 16.1px !important;
        height: 2.4rem !important;
        line-height: 2.4rem !important;
    }

    .flatpickr-calendar.inline .flatpickr-weekday {
        font-size: 10.35px !important;  /* ~9px base * 1.15 */
    }

    .flatpickr-calendar.inline .flatpickr-current-month {
        font-size: 1.24rem !important;  /* ~1.08rem * 1.15 */
    }

    .flatpickr-calendar.inline .flatpickr-current-month .numInputWrapper {
        font-size: 16.1px !important;
    }

    /* Yes/No option sizing (flexible-tour + WhatsApp) now lives as
       an unconditional rule earlier in this file, not here — it
       applies at every screen size, not just tablet/mobile. */
}


/* ── MOBILE ONLY ────────────────────────────────────────── */

@media (max-width: 767px) {

    /* Keep the calendar inside its container so it can't overlap
       and swallow taps meant for the checkboxes below it. */
    .elementor-field-type-date.elementor-field-group-tourdate {
        position: relative !important;
        z-index: 0 !important;
        overflow: visible !important;
        max-width: 100% !important;
    }

    .elementor-field-type-date.elementor-field-group-tourdate .flatpickr-calendar.inline {
        max-width: 100% !important;
        width: 100% !important;
        position: relative !important;
        z-index: 0 !important;
        overflow: visible !important;
        height: auto !important;
        max-height: none !important;
    }

    /* The full-width chain. .flatpickr-rContainer and
       .flatpickr-weekdaycontainer must be included: without them
       the row container collapses to its content width once
       .dayContainer becomes a grid, and the calendar shrinks to
       roughly 140px instead of filling the screen. */
    .elementor-field-type-date.elementor-field-group-tourdate .flatpickr-rContainer {
        flex: 1 1 auto !important;
        width: 100% !important;
        min-width: 0 !important;
    }

    .elementor-field-type-date.elementor-field-group-tourdate .flatpickr-weekdaycontainer,
    .elementor-field-type-date.elementor-field-group-tourdate .flatpickr-days,
    .elementor-field-type-date.elementor-field-group-tourdate .dayContainer {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        overflow: visible !important;
        height: auto !important;
        max-height: none !important;
    }

    .di-flex-calendar {
        overflow: visible !important;
        height: auto !important;
        max-height: none !important;
    }

    /* Keep the label and Yes/No options on the SAME row on mobile
       too — not stacked. Also lift above the calendar in stacking
       order and guarantee pointer events reach the real inputs. */
    .elementor-form .elementor-field-group.elementor-field-group-flex {
        flex-direction: row !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        justify-content: center !important;
        position: relative !important;
        z-index: 5 !important;
        pointer-events: auto !important;
    }

    .elementor-form .elementor-field-group.elementor-field-group-flex > .elementor-field-label {
        width: auto !important;      /* stay inline with the options */
        margin: 0 !important;
        flex-shrink: 0 !important;
    }

    .elementor-form .elementor-field-group-flex .elementor-field-option {
        position: relative !important;
        z-index: 6 !important;
        pointer-events: auto !important;
    }

    .elementor-form .elementor-field-group-flex .elementor-field-option input[type="checkbox"],
    .elementor-form .elementor-field-group-flex .elementor-field-option input[type="radio"] {
        pointer-events: auto !important;
        position: relative !important;
        z-index: 7 !important;
    }

    .elementor-form .elementor-field-group-flex .elementor-field-option label {
        pointer-events: auto !important;
        position: relative !important;
        z-index: 7 !important;
    }

    /* WhatsApp field: horizontal on MOBILE ONLY. Unlike the
       flexible-tour field above, this one keeps whatever layout
       Elementor gives it by default on tablet/desktop — no change
       requested there, and no calendar sits nearby to overlap, so
       none of the z-index/pointer-events rules above are needed
       here. */
    .elementor-form .elementor-field-group.elementor-field-group-whatsapp {
        flex-direction: row !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .elementor-form .elementor-field-group.elementor-field-group-whatsapp > .elementor-field-label {
        width: auto !important;
        margin: 0 !important;
        flex-shrink: 0 !important;
    }

    .elementor-form .elementor-field-group-whatsapp .elementor-field-subgroup {
        display: flex !important;
        align-items: center !important;
        gap: 1rem !important;
        width: auto !important;
        flex: none !important;
        flex-wrap: nowrap !important;
    }
}