.bookora-form {
    --bookora-font-family: var(--wp--preset--font-family--body, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);

    --bookora-surface-color: #ffffff;

    --bookora-primary-color: #0f172a;
    --bookora-accent-color: var(--bookora-primary-color);
    --bookora-button-background-color: #0f172a;
    --bookora-button-text-color: #ffffff;

    --bookora-text-color: #0f172a;
    --bookora-muted-color: #64748b;
    --bookora-label-color: #334155;

    --bookora-border-color: #e2e8f0;
    --bookora-soft-border-color: #f1f5f9;
    --bookora-soft-background-color: #f1f5f9;
    --bookora-soft-hover-background-color: #e2e8f0;

    --bookora-error-color: #dc2626;
    --bookora-error-text-color: #991b1b;
    --bookora-error-background-color: #fef2f2;

    --bookora-success-color: #166534;
    --bookora-success-background-color: #f0fdf4;

    --bookora-control-radius: 14px;
    --bookora-dropdown-radius: 18px;

    --bookora-control-height: 46px;
    --bookora-control-padding-x: 14px;

    --bookora-dropdown-shadow: 0 18px 60px rgba(15, 23, 42, 0.16);

    display: grid;
    grid-template-columns:
        minmax(170px, 1.3fr)
        minmax(145px, 1fr)
        minmax(145px, 1fr)
        minmax(190px, 1fr)
        minmax(190px, auto);
    gap: 12px;
    align-items: end;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    font-family: var(--bookora-font-family), sans-serif;
}

.bookora-form *,
.bookora-form *::before,
.bookora-form *::after {
    box-sizing: border-box;
}

.bookora-form--compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.bookora-form--compact .bookora-form__field[data-bookora-field="location"] {
    order: 1;
    grid-column: 1 / -1;
}

.bookora-form--compact .bookora-form__field[data-bookora-field="check_in"] {
    order: 2;
}

.bookora-form--compact .bookora-form__field[data-bookora-field="check_out"] {
    order: 3;
}

.bookora-form--compact .bookora-form__field[data-bookora-field="guests"] {
    order: 4;
}

.bookora-form--compact .bookora-form__actions {
    order: 5;
    grid-column: auto;
}

.bookora-form--vertical {
    grid-template-columns: 1fr;
}

.bookora-form--vertical .bookora-form__actions {
    grid-column: auto;
}

