/* ==========================================================================
   Witbooking Booking Widget - Base Styles
   Lypsum Studio - v0.3.0-beta
   ========================================================================== */

:root {
    --wbw-primary: #2a6d6e;
    --wbw-primary-hover: #1e5455;
    --wbw-field-bg: #ffffff;
    --wbw-text: #2c3e50;
    --wbw-label: #2a6d6e;
    --wbw-border: #d4d4d4;
    --wbw-radius: 4px;
    --wbw-font: inherit;
    --wbw-shadow: 0 -2px 12px rgba(0, 0, 0, 0.12);
    --wbw-button-text: #ffffff;
    --wbw-z-index: 99999;
}

/* ==========================================================================
   Shared base
   ========================================================================== */

.wbw-widget {
    padding: 12px 20px;
    font-family: var(--wbw-font);
    box-sizing: border-box;
    width: 100%;
}

.wbw-widget *,
.wbw-widget *::before,
.wbw-widget *::after {
    box-sizing: border-box;
}

/* ==========================================================================
   Floating mode
   ========================================================================== */

.wbw-widget--floating {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: var(--wbw-z-index);
    box-shadow: var(--wbw-shadow);
}

.wbw-spacer {
    height: 80px;
}

/* ==========================================================================
   Inline mode
   ========================================================================== */

.wbw-widget--inline {
    position: relative;
    box-shadow: none;
}

/* ==========================================================================
   Inner layout
   ========================================================================== */

.wbw-widget__inner {
    display: flex;
    align-items: stretch;
    gap: 12px;
    width: 100%;
    flex-wrap: nowrap;
}

.wbw-widget__field {
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

.wbw-widget__field--dates {
    flex: 1.4;
    min-width: 0;
}

.wbw-widget__field--type {
    flex: 1;
    min-width: 0;
}

.wbw-widget__field--guests {
    flex: 0 0 auto;
    min-width: 0;
    position: relative;
}

.wbw-widget__field--action {
    flex: 0 0 auto;
    display: flex;
    align-items: stretch;
}

/* Labels */
.wbw-widget__label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--wbw-label);
    margin-bottom: 4px;
    white-space: nowrap;
    cursor: pointer;
}

/* Input & Select */
.wbw-widget__input,
.wbw-widget__select {
    width: 100%;
    height: 42px;
    padding: 0 12px;
    border: 1px solid var(--wbw-border);
    border-radius: var(--wbw-radius);
    background: var(--wbw-field-bg);
    color: var(--wbw-text);
    font-size: 14px;
    font-family: var(--wbw-font);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    outline: none;
    transition: border-color 0.2s ease;
}

.wbw-widget__input:focus,
.wbw-widget__select:focus {
    border-color: var(--wbw-primary);
}

/* Select arrow */
.wbw-widget__field--type::after {
    content: '';
    position: absolute;
    right: 14px;
    bottom: 18px;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--wbw-text);
    border-bottom: 2px solid var(--wbw-text);
    transform: rotate(45deg);
    pointer-events: none;
}

/* ==========================================================================
   Guests dropdown trigger
   ========================================================================== */

.wbw-guests-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    white-space: nowrap;
    text-align: left;
    min-width: 150px;
}

.wbw-guests-arrow {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--wbw-text);
    border-bottom: 2px solid var(--wbw-text);
    transform: rotate(45deg);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.wbw-guests-toggle[aria-expanded="true"] .wbw-guests-arrow {
    transform: rotate(-135deg);
}

/* ==========================================================================
   Guests dropdown panel
   ========================================================================== */

.wbw-guests-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    margin-bottom: 8px;
    background: var(--wbw-field-bg);
    border: 1px solid var(--wbw-border);
    border-radius: var(--wbw-radius);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.12);
    padding: 16px;
    z-index: calc(var(--wbw-z-index) + 2);
    min-width: 220px;
}

.wbw-guests-dropdown[hidden] {
    display: none;
}

.wbw-guest-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
}

.wbw-guest-row + .wbw-guest-row {
    border-top: 1px solid var(--wbw-border);
}

.wbw-guest-info {
    display: flex;
    flex-direction: column;
}

.wbw-guest-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--wbw-text);
}

.wbw-guest-counter {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1px solid var(--wbw-border);
    border-radius: var(--wbw-radius);
    overflow: hidden;
    background: var(--wbw-field-bg);
}

.wbw-guest-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: none;
    background: transparent;
    color: var(--wbw-primary);
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.15s ease;
    font-family: var(--wbw-font);
    line-height: 1;
}

