/* Bar Booking Public Styles */

:root {
    --bb-form-bg: #ffffff;
    --bb-text: #1f2937;
    --bb-heading: #111827;
    --bb-muted: #6b7280;
    --bb-border: #d1d5db;
    --bb-input-bg: #ffffff;
    --bb-input-text: #111827;
    --bb-btn-bg: #0073aa;
    --bb-btn-text: #ffffff;
    --bb-btn-hover: #005f8d;
    --bb-success-bg: #e9fbe5;
    --bb-success-text: #166534;
    --bb-error-bg: #fde8e8;
    --bb-error-text: #991b1b;
    --bb-radius: 8px;
    --bb-form-max-width: 680px;
}

/* Booking form wrapper */
.bar-booking-form-wrapper {
    background: var(--bb-form-bg);
    color: var(--bb-text);
    border: 1px solid var(--bb-border);
    border-radius: var(--bb-radius);
    padding: 24px;
    margin: 20px 0;
    max-width: var(--bb-form-max-width);
    box-sizing: border-box;
}

.bar-booking-form-wrapper h2 {
    color: var(--bb-heading);
    margin: 0 0 18px;
    font-size: clamp(1.2rem, 2vw, 1.5rem);
    line-height: 1.3;
}

/* Form layout */
.bar-booking-form {
    display: grid;
    gap: 14px;
}

.bar-booking-form .form-group {
    margin: 0;
}

.bar-booking-form label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--bb-heading);
    font-size: 0.93rem;
}

.bar-booking-form .required {
    color: var(--bb-error-text);
}

.bar-booking-form input:not([type="checkbox"]),
.bar-booking-form textarea,
.bar-booking-form select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--bb-border);
    border-radius: calc(var(--bb-radius) - 3px);
    background: var(--bb-input-bg);
    color: var(--bb-input-text) !important;
    -webkit-text-fill-color: var(--bb-input-text);
    caret-color: var(--bb-input-text);
    box-sizing: border-box;
    font: inherit;
}

.bar-booking-form input:not([type="checkbox"]):focus,
.bar-booking-form textarea:focus,
.bar-booking-form select:focus {
    outline: none;
    border-color: var(--bb-btn-bg);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--bb-btn-bg) 15%, transparent);
}

.bar-booking-form input[type="date"],
.bar-booking-form input[type="email"],
.bar-booking-form input[type="number"],
.bar-booking-form input[type="tel"],
.bar-booking-form input[type="text"] {
    color: var(--bb-input-text) !important;
    -webkit-text-fill-color: var(--bb-input-text);
}

.bar-booking-form textarea {
    resize: vertical;
    min-height: 90px;
}

.bar-booking-form small {
    color: var(--bb-muted);
    display: block;
    margin-top: 6px;
}

/* Checkbox row */
.bar-booking-form input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
}

.bar-booking-form label.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0;
    color: var(--bb-text);
    font-weight: 500;
}

/* Buttons */
.bar-booking-form button,
.bar-booking-form .button,
.bar-booking-form .button-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 16px;
    border-radius: calc(var(--bb-radius) - 2px);
    border: 1px solid transparent;
    background: var(--bb-btn-bg);
    color: var(--bb-btn-text);
    cursor: pointer;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    transition: background-color .2s ease, transform .05s ease;
}

.bar-booking-form button:hover,
.bar-booking-form .button:hover,
.bar-booking-form .button-primary:hover {
    background: var(--bb-btn-hover);
}

.bar-booking-form button:active,
.bar-booking-form .button:active,
.bar-booking-form .button-primary:active {
    transform: translateY(1px);
}

.bar-booking-form button:disabled,
.bar-booking-form .button:disabled,
.bar-booking-form .button-primary:disabled {
    opacity: .65;
    cursor: not-allowed;
}

/* Time slot grid */
.bar-booking-form .bb-booking-time-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
    gap: 8px;
    overflow: visible;
}

.bar-booking-form .bb-booking-time-option {
    position: relative;
    min-height: 44px;
    padding: 9px 10px;
    border: 1px solid var(--bb-border);
    border-radius: calc(var(--bb-radius) - 2px);
    background: var(--bb-input-bg);
    color: var(--bb-input-text) !important;
    cursor: pointer;
    font: inherit;
    font-weight: 600;
    line-height: 1.2;
    transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}

.bar-booking-form .bb-booking-time-option:hover,
.bar-booking-form .bb-booking-time-option:focus-visible,
.bar-booking-form .bb-booking-time-option.is-selected {
    border-color: var(--bb-btn-bg);
    background: color-mix(in srgb, var(--bb-btn-bg) 10%, var(--bb-input-bg));
    color: var(--bb-heading) !important;
}

.bar-booking-form .bb-booking-time-option:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--bb-btn-bg) 25%, transparent);
    outline-offset: 2px;
}

.bar-booking-form .bb-booking-time-option.is-unavailable {
    border-style: dashed;
    background: color-mix(in srgb, var(--bb-input-bg) 82%, var(--bb-border));
    color: var(--bb-muted) !important;
    cursor: help;
    font-weight: 500;
}

.bar-booking-form .bb-booking-time-option.is-unavailable:hover,
.bar-booking-form .bb-booking-time-option.is-unavailable:focus-visible,
.bar-booking-form .bb-booking-time-option.is-unavailable.is-tooltip-visible {
    border-color: var(--bb-muted);
    background: color-mix(in srgb, var(--bb-input-bg) 72%, var(--bb-border));
    color: var(--bb-text) !important;
}

.bb-booking-time-tooltip {
    position: absolute;
    z-index: 5;
    left: 50%;
    bottom: calc(100% + 8px);
    display: none;
    width: max-content;
    max-width: min(260px, calc(100vw - 32px));
    padding: 8px 10px;
    border-radius: 6px;
    background: #1f2937;
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.35;
    text-align: left;
    transform: translateX(-50%);
    box-shadow: 0 5px 16px rgba(15, 23, 42, .2);
    pointer-events: none;
}