.bookora-form__field {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.bookora-form__field label {
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 16px;
    color: var(--bookora-label-color);
}

.bookora-form .bookora-form__field input,
.bookora-form .bookora-guests__trigger,
.bookora-form .bookora-date-range__trigger {
    appearance: none;
    -webkit-appearance: none;
    display: block;
    width: 100%;
    min-width: 0;
    height: var(--bookora-control-height);
    min-height: var(--bookora-control-height);
    margin: 0 !important;
    padding: 0 var(--bookora-control-padding-x) !important;
    border: 1px solid var(--bookora-border-color);
    border-radius: var(--bookora-control-radius) !important;
    background: var(--bookora-surface-color);
    color: var(--bookora-text-color);
    font-family: inherit;
    font-size: 14px;
    line-height: normal;
    box-shadow: none;
    box-sizing: border-box;
}

.bookora-form .bookora-date-range__trigger,
.bookora-form .bookora-guests__trigger {
    font-weight: 500;
    text-align: left;
    cursor: pointer;
}

.bookora-form .bookora-form__field input:hover,
.bookora-form .bookora-guests__trigger:hover,
.bookora-form .bookora-date-range__trigger:hover {
    border-color: var(--bookora-border-color);
}

.bookora-form .bookora-form__field input:focus,
.bookora-form .bookora-guests__trigger:focus,
.bookora-form .bookora-guests.is-open .bookora-guests__trigger,
.bookora-form .bookora-date-range__trigger:focus,
.bookora-form .bookora-date-range.is-open .bookora-date-range__trigger {
    outline: none;
    border-color: var(--bookora-accent-color);
}

/* Buttons */

.bookora-button,
.bookora-icon-button {
    appearance: none;
    -webkit-appearance: none;
    box-shadow: none;
    font-family: inherit;
    cursor: pointer;
    transition:
            filter 0.2s ease,
            opacity 0.2s ease,
            background-color 0.2s ease,
            border-color 0.2s ease,
            color 0.2s ease;
}

.bookora-button {
    min-height: 38px;
    padding: 0 14px;
    border-radius: var(--bookora-control-radius);
    font-size: 13px;
    font-weight: 700;
}

.bookora-button--primary {
    border: 1px solid var(--bookora-button-background-color);
    background: var(--bookora-button-background-color);
    color: var(--bookora-button-text-color);
}

.bookora-button--primary:not(:disabled):hover,
.bookora-button--primary:not(:disabled):focus {
    border-color: var(--bookora-button-background-color);
    background: var(--bookora-button-background-color);
    color: var(--bookora-button-text-color);
    filter: brightness(0.92);
    outline: none;
}

.bookora-button--outline {
    border: 1px solid var(--bookora-button-background-color);
    background: var(--bookora-surface-color);
    color: var(--bookora-button-background-color);
}

.bookora-button--outline:not(:disabled):hover,
.bookora-button--outline:not(:disabled):focus {
    border-color: var(--bookora-button-background-color);
    background: var(--bookora-button-background-color);
    color: var(--bookora-button-text-color);
    filter: brightness(0.92);
    outline: none;
}

.bookora-form .bookora-button:disabled,
.bookora-form .bookora-button[disabled],
.bookora-form .bookora-icon-button:disabled,
.bookora-form .bookora-icon-button[disabled] {
    opacity: 0.75;
    cursor: not-allowed;
    filter: none;
    box-shadow: none;
}

.bookora-form .bookora-button--primary:disabled,
.bookora-form .bookora-button--primary[disabled] {
    border-color: var(--bookora-button-background-color);
    background: var(--bookora-button-background-color);
    color: var(--bookora-button-text-color);
}

.bookora-form .bookora-button--outline:disabled,
.bookora-form .bookora-button--outline[disabled] {
    border-color: var(--bookora-button-background-color);
    background: var(--bookora-surface-color);
    color: var(--bookora-button-background-color);
}

.bookora-icon-button {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    min-width: 30px;
    min-height: 30px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: var(--bookora-soft-background-color);
    color: var(--bookora-text-color);
    font-size: 18px;
    font-weight: 600;
    line-height: 1;
}

.bookora-icon-button:not(:disabled):hover,
.bookora-icon-button:not(:disabled):focus {
    outline: none;
    background: var(--bookora-soft-hover-background-color);
    color: var(--bookora-text-color);
    filter: brightness(0.97);
}

.bookora-form .bookora-icon-button:disabled,
.bookora-form .bookora-icon-button[disabled] {
    border: 0;
    background: var(--bookora-soft-background-color);
    color: var(--bookora-text-color);
}

/* Date range */

.bookora-date-range {
    position: relative;
}

.bookora-date-range__dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 30;
    display: none;
    width: 320px;
    padding: 14px;
    border: 1px solid var(--bookora-border-color);
    border-radius: var(--bookora-dropdown-radius);
    background: var(--bookora-surface-color);
    box-shadow: var(--bookora-dropdown-shadow);
}

.bookora-date-range.is-open .bookora-date-range__dropdown {
    display: block;
}

.bookora-date-range__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.bookora-date-range__header strong {
    font-size: 14px;
    font-weight: 700;
    color: var(--bookora-text-color);
}

.bookora-date-range__nav {
    font-size: 20px;
}

.bookora-date-range__weekdays,
.bookora-date-range__days {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
}

.bookora-date-range__weekdays {
    margin-bottom: 6px;
}

.bookora-date-range__weekdays span {
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    color: var(--bookora-muted-color);
}

.bookora-date-range__day {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--bookora-text-color);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.bookora-date-range__day:hover,
.bookora-date-range__day:focus {
    outline: none;
    background: var(--bookora-soft-background-color);
    color: var(--bookora-text-color);
}

.bookora-date-range__day.is-selected {
    background: var(--bookora-accent-color);
    color: #ffffff;
}

.bookora-date-range__day.is-in-range {
    background: var(--bookora-soft-background-color);
}

.bookora-date-range__day:disabled {
    opacity: 0.75;
    cursor: not-allowed;
}

.bookora-date-range__day.is-empty {
    pointer-events: none;
    visibility: hidden;
}

