/* ========================================
   BOOKING FORM v5 — 3 STEPS, COMPACT
   ======================================== */

/* ── Modal shell ── */
.bf-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0,0,0,0.5);
    display: none;
    overscroll-behavior: contain;
    align-items: center;
    justify-content: center;
}
.bf-modal[style*="display: block"],
.bf-modal[style*="display:block"] {
    display: flex !important;
}
body.booking-open {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
}

.bf-wrap {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
    position: relative;
    background: #fff;
}
@supports (height: 100svh) {
    .bf-wrap { height: 100svh; max-height: 100svh; }
}

/* ── Header: close + progress ── */
.bf-header {
    flex-shrink: 0;
    padding: 12px 16px 8px;
    background: #fff;
    position: relative;
    z-index: 10;
    border-bottom: 1px solid #F3F4F6;
}

.bf-close {
    position: absolute;
    top: 10px;
    right: 14px;
    width: 36px;
    height: 36px;
    border: none;
    background: #F3F4F6;
    border-radius: 50%;
    font-size: 22px;
    line-height: 1;
    color: #374151;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    transition: background 0.2s;
}
.bf-close:hover { background: #E5E7EB; }

/* ── Mode toggle: Residential / Commercial ── */
.bf-mode-toggle {
    display: flex;
    gap: 0;
    max-width: 320px;
    margin: 0 auto 12px;
    background: #F3F4F6;
    border-radius: 10px;
    padding: 3px;
}
.bf-mode-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    border: none;
    border-radius: 8px;
    background: transparent;
    font-size: 13px;
    font-weight: 700;
    color: #6B7280;
    cursor: pointer;
    transition: all 0.25s ease;
}
.bf-mode-btn i {
    font-size: 13px;
}
.bf-mode-btn:hover {
    color: #374151;
}
.bf-mode-btn.active {
    background: #fff;
    color: #285848;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* ── Commercial form ── */
.bf-commercial-form {
    max-width: 520px;
    margin: 0 auto;
    padding: 20px 20px 40px;
    display: flex;
    flex-direction: column;
    gap: 0;
}
.bf-subtitle {
    font-size: 14px;
    color: #6B7280;
    margin: -4px 0 8px;
    line-height: 1.4;
}

/* ── Progress bar ── */
.bf-progress {
    max-width: 480px;
    margin: 0 auto;
    width: 100%;
}

.bf-progress-bar {
    height: 6px;
    background: #F3F4F6;
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 12px;
}
.bf-progress-fill {
    height: 100%;
    width: 33.3%;
    background: linear-gradient(90deg, #285848, #1F4A3E);
    border-radius: inherit;
    transition: width 0.4s ease;
}

.bf-steps {
    display: flex;
    justify-content: space-between;
    gap: 4px;
}
.bf-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    padding: 0;
    cursor: default;
    opacity: 0.5;
    transition: opacity 0.3s;
}
.bf-step.active { opacity: 1; }
.bf-step.done { opacity: 0.7; }

.bf-step-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #F3F4F6;
    color: #6B7280;
    font-weight: 700;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}
.bf-step.active .bf-step-dot {
    background: #285848;
    color: #fff;
    box-shadow: 0 4px 12px rgba(40, 88, 72, 0.3);
}
.bf-step.done .bf-step-dot {
    background: #D1FAE5;
    color: #285848;
}

.bf-step-lbl {
    font-size: 11px;
    font-weight: 600;
    color: #6B7280;
}
.bf-step.active .bf-step-lbl { color: #111827; }

/* ── Body: scrollable form area ── */
.bf-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 0;
}

