/**
 * Little Hive — "Your Stay" Gravity Forms field
 *
 * Airbnb-style date picker: two labelled boxes showing which date is being
 * entered, a clean calendar below, then guests, discount code and pricing.
 *
 * NOTE ON !important
 * This widget is embedded inside Gravity Forms' own theme (orbital) AND the site
 * theme, both of which style bare `button` / `select` / `input` elements with
 * high-specificity selectors and print after this file in some orders. Layout
 * and control-reset declarations are therefore forced. Purely decorative
 * properties are left unforced so a theme can still tune them.
 */

.lhb-stay {
    /* Warm palette carried over from the original calendar */
    --lhb-ink: #3D3D3D;
    --lhb-ink-soft: #6f6f6f;
    --lhb-ink-faint: #b3ada3;
    --lhb-line: #E5E0D8;
    --lhb-cream: #FDFBF7;
    --lhb-accent: #5B7E5F;
    --lhb-accent-dark: #3D6B42;
    --lhb-gold: #C9A96E;
    --lhb-range: #EAF2EB;
    --lhb-danger: #9B3B3B;
    --lhb-radius: 8px;

    /* Matched to the theme's own form controls so the date boxes sit with them */
    --lhb-field-border: #686E77;
    --lhb-field-radius: 6px;
    --lhb-label-size: 16px;

    /* Full width like the other form fields — the calendar lives in a dropdown
       now, so it no longer dictates the width of the field itself. */
    max-width: 100%;
    color: var(--lhb-ink);
    font-size: 15px;
    line-height: 1.4;
    text-align: left;
}

.lhb-stay *,
.lhb-stay *::before,
.lhb-stay *::after { box-sizing: border-box; }

/* ---------------------------------------------------------------------------
   Control reset — neutralises theme button/select styling inside the widget
   --------------------------------------------------------------------------- */

.lhb-stay button {
    appearance: none !important;
    -webkit-appearance: none !important;
    background: none !important;
    background-image: none !important;
    border: 0 !important;
    border-radius: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    width: auto !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    font: inherit !important;
    font-size: inherit !important;
    font-weight: inherit !important;
    line-height: inherit !important;
    letter-spacing: normal !important;
    text-transform: none !important;
    text-decoration: none !important;
    color: inherit !important;
    box-shadow: none !important;
    text-shadow: none !important;
    transform: none !important;
    cursor: pointer;
}

.lhb-stay button::before,
.lhb-stay button::after { content: none; }

.lhb-stay input[type="text"],
.lhb-stay select {
    font: inherit !important;
    font-size: 15px !important;
    margin: 0 !important;
    box-shadow: none !important;
    max-width: none !important;
}

/* ---------------------------------------------------------------------------
   Controls — guests, then dates. Borders/radius match the theme's own inputs.
   --------------------------------------------------------------------------- */

.lhb-stay .lhb-stay__control { margin-bottom: 18px; }
.lhb-stay .lhb-stay__control--dates { position: relative; margin-bottom: 8px; }

.lhb-stay .lhb-stay__control-label {
    display: block;
    margin: 0 0 6px !important;
    font-size: var(--lhb-label-size);
    font-weight: 500;
    color: inherit;
}

/* ---------------------------------------------------------------------------
   Check-in / Checkout boxes — separate controls with a gap, so no shared or
   doubled borders. The active ring is a box-shadow, which cannot shift layout.
   --------------------------------------------------------------------------- */

/* Check-in | Checkout | Guests */
.lhb-stay .lhb-stay__boxes {
    display: grid !important;
    grid-template-columns: 1fr 1fr 1fr !important;
    gap: 12px !important;
}