.bookora-date-range__summary {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: var(--bookora-control-radius);
    background: var(--bookora-soft-background-color);
    color: var(--bookora-muted-color);
    font-size: 13px;
    font-weight: 600;
}

.bookora-date-range__actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.bookora-date-range__clear,
.bookora-date-range__done {
    flex: 1;
}

/* Guests */

.bookora-guests {
    position: relative;
}

.bookora-guests__trigger[readonly] {
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bookora-guests__dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 20;
    display: none;
    width: 280px;
    padding: 14px;
    border: 1px solid var(--bookora-border-color);
    border-radius: var(--bookora-dropdown-radius);
    background: var(--bookora-surface-color);
    box-shadow: var(--bookora-dropdown-shadow);
}

.bookora-guests.is-open .bookora-guests__dropdown {
    display: block;
}

.bookora-guests__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 0;
}

.bookora-guests__row + .bookora-guests__row {
    border-top: 1px solid var(--bookora-soft-border-color);
}

.bookora-guests__title {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: var(--bookora-text-color);
}

.bookora-guests__subtitle {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    color: var(--bookora-muted-color);
}

.bookora-guests__counter {
    display: flex;
    align-items: center;
    gap: 10px;
}

.bookora-guests__button:disabled {
    opacity: 0.45;
}

.bookora-guests__value {
    min-width: 20px;
    text-align: center;
    font-size: 15px;
    font-weight: 700;
    color: var(--bookora-text-color);
}

/* Child ages */

.bookora-guests__children-ages {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 10px 0 14px;
    border-top: 1px solid var(--bookora-soft-border-color);
}

.bookora-guests__children-ages[hidden] {
    display: none;
}

.bookora-guests__age-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.bookora-guests__age-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--bookora-muted-color);
}

.bookora-guests__age-picker {
    position: relative;
}

.bookora-form .bookora-guests__age-trigger {
    width: 100%;
    min-height: 36px !important;
    height: 36px !important;
    padding: 0 34px 0 10px !important;
    border: 1px solid var(--bookora-border-color);
    border-radius: var(--bookora-control-radius) !important;
    background: var(--bookora-surface-color);
    color: var(--bookora-text-color);
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bookora-form .bookora-guests__age-trigger:focus,
.bookora-form .bookora-guests__age-picker.is-open .bookora-guests__age-trigger {
    outline: none;
    border-color: var(--bookora-accent-color);
}

.bookora-guests__age-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 40;
    display: none;
    width: 100%;
    max-height: 180px;
    overflow-y: auto;
    padding: 0;
    border: 1px solid var(--bookora-border-color);
    border-radius: var(--bookora-dropdown-radius);
    background: var(--bookora-surface-color);
    box-shadow: var(--bookora-dropdown-shadow);
    scrollbar-width: thin;
    scrollbar-color: var(--bookora-soft-hover-background-color) transparent;
}

.bookora-guests__age-dropdown::-webkit-scrollbar {
    width: 6px;
}

.bookora-guests__age-dropdown::-webkit-scrollbar-track {
    background: transparent;
}

.bookora-guests__age-dropdown::-webkit-scrollbar-thumb {
    background: var(--bookora-soft-hover-background-color);
    border-radius: 999px;
}

.bookora-guests__age-dropdown::-webkit-scrollbar-thumb:hover {
    background: var(--bookora-border-color);
}

.bookora-guests__age-picker.is-open .bookora-guests__age-dropdown {
    display: block;
}

.bookora-guests__age-option {
    appearance: none;
    -webkit-appearance: none;
    display: block;
    width: 100%;
    padding: 7px 10px;
    border: 0;
    background: transparent;
    color: var(--bookora-text-color);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}

.bookora-guests__age-option:hover,
.bookora-guests__age-option:focus {
    outline: none;
    background: var(--bookora-soft-background-color);
    color: var(--bookora-text-color);
}

/* Pets */

.bookora-guests__pets {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
    border-top: 1px solid var(--bookora-soft-border-color);
}

.bookora-guests__toggle {
    appearance: none;
    -webkit-appearance: none;
    position: relative;
    flex: 0 0 auto;
    width: 46px;
    height: 26px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: var(--bookora-soft-hover-background-color);
    box-shadow: none;
    cursor: pointer;
}

.bookora-guests__toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 999px;
    background: var(--bookora-surface-color);
    transition: transform 0.2s ease;
}

