/*
 * Nómadas Connect public availability selector.
 *
 * Important: mapped products usually render inside WooCommerce's narrow
 * product-summary column, even on a very wide desktop viewport. Therefore
 * responsive layout is container-driven, not viewport-driven.
 */

/* WooCommerce Bookings remains the local mirror/backoffice. Its native public selector is hidden. */
form.nmdc-connected-booking-form {
    width: 100%;
    max-width: 100%;
}
form.nmdc-connected-booking-form .wc-bookings-date-picker,
form.nmdc-connected-booking-form .block-picker,
form.nmdc-connected-booking-form .wc-bookings-booking-cost,
form.nmdc-connected-booking-form [class^="wc_bookings_field_"],
form.nmdc-connected-booking-form [class*=" wc_bookings_field_"],
form.nmdc-connected-booking-form > noscript {
    display: none !important;
}

.nmdc-availability,
.nmdc-availability *,
.nmdc-availability *::before,
.nmdc-availability *::after {
    box-sizing: border-box;
}

.nmdc-availability {
    --nmdc-ink: #111;
    --nmdc-muted: #68707d;
    --nmdc-border: #e3e5e8;
    --nmdc-soft: #f6f7f8;
    --nmdc-success: #147a45;
    --nmdc-danger: #b42318;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    container-type: inline-size;
    border: 1px solid var(--nmdc-border);
    border-radius: 14px;
    padding: 18px;
    margin: 0 0 20px;
    background: #fff;
    color: var(--nmdc-ink);
    box-shadow: 0 7px 24px rgba(17, 17, 17, .045);
    font: inherit;
}

.nmdc-booking-heading {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 17px;
    min-width: 0;
}
.nmdc-booking-heading > div {
    flex: 1 1 190px;
    min-width: 0;
}
.nmdc-booking-heading h3 {
    margin: 3px 0 0;
    font-size: clamp(1.2rem, 4cqi, 1.42rem);
    line-height: 1.18;
    overflow-wrap: anywhere;
}
.nmdc-eyebrow {
    display: block;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--nmdc-muted);
}
.nmdc-live-badge {
    display: inline-flex;
    flex: 0 1 auto;
    max-width: 100%;
    align-items: center;
    gap: 7px;
    border: 1px solid var(--nmdc-border);
    border-radius: 999px;
    padding: 6px 9px;
    font-size: .75rem;
    line-height: 1.25;
    white-space: normal;
    overflow-wrap: anywhere;
}
.nmdc-live-badge > span {
    flex: 0 0 8px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--nmdc-success);
    box-shadow: 0 0 0 3px rgba(20, 122, 69, .12);
}

