/**
 * Refugio Bookings — Booking Widget Styles
 *
 * Premium design system matching the Refugio del Bosque dashboard.
 * Colors, typography and spacing are consistent with the admin panel.
 *
 * @package RefugioBookings
 */

/* ===========================
   CSS Custom Properties
   =========================== */
:root {
    --rfb-fd: #182910;
    --rfb-fm: #254d18;
    --rfb-fl: #3a6e22;
    --rfb-sage: #567a38;
    --rfb-terra: #6a3c12;
    --rfb-tl: #9c6228;
    --rfb-gold: #c4982a;
    --rfb-sand: #e2cc96;
    --rfb-cream: #f4eed8;
    --rfb-paper: #f9f5ea;
    --rfb-bark: #26160a;
    --rfb-tx: #1e1408;
    --rfb-txm: #463820;
    --rfb-txl: #887248;
    --rfb-line: #e7dfc9;
    --rfb-line2: #efe8d5;
    --rfb-ok: #3a6e22;
    --rfb-okbg: #e6efdb;
    --rfb-warn: #9c6228;
    --rfb-warnbg: #f6ecd3;
    --rfb-radius: 12px;
    --rfb-font-serif: "Cormorant Garamond", Georgia, serif;
    --rfb-font-sans: "DM Sans", system-ui, -apple-system, sans-serif;
    --rfb-transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===========================
   Form Container
   =========================== */
.rfb-booking-form {
    font-family: var(--rfb-font-sans);
    background-color: #fffdf7;
    border: 1px solid var(--rfb-line);
    border-radius: var(--rfb-radius);
    padding: 28px 24px 24px;
    max-width: 420px;
    box-sizing: border-box;
    box-shadow: 0 4px 24px rgba(24, 41, 16, 0.06),
                0 1px 4px rgba(24, 41, 16, 0.04);
    /* Force full width even inside flex/grid add-to-cart forms (Elementor Pro's
       "Custom Add To Cart" widget lays its form out as a flex row by default,
       which otherwise squeezes the card, quantity input and button side by side). */
    width: 100%;
    flex: 0 0 100%;
}

/* ===========================
   Native WooCommerce Add-to-Cart Integration
   (Elementor Pro "Custom Add To Cart" widget, or any theme's default template)
   =========================== */
.rfb-has-booking {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: stretch;
    /* Explicit margins instead of `gap` — with flex-wrap, `gap` was adding an
       inconsistent leading offset to the first wrapped line (the card) but
       not the second (the button), visually misaligning the two. */
    gap: 0 !important;
}

.rfb-has-booking > .rfb-booking-form {
    margin-bottom: 14px;
}

.rfb-hidden-quantity {
    display: none !important;
}

/* Restyle the real WooCommerce submit button so it reads as part of the
   card above it, whatever classes/inline styles the theme or Elementor
   applied to it. */
.rfb-native-submit {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 100% !important;
    flex: 1 1 100% !important;
    max-width: 420px;
    padding: 14px 20px !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 10px !important;
    background-color: var(--rfb-terra) !important;
    background-image: none !important;
    color: #ffffff !important;
    font-family: var(--rfb-font-sans) !important;
    font-size: 0.85rem !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.06em !important;
    cursor: pointer;
    transition: all var(--rfb-transition) !important;
    box-shadow: none !important;
}

.rfb-native-submit:hover {
    background-color: var(--rfb-fd) !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(24, 41, 16, 0.18) !important;
}

.rfb-native-submit:active {
    transform: translateY(0);
}

.rfb-native-submit.disabled,
.rfb-native-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ===========================
   Trust badge (below the submit button)
   =========================== */
.rfb-trust-badge {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 14px 0 0;
    font-size: 0.74rem;
    color: var(--rfb-txl);
    text-align: center;
    /* Full-width row even when a flex sibling of the native WC form
       (.rfb-has-booking) — same reasoning as .rfb-booking-form. Capped
       at the same max-width as the card/button above it so it doesn't
       center itself across the full (wider) form instead. */
    width: 100%;
    max-width: 420px;
    flex: 1 1 100%;
}

.rfb-trust-badge svg {
    width: 15px;
    height: 15px;
    color: var(--rfb-ok);
    flex-shrink: 0;
}

/* ===========================
   Header
   =========================== */
.rfb-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 22px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--rfb-line2);
}