.bookora-guests__toggle.is-active {
    background: var(--bookora-accent-color);
}

.bookora-guests__toggle.is-active .bookora-guests__toggle-thumb {
    transform: translateX(20px);
}

.bookora-guests__toggle:hover,
.bookora-guests__toggle:focus {
    outline: none;
    background: var(--bookora-soft-hover-background-color);
}

.bookora-guests__toggle.is-active:hover,
.bookora-guests__toggle.is-active:focus {
    background: var(--bookora-accent-color);
}

.bookora-guests__done {
    width: 100%;
    min-height: 40px;
    margin-top: 4px;
    font-size: 14px;
}

/* Submit */

.bookora-form__actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.bookora-form__actions::before {
    content: "";
    min-height: 6px;
    line-height: 6px;
}

.bookora-form__submit {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 100%;
    min-width: 160px;
    min-height: calc(var(--bookora-control-height) + 1px);
    padding: 0 calc(var(--bookora-control-padding-x) + 8px);
    font-size: 14px;
    line-height: normal;
    white-space: nowrap;
}

.bookora-form__submit.is-loading {
    opacity: 0.75;
    cursor: wait;
    filter: none;
}

.bookora-form .bookora-form__submit {
    margin: 0 !important;
}

/* Messages */

.bookora-form__message {
    display: none;
    grid-column: 1 / -1;
    padding: 12px 14px;
    border-radius: var(--bookora-control-radius);
    font-size: 14px;
    font-weight: 600;
}

.bookora-form__message.is-error {
    display: block;
    background: var(--bookora-error-background-color);
    color: var(--bookora-error-text-color);
}

.bookora-form__message.is-success {
    display: block;
    background: var(--bookora-success-background-color);
    color: var(--bookora-success-color);
}

/* Icons */

.bookora-control {
    position: relative;
}

.bookora-control__icon {
    position: absolute;
    top: 50%;
    right: var(--bookora-control-padding-x);
    z-index: 2;
    display: block;
    width: 18px;
    height: 18px;
    transform: translateY(-50%);
    background-color: var(--bookora-text-color);
    opacity: 0.45;
    pointer-events: none;
    transition:
            opacity 0.2s ease,
            background-color 0.2s ease;
    mask-repeat: no-repeat;
    mask-position: center;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    -webkit-mask-size: contain;
}

.bookora-control__icon--calendar {
    mask-image: url("../icons/calendar.svg");
    -webkit-mask-image: url("../icons/calendar.svg");
}

.bookora-control__icon--chevron {
    mask-image: url("../icons/chevron-down.svg");
    -webkit-mask-image: url("../icons/chevron-down.svg");
}

.bookora-control:focus-within .bookora-control__icon,
.bookora-date-range.is-open .bookora-control__icon,
.bookora-guests.is-open .bookora-control__icon,
.bookora-guests__age-picker.is-open .bookora-control__icon {
    opacity: 1;
    background-color: var(--bookora-accent-color);
}

.bookora-form .bookora-control input {
    padding-right: 38px !important;
}

/* Responsive */

@media (max-width: 1200px) {
    .bookora-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .bookora-form .bookora-form__field[data-bookora-field="location"] {
        order: 1;
        grid-column: 1 / -1;
    }

    .bookora-form .bookora-form__field[data-bookora-field="check_in"] {
        order: 2;
    }

    .bookora-form .bookora-form__field[data-bookora-field="check_out"] {
        order: 3;
    }

    .bookora-form .bookora-form__field[data-bookora-field="guests"] {
        order: 4;
    }

    .bookora-form__actions {
        order: 5;
        grid-column: auto;
    }

    .bookora-form.bookora-form--vertical {
        grid-template-columns: 1fr;
    }

    .bookora-form.bookora-form--vertical .bookora-form__actions {
        grid-column: auto;
    }

    .bookora-form__submit {
        width: 100%;
    }
}

@media (max-width: 640px) {
    .bookora-form {
        grid-template-columns: 1fr;
    }

    .bookora-form__actions {
        grid-column: auto;
    }

    .bookora-guests__dropdown {
        width: min(320px, calc(100vw - 48px));
    }

    .bookora-date-range__dropdown {
        width: min(340px, calc(100vw - 48px));
    }

    .bookora-guests__children-ages {
        grid-template-columns: 1fr;
    }
}