/* Safe default: one column. We only opt into two columns when THIS widget is genuinely wide. */
.nmdc-booking-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 17px;
    width: 100%;
    min-width: 0;
}
.nmdc-calendar-panel,
.nmdc-options-panel {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}
.nmdc-calendar-panel {
    border: 1px solid var(--nmdc-border);
    border-radius: 13px;
    padding: 13px;
    background: #fff;
}
.nmdc-calendar-toolbar {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) 36px;
    gap: 6px;
    align-items: center;
    margin-bottom: 9px;
}
.nmdc-month-label {
    min-width: 0;
    text-align: center;
    text-transform: capitalize;
    font-size: 1rem;
    line-height: 1.2;
    overflow-wrap: anywhere;
}
.nmdc-month-nav {
    appearance: none;
    -webkit-appearance: none;
    width: 36px;
    height: 36px;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 9px;
    background: var(--nmdc-soft);
    color: var(--nmdc-ink);
    font: inherit;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
}
.nmdc-month-nav:hover:not(:disabled) { background: #ebedef; }
.nmdc-month-nav:disabled { opacity: .28; cursor: not-allowed; }

.nmdc-weekdays,
.nmdc-month-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: clamp(2px, 1.2cqi, 5px);
    width: 100%;
    min-width: 0;
}
.nmdc-weekdays { margin-bottom: 4px; }
.nmdc-weekdays span {
    min-width: 0;
    padding: 4px 0;
    text-align: center;
    color: var(--nmdc-muted);
    font-size: .7rem;
    font-weight: 700;
}
.nmdc-day-spacer { aspect-ratio: 1; min-width: 0; }
.nmdc-day {
    position: relative;
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    aspect-ratio: 1;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #b2b6bc;
    font: inherit;
    font-size: clamp(.78rem, 3.3cqi, .9rem);
    line-height: 1;
    text-align: center;
    cursor: default;
}
.nmdc-day.is-available {
    background: var(--nmdc-soft);
    color: var(--nmdc-ink);
    font-weight: 650;
    cursor: pointer;
}
.nmdc-day.is-available::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: clamp(4px, 1.5cqi, 6px);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--nmdc-success);
    transform: translateX(-50%);
}
.nmdc-day.is-available:hover { background: #e9eaec; }
.nmdc-day.is-today { box-shadow: inset 0 0 0 1px #c6c9ce; }
.nmdc-day.is-selected,
.nmdc-day.is-selected:hover {
    background: var(--nmdc-ink);
    color: #fff;
}
.nmdc-day.is-selected::after { background: #fff; }

.nmdc-day:focus-visible,
.nmdc-month-nav:focus-visible,
.nmdc-stepper button:focus-visible,
.nmdc-slot-card:has(.nmdc-slot-radio:focus-visible) {
    outline: 3px solid rgba(17, 17, 17, .2);
    outline-offset: 2px;
}

.nmdc-calendar-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    align-items: center;
    margin-top: 11px;
    color: var(--nmdc-muted);
    font-size: .71rem;
}
.nmdc-calendar-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}
.nmdc-calendar-legend i {
    flex: 0 0 9px;
    width: 9px;
    height: 9px;
    border: 1px solid var(--nmdc-border);
    border-radius: 3px;
    background: var(--nmdc-soft);
}
.nmdc-calendar-legend i.is-available { box-shadow: inset 0 -3px 0 var(--nmdc-success); }
.nmdc-calendar-legend i.is-selected { background: var(--nmdc-ink); border-color: var(--nmdc-ink); }

.nmdc-options-panel {
    display: flex;
    flex-direction: column;
    gap: 13px;
}
.nmdc-section {
    min-width: 0;
    padding-bottom: 13px;
    border-bottom: 1px solid var(--nmdc-border);
}
.nmdc-section:last-of-type { border-bottom: 0; }
.nmdc-section h4 {
    margin: 0 0 9px;
    font-size: .9rem;
    line-height: 1.3;
    overflow-wrap: anywhere;
}
.nmdc-traveler-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding: 5px 0;
}
.nmdc-traveler-label {
    min-width: 0;
    font-size: .92rem;
    overflow-wrap: anywhere;
}
.nmdc-stepper {
    display: grid;
    flex: 0 0 auto;
    grid-template-columns: 32px 38px 32px;
    align-items: center;
    overflow: hidden;
    border: 1px solid var(--nmdc-border);
    border-radius: 999px;
    background: #fff;
}
.nmdc-stepper button {
    appearance: none;
    -webkit-appearance: none;
    width: 32px;
    height: 32px;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: #fff;
    color: var(--nmdc-ink);
    font: inherit;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
}
.nmdc-stepper button:hover { background: var(--nmdc-soft); }
.nmdc-stepper input {
    appearance: textfield;
    -moz-appearance: textfield;
    width: 38px !important;
    min-width: 38px !important;
    max-width: 38px !important;
    height: 32px !important;
    min-height: 32px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: #fff !important;
    box-shadow: none !important;
    color: var(--nmdc-ink) !important;
    font: inherit !important;
    font-weight: 700 !important;
    line-height: 32px !important;
    text-align: center;
}
.nmdc-stepper input::-webkit-outer-spin-button,
.nmdc-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.nmdc-slot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(92px, 100%), 1fr));
    gap: 8px;
    width: 100%;
    min-width: 0;
}
.nmdc-slot-radio {
    position: absolute !important;
    opacity: 0 !important;
    pointer-events: none !important;
}
.nmdc-slot-card {
    display: flex;
    min-width: 0;
    min-height: 54px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    margin: 0;
    padding: 7px 6px;
    border: 1px solid var(--nmdc-border);
    border-radius: 10px;
    background: #fff;
    color: var(--nmdc-ink);
    font: inherit;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s, background .15s, transform .15s;
}
.nmdc-slot-card:hover { border-color: #a8abb0; transform: translateY(-1px); }
.nmdc-slot-card strong {
    max-width: 100%;
    font-size: .95rem;
    line-height: 1.2;
    overflow-wrap: anywhere;
}
.nmdc-slot-card span {
    max-width: 100%;
    margin-top: 2px;
    color: var(--nmdc-muted);
    font-size: .68rem;
    line-height: 1.2;
    overflow-wrap: anywhere;
}
.nmdc-slot-card.is-selected {
    border-color: var(--nmdc-ink);
    background: var(--nmdc-ink);
    color: #fff;
}
.nmdc-slot-card.is-selected span { color: #d5d6d8; }
.nmdc-empty { margin: 0; color: var(--nmdc-muted); font-size: .88rem; }

.nmdc-status {
    min-width: 0;
    min-height: 1.3em;
    font-size: .84rem;
    line-height: 1.4;
    color: var(--nmdc-muted);
    overflow-wrap: anywhere;
}
.nmdc-status[data-state="success"] { color: var(--nmdc-success); font-weight: 650; }
.nmdc-status[data-state="error"] { color: var(--nmdc-danger); }
.nmdc-status[data-state="loading"] { color: var(--nmdc-muted); }
.nmdc-phase-note {
    margin: 13px 0 0;
    color: var(--nmdc-muted);
    font-size: .73rem;
    line-height: 1.4;
}

.nmdc-calendar-skeleton {
    width: 100%;
    height: min(265px, 70cqi);
    min-height: 210px;
    border-radius: 11px;
    background: linear-gradient(90deg, #f4f4f5 25%, #fafafa 37%, #f4f4f5 63%);
    background-size: 400% 100%;
    animation: nmdc-shimmer 1.25s infinite;
}
.nmdc-slot-skeleton {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(92px, 100%), 1fr));
    gap: 8px;
}
.nmdc-slot-skeleton span {
    height: 54px;
    border-radius: 10px;
    background: linear-gradient(90deg, #f4f4f5 25%, #fafafa 37%, #f4f4f5 63%);
    background-size: 400% 100%;
    animation: nmdc-shimmer 1.25s infinite;
}
@keyframes nmdc-shimmer {
    0% { background-position: 100% 0; }
    100% { background-position: 0 0; }
}
.nmdc-availability-disabled { opacity: .55 !important; cursor: not-allowed !important; }

/*
 * Container breakpoints: only use the side-by-side desktop composition when
 * the booking widget itself has enough room. This is the key RC5 fix.
 */
@container (min-width: 650px) {
    .nmdc-booking-layout {
        grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr);
        gap: 20px;
    }
    .nmdc-calendar-panel { padding: 14px; }
}

@container (max-width: 420px) {
    .nmdc-availability { padding: 14px; border-radius: 12px; }
    .nmdc-booking-heading { margin-bottom: 14px; }
    .nmdc-booking-heading h3 { font-size: 1.2rem; }
    .nmdc-live-badge { width: fit-content; font-size: .71rem; }
    .nmdc-calendar-panel { padding: 10px; border-radius: 11px; }
    .nmdc-calendar-toolbar { grid-template-columns: 34px minmax(0, 1fr) 34px; }
    .nmdc-month-nav { width: 34px; height: 34px; }
    .nmdc-day { border-radius: 7px; }
    .nmdc-calendar-legend { gap: 7px 10px; }
}

@container (max-width: 330px) {
    .nmdc-availability { padding: 11px; }
    .nmdc-calendar-panel { padding: 8px; }
    .nmdc-weekdays span { font-size: .64rem; }
    .nmdc-day { font-size: .76rem; }
    .nmdc-slot-grid,
    .nmdc-slot-skeleton { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .nmdc-traveler-row { align-items: flex-start; }
}

/* Fallback for browsers without CSS container queries: one-column remains safe. */
@media (max-width: 480px) {
    .nmdc-availability { padding: 14px; }
    .nmdc-booking-heading { display: block; }
    .nmdc-live-badge { margin-top: 9px; }
}

/* RC6: mapped public products use Nómadas Connect's own purchase control. */
form.nmdc-connected-booking-form .nmdc-native-purchase-control {
    display: none !important;
}
.nmdc-cta-row {
    width: 100%;
    margin-top: 16px;
}
.nmdc-reserve-button {
    width: 100%;
    min-height: 46px;
    margin: 0 !important;
    text-align: center;
}
.nmdc-reserve-button:disabled,
.nmdc-reserve-button[aria-disabled="true"] {
    cursor: not-allowed;
    opacity: .48;
}
.nmdc-reserve-button:not(:disabled) {
    cursor: pointer;
    opacity: 1;
}

/* RC7: standalone mapped Simple/Virtual purchase form. It must render even when
 * WooCommerce has no local placeholder price and therefore would omit its own form. */
form.nmdc-standalone-cart-form {
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
}
form.nmdc-standalone-cart-form::before,
form.nmdc-standalone-cart-form::after {
    content: "";
    display: table;
    clear: both;
}
form.nmdc-standalone-cart-form .nmdc-availability {
    float: none;
    clear: both;
}

/* RC13: traveller-first flow, live pricing and stable in-place refreshes. */
.nmdc-price-intro {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 5px;
    margin: -5px 0 15px;
    color: var(--nmdc-muted);
    font-size: .82rem;
}
.nmdc-price-intro[hidden] { display: none !important; }
.nmdc-price-intro strong {
    color: var(--nmdc-ink);
    font-size: 1.28rem;
    line-height: 1;
}
.nmdc-flow-step {
    position: relative;
    min-width: 0;
}
.nmdc-travelers-panel {
    margin-bottom: 17px;
    padding: 13px;
    border: 1px solid var(--nmdc-border);
    border-radius: 13px;
    background: #fff;
}
.nmdc-step-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 10px;
}
.nmdc-step-heading > span:first-child {
    display: inline-grid;
    flex: 0 0 23px;
    width: 23px;
    height: 23px;
    place-items: center;
    border-radius: 50%;
    background: var(--nmdc-ink);
    color: #fff;
    font-size: .72rem;
    font-weight: 700;
}
.nmdc-step-heading h4 {
    margin: 0;
    color: var(--nmdc-ink);
    font-size: .92rem;
    line-height: 1.2;
}
.nmdc-calendar-panel > .nmdc-step-heading,
.nmdc-options-panel > .nmdc-step-heading { margin-bottom: 11px; }
.nmdc-traveler-copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 2px;
}
.nmdc-unit-price-hint {
    min-height: 1.1em;
    color: var(--nmdc-muted);
    font-size: .7rem;
    line-height: 1.25;
}
.nmdc-updating-label {
    min-height: 1.25em;
    margin: -3px 0 5px;
    color: var(--nmdc-muted);
    font-size: .7rem;
    line-height: 1.25;
}
.nmdc-calendar-panel.is-updating .nmdc-calendar-toolbar,
.nmdc-calendar-panel.is-updating .nmdc-weekdays,
.nmdc-calendar-panel.is-updating .nmdc-calendar,
.nmdc-times-section.is-updating .nmdc-slots {
    opacity: .55;
    pointer-events: none;
}
.nmdc-calendar-panel .nmdc-calendar-toolbar,
.nmdc-calendar-panel .nmdc-weekdays,
.nmdc-calendar-panel .nmdc-calendar,
.nmdc-times-section .nmdc-slots {
    transition: opacity .16s ease;
}
.nmdc-calendar-panel.is-updating::after,
.nmdc-times-section.is-updating::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 2px;
    border-radius: 999px;
    background: linear-gradient(90deg, transparent 0%, var(--nmdc-success) 45%, transparent 100%);
    background-size: 200% 100%;
    animation: nmdc-progress 1s linear infinite;
}
.nmdc-times-section { position: relative; min-height: 72px; }
@keyframes nmdc-progress {
    from { background-position: 100% 0; }
    to { background-position: -100% 0; }
}
.nmdc-price-breakdown {
    margin-top: 2px;
    padding: 10px 11px;
    border: 1px solid var(--nmdc-border);
    border-radius: 10px;
    background: var(--nmdc-soft);
}
.nmdc-price-breakdown[hidden] { display: none !important; }
.nmdc-price-line,
.nmdc-selection-total {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    padding: 3px 0;
    font-size: .76rem;
    line-height: 1.35;
}
.nmdc-price-line span { color: var(--nmdc-muted); }
.nmdc-price-line strong { text-align: right; font-size: .76rem; }
.nmdc-selection-total {
    margin-top: 5px;
    padding-top: 8px;
    border-top: 1px solid var(--nmdc-border);
    font-size: .88rem;
}
.nmdc-selection-total strong { font-size: 1rem; }
.nmdc-slot-card .nmdc-slot-price {
    margin-top: 3px;
    font-weight: 650;
}

@container (max-width: 420px) {
    .nmdc-travelers-panel { padding: 10px; }
    .nmdc-price-line,
    .nmdc-selection-total { align-items: flex-start; }
    .nmdc-price-line strong { max-width: 54%; }
}
.nmdc-options-panel {
    border: 1px solid var(--nmdc-border);
    border-radius: 13px;
    padding: 13px;
    background: #fff;
}
@container (max-width: 420px) {
    .nmdc-options-panel { padding: 10px; border-radius: 11px; }
}