.wbw-guest-btn:hover {
    background: rgba(42, 109, 110, 0.1);
}

.wbw-guest-btn:disabled,
.wbw-guest-btn[disabled] {
    opacity: 0.35;
    cursor: default;
}

.wbw-guest-input {
    width: 30px;
    height: 34px;
    text-align: center;
    border: none;
    border-left: 1px solid var(--wbw-border);
    border-right: 1px solid var(--wbw-border);
    background: transparent;
    color: var(--wbw-text);
    font-size: 15px;
    font-weight: 600;
    font-family: var(--wbw-font);
    -moz-appearance: textfield;
    outline: none;
}

.wbw-guest-input::-webkit-outer-spin-button,
.wbw-guest-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Apply button */
.wbw-guests-apply {
    display: block;
    width: 100%;
    margin-top: 12px;
    padding: 10px 0;
    border: none;
    border-radius: var(--wbw-radius);
    background: var(--wbw-primary);
    color: var(--wbw-button-text);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-family: var(--wbw-font);
}

.wbw-guests-apply:hover {
    background: var(--wbw-primary-hover);
}

/* ==========================================================================
   Search button
   ========================================================================== */

.wbw-widget__button {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 42px;
    padding: 0 36px;
    border: none;
    border-radius: var(--wbw-radius);
    background: var(--wbw-primary);
    color: var(--wbw-button-text);
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.2s ease;
    font-family: var(--wbw-font);
}

.wbw-widget__button:hover,
.wbw-widget__button:focus {
    background: var(--wbw-primary-hover);
    outline: none;
}

/* ==========================================================================
   Mobile CTA (floating only, hidden on desktop)
   ========================================================================== */

.wbw-widget__mobile-cta {
    display: none;
}

.wbw-widget__mobile-cta .wbw-cta-btn {
    width: 100%;
    height: 48px;
    font-size: 16px;
}

/* ==========================================================================
   Flatpickr z-index fix
   ========================================================================== */

.flatpickr-calendar {
    z-index: calc(var(--wbw-z-index) + 1) !important;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 900px) {
    .wbw-widget {
        padding: 10px 14px;
    }

    .wbw-widget__inner {
        gap: 8px;
    }

    .wbw-widget__button {
        padding: 0 20px;
        font-size: 13px;
    }

    .wbw-widget__label {
        font-size: 10px;
    }
}

@media (max-width: 600px) {
    .wbw-widget {
        padding: 10px 12px 14px;
    }

    .wbw-widget__inner {
        flex-wrap: wrap;
        gap: 8px;
    }

    .wbw-widget__field--dates,
    .wbw-widget__field--type {
        flex: 1 1 calc(50% - 4px);
        min-width: calc(50% - 4px);
    }

    .wbw-widget__field--guests {
        flex: 1 1 calc(50% - 4px);
        min-width: calc(50% - 4px);
    }

    .wbw-widget__field--action {
        flex: 1 1 calc(50% - 4px);
        min-width: calc(50% - 4px);
    }

    .wbw-widget__button {
        width: 100%;
        height: 44px;
    }

    .wbw-widget__input,
    .wbw-widget__select {
        height: 38px;
        font-size: 13px;
    }

    .wbw-widget__label {
        font-size: 9px;
    }

    .wbw-spacer {
        height: 130px;
    }

    .wbw-guests-toggle {
        min-width: 0;
    }

    /* Dropdown opens upward from inline too */
    .wbw-guests-dropdown {
        left: auto;
        right: 0;
    }
}

/* Narrow: floating collapses to CTA */
@media (max-width: 600px) {
    .wbw-widget--floating .wbw-widget__inner {
        display: none;
    }

    .wbw-widget--floating .wbw-widget__mobile-cta {
        display: block;
    }

    .wbw-widget--floating {
        padding: 10px 16px;
    }

    .wbw-spacer {
        height: 68px;
    }

    .wbw-widget--inline .wbw-widget__field--dates,
    .wbw-widget--inline .wbw-widget__field--type {
        flex: 1 1 100%;
        min-width: 100%;
    }

    .wbw-widget--inline .wbw-widget__field--guests,
    .wbw-widget--inline .wbw-widget__field--action {
        flex: 1 1 calc(50% - 4px);
        min-width: calc(50% - 4px);
    }
}

/* Body offset for floating */
body.wbw-has-widget {
    padding-bottom: 90px;
}

@media (max-width: 600px) {
    body.wbw-has-widget {
        padding-bottom: 140px;
    }
}

@media (max-width: 600px) {
    body.wbw-has-widget {
        padding-bottom: 68px;
    }
}