.bb-booking-time-tooltip::after {
    position: absolute;
    top: 100%;
    left: 50%;
    width: 0;
    height: 0;
    border: 5px solid transparent;
    border-top-color: #1f2937;
    content: '';
    transform: translateX(-50%);
}

.bar-booking-form .bb-booking-time-option.is-unavailable:hover .bb-booking-time-tooltip,
.bar-booking-form .bb-booking-time-option.is-unavailable:focus-visible .bb-booking-time-tooltip,
.bar-booking-form .bb-booking-time-option.is-unavailable.is-tooltip-visible .bb-booking-time-tooltip {
    display: block;
}

.bb-booking-time-grid-message {
    grid-column: 1 / -1;
    color: var(--bb-muted);
    font-size: .9rem;
}

/* Result messages */
#booking-message {
    display: none;
    margin-top: 14px;
    padding: 14px;
    border-radius: calc(var(--bb-radius) - 2px);
    border: 1px solid var(--bb-border);
}

#booking-message p {
    margin: 0;
}

#booking-message.is-success {
    background: var(--bb-success-bg);
    color: var(--bb-success-text);
    border-color: color-mix(in srgb, var(--bb-success-text) 30%, var(--bb-success-bg));
}

#booking-message.is-error {
    background: var(--bb-error-bg);
    color: var(--bb-error-text);
    border-color: color-mix(in srgb, var(--bb-error-text) 30%, var(--bb-error-bg));
}

/* Opening hours shortcode */
.bar-booking-opening-hours {
    max-width: var(--bb-form-max-width);
    color: var(--bb-text);
}

.bar-booking-opening-hours .oh-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid var(--bb-border);
    border-radius: var(--bb-radius);
    overflow: hidden;
    background: var(--bb-form-bg);
}

.bar-booking-opening-hours .oh-table tr:nth-child(odd) {
    background: color-mix(in srgb, var(--bb-form-bg) 90%, #000 10%);
}

.bar-booking-opening-hours .oh-table td {
    padding: 9px 12px;
    font-size: 14px;
    border-bottom: 1px solid var(--bb-border);
}

.bar-booking-opening-hours .oh-table tr:last-child td {
    border-bottom: none;
}

.bar-booking-opening-hours .oh-table .oh-day {
    font-weight: 600;
    width: 120px;
    color: var(--bb-heading);
}

.bar-booking-opening-hours .oh-table .oh-closed-label {
    color: var(--bb-muted);
    font-style: italic;
}

.bar-booking-opening-hours .oh-today .oh-day {
    color: var(--bb-btn-bg);
}

.bar-booking-opening-hours .oh-special {
    margin-top: 18px;
}

.bar-booking-opening-hours .oh-special h3 {
    font-size: 15px;
    margin: 0 0 10px;
    color: var(--bb-heading);
}

.bar-booking-opening-hours .oh-special-list {
    margin: 0;
    padding: 0;
    display: grid;
    gap: 10px;
}

.bar-booking-opening-hours .oh-special-item {
    display: grid;
    grid-template-columns: minmax(130px, 0.7fr) minmax(0, 1.3fr);
    gap: 14px;
    padding: 13px 15px;
    border: 1px solid var(--bb-border);
    border-left: 4px solid var(--bb-border);
    border-radius: calc(var(--bb-radius) - 3px);
    background: #fff;
}

.bar-booking-opening-hours .oh-special-primary,
.bar-booking-opening-hours .oh-special-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.bar-booking-opening-hours .oh-special-date {
    color: var(--bb-heading);
    font-size: 15px;
    line-height: 1.25;
}

.bar-booking-opening-hours .oh-special-time,
.bar-booking-opening-hours .oh-special-kind {
    color: var(--bb-muted);
    font-size: 12px;
}

.bar-booking-opening-hours .oh-special-kind {
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.bar-booking-opening-hours .oh-special-scope {
    color: var(--bb-heading);
    font-size: 14px;
}

.bar-booking-opening-hours .oh-special-detail {
    margin: 2px 0 0;
    color: var(--bb-text);
    font-size: 13px;
    line-height: 1.4;
}

.bar-booking-opening-hours .oh-special-item.type-closed {
    border-left-color: var(--bb-error-text);
    background: #fff;
}

.bar-booking-opening-hours .oh-special-item.type-closed .oh-special-kind,
.bar-booking-opening-hours .oh-special-item.type-closed .oh-special-detail {
    color: var(--bb-error-text);
}

.bar-booking-opening-hours .oh-special-item.type-partial {
    border-left-color: #b45309;
    background: #fff;
}

.bar-booking-opening-hours .oh-special-item.type-partial .oh-special-kind {
    color: #92400e;
}

.bar-booking-opening-hours .oh-special-item.type-special {
    border-left-color: var(--bb-btn-bg);
}

.bar-booking-opening-hours .oh-special-item.type-special .oh-special-kind {
    color: var(--bb-btn-bg);
}

.bar-booking-opening-hours .oh-special-item.type-private {
    border-left-color: #4d7c0f;
    background: #fff;
}

.bar-booking-opening-hours .oh-special-item.type-private .oh-special-kind {
    color: #3f6212;
}

/* Mobile */
@media (max-width: 640px) {
    .bar-booking-form-wrapper {
        padding: 16px;
    }

    .bar-booking-opening-hours .oh-table td {
        padding: 8px 10px;
        font-size: 13px;
    }

    .bar-booking-opening-hours .oh-table .oh-day {
        width: 90px;
    }

    .bar-booking-opening-hours .oh-special-item {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}