.rfb-heading {
    font-family: var(--rfb-font-serif);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--rfb-fd);
    margin: 0;
    line-height: 1.2;
}

.rfb-price-subtitle {
    font-size: 0.85rem;
    color: var(--rfb-txl);
}

.rfb-price-subtitle strong {
    font-weight: 700;
    color: var(--rfb-terra);
}

.rfb-price-badge {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    flex-shrink: 0;
}

.rfb-price-amount {
    font-family: var(--rfb-font-serif);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--rfb-terra);
    line-height: 1;
}

.rfb-price-unit,
.rfb-price-unit-text {
    font-size: 0.68rem;
    color: var(--rfb-txl);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 2px;
}

/* ===========================
   Labels & Icons
   =========================== */
.rfb-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--rfb-txl);
    margin-bottom: 6px;
}

.rfb-icon {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    color: var(--rfb-sage);
}

.rfb-discount-badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 6px;
    border-radius: 99px;
    background: var(--rfb-okbg);
    color: var(--rfb-ok);
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0;
    margin-left: 4px;
}

/* ===========================
   Field Groups
   =========================== */
.rfb-field-group {
    margin-bottom: 18px;
}

.rfb-dates {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.rfb-guests {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* ===========================
   Inputs
   =========================== */
.rfb-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--rfb-line);
    border-radius: 8px;
    background: #fffdf7;
    font-family: var(--rfb-font-sans);
    font-size: 0.85rem;
    color: var(--rfb-tx);
    outline: none;
    box-sizing: border-box;
    transition: border-color var(--rfb-transition), box-shadow var(--rfb-transition);
    -webkit-appearance: none;
}

.rfb-input:focus {
    border-color: var(--rfb-sage);
    box-shadow: 0 0 0 3px rgba(86, 122, 56, 0.12);
}

.rfb-input:hover {
    border-color: var(--rfb-sand);
}

/* Date inputs - custom styling */
input[type="date"].rfb-input {
    cursor: pointer;
    position: relative;
}

input[type="date"].rfb-input::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.5;
    transition: opacity var(--rfb-transition);
}

input[type="date"].rfb-input::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

/* ===========================
   Nights Display
   =========================== */
.rfb-nights-display {
    display: flex;
    align-items: baseline;
    justify-content: flex-start;
    gap: 4px;
    margin: 0 0 16px;
    font-size: 0.8rem;
    color: var(--rfb-txl);
}

.rfb-nights-count {
    font-weight: 600;
    color: var(--rfb-txl);
}

.rfb-nights-label {
    text-transform: lowercase;
}

/* ===========================
   Stepper Controls
   =========================== */
.rfb-stepper-field {
    display: flex;
    flex-direction: column;
}

.rfb-stepper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border-radius: 8px;
    background: var(--rfb-cream);
    padding: 8px 10px;
}

.rfb-stepper-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 1px solid rgba(106, 60, 18, 0.35) !important;
    border-radius: 7px !important;
    background: #fffdf7 !important;
    color: var(--rfb-terra) !important;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--rfb-transition);
    user-select: none;
    -webkit-user-select: none;
    line-height: 1;
    flex-shrink: 0;
    box-shadow: none !important;
}

.rfb-stepper-btn:hover {
    background: var(--rfb-terra) !important;
    color: #fff !important;
    border-color: var(--rfb-terra) !important;
}

.rfb-stepper-btn:active {
    transform: scale(0.92);
}

.rfb-stepper-value {
    flex: 1;
    text-align: center;
    border: none !important;
    background: var(--rfb-sand) !important;
    border-radius: 6px !important;
    padding: 6px 4px;
    font-family: var(--rfb-font-sans);
    font-size: 1rem;
    font-weight: 700;
    color: var(--rfb-tx) !important;
    outline: none;
    width: 100%;
    -moz-appearance: textfield;
    box-shadow: none !important;
}