.bf-body form {
    max-width: 560px;
    margin: 0 auto;
    padding: 20px 20px 100px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* ── Steps / Panels ── */
.bf-panel {
    display: none;
    flex-direction: column;
    gap: 16px;
    animation: bfFadeIn 0.3s ease;
}
.bf-panel.active {
    display: flex;
}

@keyframes bfFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.bf-title {
    font-size: 20px;
    font-weight: 800;
    color: #111827;
    margin: 0 0 4px;
}

/* ── Fields ── */
.bf-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.bf-field label {
    font-size: 13px;
    font-weight: 700;
    color: #374151;
}

.bf-field input,
.bf-field select,
.bf-field textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid #E5E7EB;
    border-radius: 10px;
    font-size: 15px;
    color: #111827;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
    -webkit-appearance: none;
}
.bf-field input:focus,
.bf-field select:focus,
.bf-field textarea:focus {
    outline: none;
    border-color: #285848;
    box-shadow: 0 0 0 3px rgba(40, 88, 72, 0.1);
}

.bf-field textarea {
    resize: vertical;
    min-height: 60px;
}

/* Error state */
.bf-error input,
.bf-error select,
.bf-error textarea,
.bf-error .bf-chips,
.bf-error .bf-services {
    border-color: #EF4444 !important;
}
.bf-err {
    display: none;
    font-size: 12px;
    color: #EF4444;
    font-weight: 600;
}

/* ── Row (2-col) ── */
.bf-row {
    display: flex;
    gap: 12px;
}
.bf-half {
    flex: 1;
    min-width: 0;
}

/* ── Category chips ── */
.bf-chips {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
    gap: 8px;
    border: 1.5px solid transparent;
    border-radius: 12px;
    padding: 2px;
}

