/* BookFlow – base layout styles (colors injected inline per form instance) */

.bf-wrap { box-sizing: border-box; }
.bf-form  { box-sizing: border-box; }

.bf-row {
    display: flex;
    gap: 1.2em;
}
.bf-row > .bf-field { flex: 1; }

.bf-field { margin-bottom: 1.2em; }

.bf-checkbox-wrap {
    display: flex;
    align-items: flex-start;
    gap: 0.6em;
    margin-bottom: 1em;
}
.bf-checkbox-wrap label {
    font-size: 0.833em !important;
    font-weight: 400 !important;
    color: var(--bf-label-color, #555) !important;
    cursor: pointer;
    margin-bottom: 0 !important;
}
.bf-checkbox-wrap a { color: var(--bf-link-color, #1A1A1A); text-decoration: underline; }

.bf-consultation-fields {
    border-left: 3px solid #ccc;
    padding-left: 1.2em;
    margin: 0.5em 0 1.2em;
}

.bf-slots-loading {
    font-size: 0.85em;
    opacity: 0.7;
    margin-top: 0.3em;
}

.bf-availability {
    font-size: 0.85em;
    margin-top: 0.4em;
    padding: 0.5em 0.8em;
    border-radius: 4px;
    background: rgba(0,0,0,0.04);
}

.bf-message {
    padding: 1em 1.2em;
    border-radius: 6px;
    margin-bottom: 1.2em;
    font-size: 0.889em;
    text-align: center;
}
.bf-message.bf-success { background: var(--bf-success-bg, #1A1A1A); color: var(--bf-success-text, #E8EAEA); }
.bf-message.bf-error   { background: var(--bf-error-bg, #CC4444); color: var(--bf-error-text, #FAFAF8); }

.bf-req { color: var(--bf-req, #CC4444); }
.bf-required-note { font-size: 0.778em; color: var(--bf-note, #888); margin-bottom: 0.5em; }

.bf-turnstile { margin: 1em 0 0.5em; }

@media (max-width: 767px) {
    .bf-row { flex-direction: column; gap: 0; }
}

/* -----------------------------------------------------------------------
   Flatpickr overrides – match site styling
----------------------------------------------------------------------- */
.flatpickr-calendar {
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.12);
    border: 1px solid #ddd;
    font-family: inherit;
}
.flatpickr-day.selected,
.flatpickr-day.selected:hover {
    background: var(--bf-accent, #C4A882);
    border-color: var(--bf-accent, #C4A882);
}
.flatpickr-day:hover {
    background: rgba(196,168,130,0.15);
}
.flatpickr-months .flatpickr-prev-month:hover svg,
.flatpickr-months .flatpickr-next-month:hover svg {
    fill: var(--bf-accent, #C4A882);
}

/* Datetime wrapper */
.bf-datetime-wrap {
    display: flex;
    gap: 1em;
    align-items: flex-start;
}
.bf-datetime-date { flex: 1; }

.bf-datetime-time select { width: 100%; }

/* Select – fix text overflow */
.bf-wrap select {
    width: 100%;
    max-width: 100%;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

/* Flatpickr alt input styling */
.bf-wrap .flatpickr-input.form-control.input {
    display: none;
}

/* Freebusy field – date + time side by side */
.bf-freebusy-wrap {
    display: flex;
    gap: 1em;
    align-items: flex-end; /* align inputs at bottom */
}
.bf-freebusy-wrap .bf-datetime-date { flex: 1; }
.bf-freebusy-wrap .bf-datetime-time { flex: 1; }




/* Conditional fields – left border indicates grouping */
.bf-conditional {
    padding-left: 1.5em;
    border-left: 3px solid #e8e0d5;
    margin-top: 0;
    padding-top: 0.5em;
    padding-bottom: 0.5em;
}
/* Consecutive conditionals: no gap between – continuous border.
   Use :not([style*="display: none"]) so hidden conditionals don't break the border. */
.bf-conditional + .bf-conditional:not([style*="display: none"]):not([style*="display:none"]) {
    margin-top: 0;
    padding-top: 0;
}
/* Only remove bottom padding if next sibling is actually visible */
.bf-conditional:has(+ .bf-conditional:not([style*="display: none"]):not([style*="display:none"])) {
    padding-bottom: 0;
}
/* Field containing an acceptance checkbox followed by conditionals:
   extend the visual grouping to the checkbox itself */
.bf-field:has(.bf-acceptance-toggle) + .bf-conditional {
    margin-top: 0;
}
.bf-field:has(.bf-acceptance-toggle:checked) {
    padding-left: 1.5em;
    border-left: 3px solid #e8e0d5;
    padding-top: 0.5em;
    padding-bottom: 0.5em;
    margin-bottom: 0;
}

/* Prevent Elementor from showing its own datepicker on our fields */
.bf-form .bf-datepicker {
    pointer-events: auto;
}
/* Hide Elementor datepicker if it appears near our form */
.bf-form .elementor-date-time-picker {
    display: none !important;
}



/* Uhrzeit – align with date input */


/* Time select – match date input height, let theme control padding */




/* -----------------------------------------------------------------------
   Custom time dropdown – matches date input styling exactly
----------------------------------------------------------------------- */
.bf-time-dropdown {
    position: relative;
    cursor: pointer;
    background: #FAFAF8;
    border: 1px solid #D5D9D8;
    border-radius: 6px;
    padding: 0 1em;
    font-size: 1em;
    font-family: inherit;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 40px; /* exact match with date input */
    line-height: 40px;
}
.bf-time-dropdown::after {
    content: "▾";
    color: #999;
    margin-left: 8px;
    font-size: 0.8em;
}
.bf-time-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.bf-time-display {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #1A1A1A;
}
.bf-time-disabled .bf-time-display {
    color: #888;
}
.bf-time-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #D5D9D8;
    border-radius: 6px;
    margin-top: 4px;
    max-height: 240px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.bf-time-option {
    padding: 0.6em 1em;
    cursor: pointer;
    font-size: 0.95em;
    border-bottom: 1px solid #f0f0f0;
}
.bf-time-option:last-child { border-bottom: none; }
.bf-time-option:hover {
    background: #f5f5f0;
}
.bf-time-option.bf-time-empty {
    color: #888;
    font-style: italic;
    cursor: default;
}
.bf-time-option.bf-time-empty:hover {
    background: transparent;
}

/* Time dropdown wrap layout */
.bf-datetime-time {
    flex: 1;
    position: relative;
}
.bf-datetime-time label {
    display: block;
    margin-bottom: 0.5em;
}


/* Force date and time columns to align top */
.bf-freebusy-wrap {
    align-items: flex-start !important;
}
.bf-freebusy-wrap > div {
    display: flex;
    flex-direction: column;
}
.bf-freebusy-wrap label {
    margin-bottom: 0.5em;
    height: 1.2em;
    line-height: 1.2em;
}

/* Time dropdown invalid state – matches native form field validation */
.bf-time-dropdown.bf-time-invalid {
    border-color: #c00 !important;
    background: #fff5f5;
    box-shadow: 0 0 0 2px rgba(204, 0, 0, 0.15);
}
.bf-time-dropdown.bf-time-invalid .bf-time-display {
    color: #c00;
}

/* Unified invalid state for all form fields */
.bf-form input.bf-invalid,
.bf-form textarea.bf-invalid,
.bf-form select.bf-invalid {
    border-color: #c00 !important;
    background: #fff5f5 !important;
    box-shadow: 0 0 0 2px rgba(204, 0, 0, 0.15);
}

/* Mobile: stack date and time */
@media (max-width: 600px) {
    .bf-freebusy-wrap {
        flex-direction: column;
        gap: 0.8em;
    }
    .bf-freebusy-wrap .bf-datetime-date,
    .bf-freebusy-wrap .bf-datetime-time {
        width: 100%;
    }
    /* Also stack 50% width fields on mobile */
    .bf-row {
        flex-direction: column;
        gap: 0.8em;
    }
    .bf-row .bf-field {
        width: 100%;
    }
}

/* -----------------------------------------------------------------------
   Comprehensive responsive design
----------------------------------------------------------------------- */
@media (max-width: 600px) {
    /* Form wrapper */
    .bf-wrap {
        padding: 0;
    }
    .bf-form {
        font-size: 0.95em;
    }

    /* Stack 50% width fields */
    .bf-row {
        flex-direction: column;
        gap: 0.8em;
    }
    .bf-row .bf-field {
        width: 100%;
    }

    /* Stack date and time */
    .bf-freebusy-wrap,
    .bf-datetime-wrap {
        flex-direction: column;
        gap: 0.8em;
    }
    .bf-freebusy-wrap .bf-datetime-date,
    .bf-freebusy-wrap .bf-datetime-time,
    .bf-datetime-wrap > div {
        width: 100%;
    }

    /* Conditional fields – less indent on mobile */
    .bf-conditional {
        padding-left: 0.8em;
    }

    /* Submit button – full width on mobile */
    .bf-submit {
        width: 100%;
        padding: 0.9em 1em;
    }

    /* Acceptance / consent labels – better wrapping */
    .bf-acceptance,
    .bf-checkbox-wrap label {
        font-size: 0.95em;
        line-height: 1.4;
    }

    /* Time dropdown options – larger touch targets */
    .bf-time-option {
        padding: 0.8em 1em;
        font-size: 1em;
    }

    /* Flatpickr – full width on mobile */
    .flatpickr-calendar {
        max-width: 90vw;
    }
}

/* Tablet adjustments */
@media (max-width: 900px) and (min-width: 601px) {
    .bf-form {
        max-width: 100%;
    }
}

/* -----------------------------------------------------------------------
   Themeable defaults via CSS variables.
   The Elementor widget sets these variables (and typography) on the element
   wrapper. The shortcode path emits an inline #uid <style> block that wins by
   specificity. Fallbacks below keep the form fully styled when neither sets
   a value (bare Elementor instance, default state).
----------------------------------------------------------------------- */
.bf-wrap { max-width: var(--bf-max-width, 800px); margin: 0 auto; }

.bf-wrap .bf-field label,
.bf-wrap .bf-radio-legend {
    display: block;
    font-family: var(--bf-font-label, 'Work Sans', system-ui, sans-serif);
    font-weight: 500;
    font-size: 0.833em;
    color: var(--bf-label-color, #333);
    margin-bottom: 0.3em;
}

.bf-wrap input[type=text],
.bf-wrap input[type=email],
.bf-wrap input[type=tel],
.bf-wrap input[type=url],
.bf-wrap input[type=date],
.bf-wrap select,
.bf-wrap textarea {
    width: 100%;
    font-family: var(--bf-font-field, 'Work Sans', system-ui, sans-serif);
    font-size: 1em;
    line-height: 1.5;
    color: var(--bf-text, #1A1A1A);
    background: var(--bf-field-bg, #FAFAF8);
    border: 1px solid var(--bf-border, #D5D9D8);
    border-radius: var(--bf-radius, 6px);
    padding: 0.9em 1em;
    margin-bottom: 1.2em;
    box-sizing: border-box;
    transition: border-color 0.3s;
    -webkit-appearance: none;
    appearance: none;
}
.bf-wrap select { height: auto; min-height: calc(1.5em + 1.8em + 2px); }
.bf-wrap input:focus,
.bf-wrap select:focus,
.bf-wrap textarea:focus { border-color: var(--bf-accent, #C4A882); outline: none; }
.bf-wrap textarea { min-height: 150px; resize: vertical; }
.bf-wrap input[type=checkbox],
.bf-wrap input[type=radio] { accent-color: var(--bf-accent, #C4A882); }
.bf-wrap ::placeholder { color: var(--bf-placeholder, #999); opacity: 1; }
.bf-wrap .bf-field a { color: var(--bf-link-color, #C4A882); text-decoration: underline; }

.bf-wrap .bf-submit {
    font-family: var(--bf-font-button, 'Manrope', system-ui, sans-serif);
    font-weight: 600;
    font-size: 0.833em;
    letter-spacing: 0.03em;
    color: var(--bf-btn-text, #1A1A1A);
    background: var(--bf-btn-color, #C4A882);
    border: none;
    border-radius: var(--bf-radius, 6px);
    padding: 0.8em 2em;
    cursor: pointer;
    transition: background 0.3s;
    display: block;
    margin: 1.5em auto 0;
}
.bf-wrap .bf-submit:hover { background: var(--bf-btn-hover, #A68B5B); }
.bf-wrap .bf-submit:disabled { opacity: 0.6; cursor: not-allowed; }