.rfb-stepper-value::-webkit-outer-spin-button,
.rfb-stepper-value::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* ===========================
   Extras Section
   =========================== */
.rfb-extras-section {
    margin-bottom: 20px;
}

.rfb-extras-label {
    margin-bottom: 10px;
}

.rfb-extras-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.rfb-extras-loading {
    padding: 16px;
    text-align: center;
    color: var(--rfb-txl);
    font-style: italic;
    font-size: 0.82rem;
}

.rfb-extra-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid var(--rfb-line2);
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--rfb-transition);
    user-select: none;
    -webkit-user-select: none;
}

.rfb-extra-item:hover {
    border-color: var(--rfb-sand);
    background: rgba(244, 238, 216, 0.3);
}

.rfb-extra-item.rfb-extra-selected {
    border-color: var(--rfb-sage);
    background: var(--rfb-okbg);
    box-shadow: 0 0 0 2px rgba(58, 110, 34, 0.1);
}

.rfb-extra-checkbox {
    display: none;
}

.rfb-extra-check {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    border: 2px solid var(--rfb-line);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--rfb-transition);
}

.rfb-extra-selected .rfb-extra-check {
    background: var(--rfb-fl);
    border-color: var(--rfb-fl);
}

.rfb-extra-check svg {
    width: 12px;
    height: 12px;
    stroke: white;
    opacity: 0;
    transition: opacity var(--rfb-transition);
}

.rfb-extra-selected .rfb-extra-check svg {
    opacity: 1;
}

.rfb-extra-icon {
    font-size: 1.4rem;
    line-height: 1;
    flex-shrink: 0;
}

.rfb-extra-info {
    flex: 1;
    min-width: 0;
}

.rfb-extra-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--rfb-tx);
    line-height: 1.2;
}

.rfb-extra-desc {
    font-size: 0.7rem;
    color: var(--rfb-txl);
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rfb-extra-price {
    font-family: var(--rfb-font-serif);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--rfb-terra);
    flex-shrink: 0;
    white-space: nowrap;
}

/* ===========================
   Price Summary
   =========================== */
.rfb-summary {
    border-top: 1px solid var(--rfb-line2);
    padding-top: 16px;
    margin-bottom: 18px;
}

.rfb-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
}

.rfb-summary-line .rfb-summary-label {
    font-size: 0.78rem;
    color: var(--rfb-txl);
}

.rfb-summary-line .rfb-summary-value {
    font-size: 0.82rem;
    color: var(--rfb-txm);
}

.rfb-summary-total {
    margin-top: 8px;
    padding-top: 10px;
    border-top: 1px dashed var(--rfb-line);
}

.rfb-summary-total .rfb-summary-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--rfb-fd);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.rfb-summary-total .rfb-summary-value {
    font-family: var(--rfb-font-serif);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--rfb-terra);
}

/* ===========================
   Submit Button
   =========================== */
.rfb-submit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px 20px;
    border: none;
    border-radius: 10px;
    background-color: var(--rfb-terra);
    color: #ffffff;
    font-family: var(--rfb-font-sans);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: all var(--rfb-transition);
    position: relative;
    overflow: hidden;
}

.rfb-submit-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.08),
        transparent
    );
    transition: left 0.5s ease;
}

.rfb-submit-btn:hover {
    background-color: var(--rfb-fd);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(24, 41, 16, 0.18);
}

.rfb-submit-btn:hover::before {
    left: 100%;
}

.rfb-submit-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(24, 41, 16, 0.12);
}

.rfb-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.rfb-btn-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.rfb-spinner {
    width: 18px;
    height: 18px;
    animation: rfb-spin 0.8s linear infinite;
}

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

/* ===========================
   Messages
   =========================== */
.rfb-message {
    margin-top: 14px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.8rem;
    line-height: 1.4;
    text-align: center;
    animation: rfb-fadeIn 0.3s ease;
}

.rfb-message-success {
    background: var(--rfb-okbg);
    color: var(--rfb-ok);
    border: 1px solid rgba(58, 110, 34, 0.2);
}

.rfb-message-error {
    background: #fde8e8;
    color: #b91c1c;
    border: 1px solid rgba(185, 28, 28, 0.15);
}