.bf-chip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 8px;
    border: 1.5px solid #E5E7EB;
    border-radius: 10px;
    background: #FAFAFA;
    font-size: 13px;
    font-weight: 700;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.bf-chip i { font-size: 14px; color: #6B7280; transition: color 0.2s; }
.bf-chip:hover { border-color: #285848; background: #F0FDF4; }
.bf-chip.on {
    border-color: #285848;
    background: #285848;
    color: #fff;
}
.bf-chip.on i { color: #fff; }

/* ── Service toggles ── */
.bf-services {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    border: 1.5px solid transparent;
    border-radius: 12px;
    padding: 2px;
}

.bf-svc {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    border: 1.5px solid #E5E7EB;
    border-radius: 999px;
    background: #fff;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.bf-svc:hover { border-color: #285848; }
.bf-svc.on {
    border-color: #285848;
    background: #F0FDF4;
    color: #285848;
}
.bf-svc-name { font-weight: 700; }
.bf-svc-price { font-size: 12px; color: #6B7280; }
.bf-svc.on .bf-svc-price { color: #285848; }

/* ── Checkbox ── */
.bf-check {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
}
.bf-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    flex-shrink: 0;
    accent-color: #285848;
}
.bf-terms a { color: #285848; text-decoration: underline; }

.bf-hint {
    font-size: 12px;
    color: #6B7280;
    margin: -4px 0 0;
}

/* ── Notes toggle ── */
.bf-notes-wrap {
    margin-top: -4px;
}
.bf-notes-toggle {
    background: none;
    border: none;
    color: #285848;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}
.bf-notes-toggle:hover { text-decoration: underline; }

/* ── Navigation buttons ── */
.bf-nav {
    display: flex;
    gap: 10px;
    padding: 12px 0 0;
    margin-top: auto;
}

.bf-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 14px 24px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
}

.bf-btn--back {
    background: #F3F4F6;
    color: #374151;
    flex: 0;
    padding: 14px 18px;
}
.bf-btn--back:hover { background: #E5E7EB; }

.bf-btn--next {
    background: linear-gradient(135deg, #285848, #1F4A3E);
    color: #fff;
}
.bf-btn--next:hover { box-shadow: 0 8px 20px rgba(40, 88, 72, 0.3); transform: translateY(-1px); }

.bf-btn--submit {
    background: linear-gradient(135deg, #285848, #1F4A3E);
    color: #fff;
}
.bf-btn--submit:hover { box-shadow: 0 8px 20px rgba(40, 88, 72, 0.3); transform: translateY(-1px); }

/* ── Sticky price bar ── */
.bf-price-bar {
    flex-shrink: 0;
    background: #111827;
    color: #fff;
    padding: 10px 20px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    z-index: 10;
}
.bf-price-bar-inner {
    max-width: 560px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.bf-price-label {
    font-size: 13px;
    color: rgba(255,255,255,0.7);
    font-weight: 600;
}
.bf-price-value {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

/* ── Success ── */
#bf-success {
    flex: 1;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
    min-height: 350px;
}
#bf-success[style*="display: flex"],
#bf-success[style*="display:flex"] {
    display: flex !important;
}
.bf-success-inner {
    text-align: center;
    max-width: 420px;
    margin: 0 auto;
    width: 100%;
}
.bf-success-inner i {
    font-size: 64px;
    color: #285848;
    margin-bottom: 20px;
    display: block;
}
.bf-success-inner h2 {
    font-size: 26px;
    font-weight: 800;
    color: #111827;
    margin: 0 0 12px;
}
.bf-success-inner p {
    font-size: 16px;
    color: #374151;
    margin: 0 0 8px;
    line-height: 1.5;
}
.bf-success-detail {
    font-size: 14px;
    color: #6B7280;
    margin-bottom: 28px !important;
}
.bf-success-inner .bf-btn {
    max-width: 260px;
    margin: 0 auto;
    padding: 16px 32px;
    font-size: 16px;
}

/* ── Mobile ── */
@media (max-width: 640px) {
    .bf-header { padding: 10px 12px 6px; }
    .bf-close { top: 8px; right: 10px; width: 32px; height: 32px; font-size: 20px; }
    .bf-mode-toggle { margin-bottom: 8px; max-width: 280px; }
    .bf-mode-btn { padding: 8px 10px; font-size: 12px; }
    .bf-step-dot { width: 24px; height: 24px; font-size: 11px; }
    .bf-step-lbl { font-size: 10px; }
    .bf-progress-bar { height: 4px; margin-bottom: 8px; }

    .bf-body form {
        padding: 16px 16px 90px;
    }

    .bf-title { font-size: 18px; }

    .bf-chips { gap: 6px; }
    .bf-chip { padding: 10px 6px; font-size: 12px; }
    .bf-chip i { font-size: 13px; }

    .bf-svc { padding: 8px 10px; font-size: 12px; }

    .bf-row { gap: 8px; }

    .bf-field input,
    .bf-field select,
    .bf-field textarea {
        padding: 10px 12px;
        font-size: 14px;
    }

    .bf-btn { padding: 12px 16px; font-size: 14px; }

    .bf-price-value { font-size: 20px; }
}

/* ── Desktop wide ── */
@media (min-width: 768px) {
    .bf-modal {
        padding: 24px;
    }
    .bf-wrap {
        width: 640px;
        max-width: 640px;
        height: auto;
        max-height: 90vh;
        border-radius: 20px;
        box-shadow: 0 25px 60px rgba(0,0,0,0.25);
    }
    .bf-body form {
        max-width: 100%;
        padding: 28px 32px 100px;
    }
    .bf-commercial-form {
        max-width: 100%;
        padding: 24px 32px 40px;
    }
    .bf-header {
        padding: 16px 28px 10px;
        border-radius: 20px 20px 0 0;
    }
    .bf-chips {
        grid-template-columns: repeat(3, 1fr);
    }
    .bf-progress {
        max-width: 100%;
    }
    .bf-price-bar {
        border-radius: 0 0 20px 20px;
    }
    .bf-price-bar-inner {
        max-width: 100%;
    }
    #bf-success {
        min-height: 400px;
    }
}

/* ── Large desktop ── */
@media (min-width: 1024px) {
    .bf-wrap {
        width: 720px;
        max-width: 720px;
    }
}