.lhb-stay .lhb-stay__box {
    /* Flex on all three (two buttons + the guests div) so their labels and values
       sit on identical baselines — a button lays its children out differently. */
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: center !important;
    width: 100% !important;
    text-align: left !important;
    background: #fff !important;
    border: 1px solid var(--lhb-field-border) !important;
    border-radius: var(--lhb-field-radius) !important;
    padding: 8px 12px !important;
    min-height: 47px !important;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.lhb-stay .lhb-stay__box:hover { border-color: var(--lhb-ink) !important; }

/* The active box — the "which date am I entering" signal */
.lhb-stay .lhb-stay__box--active,
.lhb-stay .lhb-stay__box--active:hover {
    border-color: var(--lhb-ink) !important;
    box-shadow: 0 0 0 1px var(--lhb-ink) !important;
}

.lhb-stay .lhb-stay__box:focus-visible {
    outline: 2px solid var(--lhb-accent);
    outline-offset: 1px;
}


.lhb-stay .lhb-stay__box-label {
    display: block;
    font-size: 10px !important;
    font-weight: 700 !important;
    letter-spacing: 0.08em !important;
    text-transform: uppercase !important;
    color: var(--lhb-ink) !important;
    margin-bottom: 3px;
}

.lhb-stay .lhb-stay__box-value {
    display: block;
    height: 20px;
    font-size: 14px !important;
    line-height: 20px !important;
    font-weight: 400 !important;
    color: var(--lhb-ink-soft) !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lhb-stay .lhb-stay__box--filled .lhb-stay__box-value { color: var(--lhb-ink) !important; }

/* Guests: same box, with a borderless native select sitting in it so it reads as
   one control alongside the two date boxes rather than a stray form input. */
/* Block layout, matching the date boxes exactly so the three labels line up */
.lhb-stay .lhb-stay__box--guests { cursor: default; }

.lhb-stay .lhb-stay__box--guests:hover { border-color: var(--lhb-field-border) !important; }

.lhb-stay .lhb-stay__box--guests .lhb-stay__box-label { cursor: pointer; }

.lhb-stay .lhb-stay__box-select {
    appearance: none !important;
    -webkit-appearance: none !important;
    width: 100% !important;
    /* Matched to .lhb-stay__box-value so all three boxes centre identically */
    height: 20px !important;
    min-height: 0 !important;
    padding: 0 20px 0 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    font-size: 14px !important;
    line-height: 20px !important;
    color: var(--lhb-ink) !important;
    cursor: pointer;

    /* Chevron, drawn inline so no external asset is needed */
    background-image: linear-gradient(45deg, transparent 50%, var(--lhb-ink-soft) 50%),
                      linear-gradient(135deg, var(--lhb-ink-soft) 50%, transparent 50%) !important;
    background-position: right 6px center, right 1px center !important;
    background-size: 5px 5px, 5px 5px !important;
    background-repeat: no-repeat !important;
}

.lhb-stay .lhb-stay__box-select:focus { outline: none; }
.lhb-stay .lhb-stay__box--guests:focus-within {
    border-color: var(--lhb-ink) !important;
    box-shadow: 0 0 0 1px var(--lhb-ink) !important;
}

/* ---------------------------------------------------------------------------
   Hint / error line
   --------------------------------------------------------------------------- */

.lhb-stay .lhb-stay__hint {
    margin: 0 0 10px !important;
    font-size: 13px;
    color: var(--lhb-ink-soft);
    min-height: 18px;
}

.lhb-stay .lhb-stay__hint--error { color: var(--lhb-danger); font-weight: 600; }

/* ---------------------------------------------------------------------------
   Calendar panel — always visible, warm cream surround
   --------------------------------------------------------------------------- */

.lhb-stay .lhb-stay__panel {
    margin-top: 14px;
    padding: 16px 18px 12px;
    background: var(--lhb-cream);
    border: 1px solid var(--lhb-line);
    border-radius: var(--lhb-radius);
}

.lhb-stay .lhb-stay__calendar[hidden] { display: none !important; }

.lhb-stay .lhb-stay__cal-foot {
    display: flex !important;
    justify-content: flex-end;
    align-items: center;
    gap: 14px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--lhb-line);
}

.lhb-stay .lhb-stay__synced {
    margin-right: auto;
    font-size: 12px;
    color: var(--lhb-ink-faint);
}

.lhb-stay .lhb-stay__cal-head {
    display: flex !important;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.lhb-stay .lhb-stay__nav {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    flex: 0 0 40px;
    margin-top: 2px !important;
    border: 1px solid var(--lhb-line) !important;
    border-radius: 50% !important;
    background: #fff !important;
    color: var(--lhb-ink) !important;
    font-size: 18px !important;
    line-height: 1 !important;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.lhb-stay .lhb-stay__nav:hover:not(:disabled) { border-color: var(--lhb-ink) !important; background: #fafafa !important; }
.lhb-stay .lhb-stay__nav:disabled { opacity: 0.25; cursor: default; }
.lhb-stay .lhb-stay__nav:focus-visible { outline: 2px solid var(--lhb-accent); outline-offset: 2px; }

.lhb-stay .lhb-stay__months {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 16px !important;
    flex: 1 1 auto;
    min-width: 0;
}

/* Each month is its own card, as in the original calendar */
.lhb-stay .lhb-stay__month {
    background: #fff;
    border: 1px solid var(--lhb-line);
    border-radius: var(--lhb-radius);
    padding: 14px 14px 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.lhb-stay .lhb-stay__month-title {
    text-align: center;
    font-size: 15px;
    font-weight: 700;
    margin: 0 0 10px !important;
    padding: 0 !important;
    color: var(--lhb-ink);
}

.lhb-stay .lhb-stay__grid {
    display: grid !important;
    grid-template-columns: repeat(7, 1fr) !important;
    gap: 2px !important;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none;
}

.lhb-stay .lhb-stay__dow {
    display: flex !important;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--lhb-ink-faint);
    padding-bottom: 6px !important;
}

/* Day cells */
.lhb-stay .lhb-stay__day {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    width: 100% !important;
    aspect-ratio: 1 !important;
    padding: 0 !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    color: var(--lhb-ink) !important;
    background: transparent !important;
    border-radius: 50% !important;
    position: relative;
    transition: background 0.12s ease, color 0.12s ease;
    -webkit-tap-highlight-color: transparent;
}

.lhb-stay .lhb-stay__day--blank { visibility: hidden; cursor: default; }

.lhb-stay .lhb-stay__day-num { display: block; line-height: 1.1; }

.lhb-stay .lhb-stay__day-price {
    display: block;
    font-size: 9px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: -0.01em;
    color: var(--lhb-accent);
    white-space: nowrap;
}

/* Legible against the filled endpoints and the dark hover state */
.lhb-stay .lhb-stay__day--start .lhb-stay__day-price,
.lhb-stay .lhb-stay__day--end .lhb-stay__day-price {
    color: rgba(255, 255, 255, 0.85);
}

.lhb-stay .lhb-stay__day:hover:not(:disabled) .lhb-stay__day-price {
    color: var(--lhb-accent-dark);
}

.lhb-stay .lhb-stay__day:hover:not(:disabled) {
    background: var(--lhb-range) !important;
    color: var(--lhb-accent-dark) !important;
    box-shadow: inset 0 0 0 2px var(--lhb-accent);
}

.lhb-stay .lhb-stay__day:focus-visible { outline: 2px solid var(--lhb-accent); outline-offset: -2px; }

.lhb-stay .lhb-stay__day:disabled {
    cursor: default;
    box-shadow: none !important;
}

/* Must not clear the range fill: a day inside the selection can still be
   undisabled-for-selection (e.g. it cannot start a new stay), and it should
   keep the highlight rather than punching a hole in the range. */
.lhb-stay .lhb-stay__day:disabled:not(.lhb-stay__day--in-range) {
    background: transparent !important;
}

/* Genuinely unavailable — booked, held, or in the past. Struck through. */
.lhb-stay .lhb-stay__day--unavailable {
    color: var(--lhb-ink-faint) !important;
    text-decoration: line-through !important;
    text-decoration-thickness: 1px;
    opacity: 1;
}

/* Free, but not a valid choice for the stay being built (too short, or the range
   would cross a booking). Dimmed only — never struck through, because the night
   itself is available. */
.lhb-stay .lhb-stay__day--muted {
    color: var(--lhb-ink) !important;
    text-decoration: none !important;
    opacity: 0.3 !important;
}

/* Today: gold ring, carried over from the original calendar */
.lhb-stay .lhb-stay__day--today {
    box-shadow: inset 0 0 0 2px var(--lhb-gold);
    font-weight: 700 !important;
}

/* Range fill sits behind the rounded endpoints */
.lhb-stay .lhb-stay__day--in-range {
    background: var(--lhb-range) !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

.lhb-stay .lhb-stay__day--start,
.lhb-stay .lhb-stay__day--end,
.lhb-stay .lhb-stay__day--start:hover,
.lhb-stay .lhb-stay__day--end:hover {
    background: var(--lhb-accent) !important;
    color: #fff !important;
    box-shadow: none !important;
    font-weight: 700 !important;
}

.lhb-stay .lhb-stay__day--start { border-radius: 50% 0 0 50% !important; }
.lhb-stay .lhb-stay__day--end { border-radius: 0 50% 50% 0 !important; }
.lhb-stay .lhb-stay__day--start.lhb-stay__day--end,
.lhb-stay .lhb-stay__day--solo { border-radius: 50% !important; }

.lhb-stay .lhb-stay__clear {
    margin-right: auto;
    padding: 6px 4px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    color: var(--lhb-ink) !important;
    text-decoration: underline !important;
}

.lhb-stay .lhb-stay__clear:hover { color: var(--lhb-accent-dark) !important; }
.lhb-stay .lhb-stay__clear[hidden] { display: none !important; }

/* ---------------------------------------------------------------------------
   Discount code
   --------------------------------------------------------------------------- */

.lhb-stay .lhb-stay__discount { margin-top: 18px; }

.lhb-stay .lhb-stay__discount-toggle {
    font-size: 14px !important;
    color: var(--lhb-ink-soft) !important;
    text-decoration: underline !important;
}

.lhb-stay .lhb-stay__discount-toggle:hover { color: var(--lhb-ink) !important; }

.lhb-stay .lhb-stay__discount-body { margin-top: 10px; }
.lhb-stay .lhb-stay__discount-body[hidden] { display: none !important; }

.lhb-stay .lhb-stay__discount-row { display: flex !important; gap: 8px; }

.lhb-stay .lhb-stay__discount-input {
    flex: 1 1 auto;
    padding: 10px 14px !important;
    border: 1px solid var(--lhb-line) !important;
    border-radius: 8px !important;
    min-width: 0;
    width: auto !important;
}

.lhb-stay .lhb-stay__discount-apply {
    flex: 0 0 auto;
    font-size: 14px !important;
    font-weight: 700 !important;
    padding: 10px 20px !important;
    border: 1px solid var(--lhb-ink) !important;
    border-radius: 8px !important;
    background: #fff !important;
    color: var(--lhb-ink) !important;
}

.lhb-stay .lhb-stay__discount-apply:hover { background: var(--lhb-ink) !important; color: #fff !important; }
.lhb-stay .lhb-stay__discount-apply:disabled { opacity: 0.5; cursor: default; }

.lhb-stay .lhb-stay__discount-message {
    margin: 8px 0 0 !important;
    font-size: 13px;
    min-height: 18px;
}

.lhb-stay .lhb-stay__discount-message--ok { color: var(--lhb-accent-dark); font-weight: 600; }
.lhb-stay .lhb-stay__discount-message--error { color: var(--lhb-danger); }

/* ---------------------------------------------------------------------------
   Pricing
   --------------------------------------------------------------------------- */

.lhb-stay .lhb-stay__pricing {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--lhb-line);
}

.lhb-stay .lhb-stay__pricing[hidden] { display: none !important; }

.lhb-stay .lhb-stay__price-row {
    display: flex !important;
    justify-content: space-between;
    gap: 16px;
    padding: 6px 0;
    font-size: 15px;
    color: var(--lhb-ink-soft);
}

.lhb-stay .lhb-stay__price-row--discount { color: var(--lhb-accent-dark); font-weight: 600; }

.lhb-stay .lhb-stay__price-row--total {
    margin-top: 10px;
    padding-top: 14px;
    border-top: 1px solid var(--lhb-line);
    font-size: 17px;
    font-weight: 700;
    color: var(--lhb-ink);
}

.lhb-stay .lhb-stay__reassurance {
    margin: 16px 0 0 !important;
    font-size: 13px;
    color: var(--lhb-ink-soft);
}

/* ---------------------------------------------------------------------------
   Fallback inputs (JS unavailable)
   --------------------------------------------------------------------------- */

.lhb-stay .lhb-stay__fallback { display: grid !important; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.lhb-stay .lhb-stay__fallback[hidden] { display: none !important; }
.lhb-stay .lhb-stay__fallback label { display: block; font-size: 13px; font-weight: 600; }
.lhb-stay .lhb-stay__fallback input {
    display: block;
    width: 100% !important;
    margin-top: 6px !important;
    padding: 10px 14px !important;
    border: 1px solid var(--lhb-line) !important;
    border-radius: 8px !important;
}

.lhb-stay .lhb-stay__noscript { margin: 0; font-size: 14px; color: var(--lhb-ink-soft); }

/* ---------------------------------------------------------------------------
   Form editor preview
   --------------------------------------------------------------------------- */

.lhb-stay--editor .lhb-stay__box { cursor: default; }
.lhb-stay .lhb-stay__editor-note {
    margin: 12px 0 0 !important;
    font-size: 13px;
    font-style: italic;
    color: var(--lhb-ink-soft);
}

/* ---------------------------------------------------------------------------
   Mobile — one column, vertically scrolling months (no swipe paging)
   --------------------------------------------------------------------------- */

@media (max-width: 767px) {
    /* One paged month. No internal scroll container: a tall scrolling month list
       inline on a phone traps the scroll and makes the rest of the form
       unreachable. Paging keeps the calendar short enough to scroll straight past. */
    .lhb-stay .lhb-stay__months { grid-template-columns: 1fr !important; }

    .lhb-stay .lhb-stay__panel { padding: 14px 12px 10px; }
    .lhb-stay .lhb-stay__month { padding: 12px 8px 8px; }

    /* Arrows overlay the month title instead of flanking the grid, so the seven
       columns get the full panel width rather than ~230px of it. */
    .lhb-stay .lhb-stay__cal-head {
        display: block !important;
        position: relative;
    }

    .lhb-stay .lhb-stay__nav {
        position: absolute;
        top: 6px;
        z-index: 2;
        width: 34px !important;
        height: 34px !important;
        min-width: 34px !important;
        min-height: 34px !important;
        margin-top: 0 !important;
    }

    .lhb-stay .lhb-stay__nav:first-child { left: 6px; }
    .lhb-stay .lhb-stay__nav:last-child { right: 6px; }

    .lhb-stay .lhb-stay__month-title { padding: 4px 42px 0 !important; }

    /* Dates share a row; guests takes the full width beneath them */
    .lhb-stay .lhb-stay__boxes { grid-template-columns: 1fr 1fr !important; }
    .lhb-stay .lhb-stay__box--guests { grid-column: 1 / -1; }
    .lhb-stay .lhb-stay__day { font-size: 15px !important; }
    .lhb-stay .lhb-stay__day-price { font-size: 8.5px; }
    .lhb-stay .lhb-stay__boxes { gap: 8px !important; }
    .lhb-stay .lhb-stay__fallback { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    .lhb-stay *,
    .lhb-stay *::before,
    .lhb-stay *::after { transition-duration: 0.01ms !important; }
}