.rfb-message a {
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
}

@keyframes rfb-fadeIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===========================
   Responsive
   =========================== */
@media (max-width: 480px) {
    .rfb-booking-form {
        padding: 22px 18px 20px;
        max-width: 100%;
        border-radius: 10px;
    }

    .rfb-header {
        flex-direction: column;
        gap: 8px;
    }

    .rfb-price-badge {
        align-items: flex-start;
        flex-direction: row;
        gap: 4px;
        align-items: baseline;
    }

    .rfb-dates {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .rfb-guests {
        grid-template-columns: 1fr 1fr;
    }
}

/* ===========================
   Calendar (replaces the native date inputs)
   =========================== */
.rfb-calendar-wrapper {
    position: relative;
    margin-bottom: 14px;
}

.rfb-calendar-trigger {
    width: 100%;
    text-align: left;
    padding: 12px 14px;
    border: 1px solid var(--rfb-line) !important;
    border-radius: 8px !important;
    background: #fffdf7 !important;
    font-family: var(--rfb-font-sans);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--rfb-fd) !important;
    cursor: pointer;
    transition: border-color var(--rfb-transition);
    box-shadow: none !important;
}

.rfb-calendar-trigger:hover {
    border-color: var(--rfb-sand) !important;
}

.rfb-calendar-popover {
    position: absolute;
    z-index: 40;
    top: calc(100% + 8px);
    left: 0;
    background: #fffdf7;
    border: 1px solid var(--rfb-line);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(24, 41, 16, 0.16);
    padding: 16px;
    width: max-content;
    max-width: calc(100vw - 40px);
}

.rfb-cal-nav {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
}

.rfb-cal-nav-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--rfb-line) !important;
    border-radius: 6px !important;
    background: #fffdf7 !important;
    color: var(--rfb-fd) !important;
    cursor: pointer;
    font-size: 0.9rem;
    box-shadow: none !important;
}

.rfb-cal-nav-btn:hover {
    background: var(--rfb-cream) !important;
}

.rfb-cal-months {
    display: flex;
    gap: 20px;
}

.rfb-cal-month-title {
    font-family: var(--rfb-font-serif);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--rfb-fd);
    text-align: center;
    margin-bottom: 8px;
}

.rfb-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 28px);
    gap: 2px;
}

.rfb-cal-dow {
    width: 28px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.62rem;
    font-weight: 700;
    color: var(--rfb-txl);
    text-transform: uppercase;
}

.rfb-cal-day {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none !important;
    border-radius: 6px !important;
    background: transparent !important;
    font-family: var(--rfb-font-sans);
    font-size: 0.76rem;
    color: var(--rfb-tx) !important;
    cursor: pointer;
    transition: all var(--rfb-transition);
    box-shadow: none !important;
}

.rfb-cal-day-empty {
    cursor: default;
}

.rfb-cal-day:not(:disabled):not(.rfb-cal-day-empty):hover {
    background: var(--rfb-cream) !important;
}

.rfb-cal-day-past {
    color: var(--rfb-line) !important;
    cursor: not-allowed;
}

.rfb-cal-day-blocked {
    color: #c99 !important;
    text-decoration: line-through;
    background: #fdeeee !important;
    cursor: not-allowed;
}

.rfb-cal-day-checkin,
.rfb-cal-day-checkout {
    background: var(--rfb-fl) !important;
    color: #fff !important;
    font-weight: 700;
}

.rfb-cal-day-inrange {
    background: var(--rfb-okbg);
    border-radius: 0;
}

.rfb-cal-hint {
    margin-top: 10px;
    text-align: center;
    font-size: 0.72rem;
    color: var(--rfb-txl);
}

.rfb-cal-hint-error {
    color: #b91c1c;
    font-weight: 600;
}

@media (max-width: 480px) {
    .rfb-cal-months {
        flex-direction: column;
        gap: 12px;
    }

    .rfb-calendar-popover {
        left: 50%;
        transform: translateX(-50%);
    }
}

/* ===========================
   Editor Notice (Elementor)
   =========================== */
.rfb-editor-notice {
    font-family: var(--rfb-font-sans);
}
