/*
 * Residential booking flow (AÇÃO 08).
 * One DOM, two presentations:
 *   - viewport >= 1024px: single page, every section visible, sticky summary.
 *   - viewport  < 1024px: 6-step wizard (JS sets data-mode="wizard" on .bk-form).
 * Prices are never computed here or in CSS; they come from the backend quote.
 */
:root {
    --bk-navy: #1a2e5a;
    --bk-navy-soft: #eef2fb;
    --bk-green: #3f8f1d;
    --bk-green-bg: #eef8e7;
    --bk-text: #1e293b;
    --bk-muted: #5b6577;
    --bk-border: #d5dbe6;
    --bk-surface: #ffffff;
    --bk-bg: #f5f7fb;
    --bk-danger: #b42318;
    --bk-danger-bg: #fdecea;
    --bk-radius: 14px;
    --bk-focus: 0 0 0 3px rgba(26, 46, 90, .35);
}

/* The public layout sets overflow-x:hidden on html/body, which turns body into a scroll
   container and silently breaks position:sticky. `clip` still blocks horizontal scroll
   without creating a scroll container. Scoped to this page (this stylesheet only loads here). */
html, body { overflow-x: clip; overflow-y: visible; }

.bk-page { max-width: 1200px; margin: 1.25rem auto 3rem; padding: 0 1rem; color: var(--bk-text); }
.bk-page *, .bk-page *::before, .bk-page *::after { box-sizing: border-box; }
.bk-page [hidden] { display: none !important; }
.bk-sr-only { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.bk-muted { color: var(--bk-muted); margin: 0; }

/* ---------- Layout ---------- */
.bk-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.bk-main { min-width: 0; }
.bk-section { background: var(--bk-surface); border: 1px solid var(--bk-border); border-radius: var(--bk-radius); padding: 1.25rem 1rem; margin-bottom: 1.25rem; }
.bk-section-head { display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.bk-section-head h2 { margin: 0; font-size: 1.3rem; color: var(--bk-navy); line-height: 1.2; }
.bk-section-sub { margin: -.5rem 0 1rem; color: var(--bk-muted); }
.bk-step-badge { flex: 0 0 auto; width: 2rem; height: 2rem; border-radius: 50%; background: var(--bk-navy); color: #fff; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; font-size: .95rem; }
.bk-subhead { margin: 0 0 .25rem; font-size: 1.05rem; color: var(--bk-navy); }
.bk-fieldset { border: 0; margin: 0 0 1.25rem; padding: 0; min-width: 0; }
.bk-label { display: block; font-weight: 700; margin: 0 0 .5rem; padding: 0; color: var(--bk-text); }
.bk-label-note { font-weight: 400; color: var(--bk-muted); font-size: .9em; }

/* ---------- Mode switching (single source of truth: form[data-mode]) ---------- */
.bk-progress, .bk-mobilebar { display: none; }
.bk-form[data-mode="wizard"] .bk-progress { display: block; }
.bk-form[data-mode="wizard"] .bk-mobilebar { display: flex; }
.bk-form[data-mode="wizard"] .bk-section:not(.is-active) { display: none; }
.bk-form[data-mode="wizard"] { padding-bottom: 5.5rem; }
.bk-form[data-mode="single"] .bk-summary-toggle { display: none; }

@media (min-width: 1024px) {
    .bk-page { padding: 0 2rem; }
    .bk-layout { grid-template-columns: minmax(0, 1fr) 360px; gap: 2rem; }
    .bk-section { padding: 1.75rem 2rem; }
    .bk-summary { position: sticky; top: 104px; max-height: calc(100vh - 124px); overflow-y: auto; }
}

/* ---------- Progress (wizard only) ---------- */
.bk-progress { margin: 0 0 1rem; }
.bk-progress-text { margin: 0 0 .5rem; font-weight: 700; color: var(--bk-navy); }
.bk-progress-bar { height: 8px; border-radius: 999px; background: #dfe5f1; overflow: hidden; }
.bk-progress-bar span { display: block; height: 100%; width: 16.66%; background: var(--bk-navy); border-radius: 999px; transition: width .2s ease; }
.bk-progress-steps { display: none; list-style: none; padding: 0; margin: .5rem 0 0; }
@media (min-width: 480px) {
    .bk-progress-steps { display: flex; justify-content: space-between; gap: .25rem; font-size: .75rem; color: var(--bk-muted); }
    .bk-progress-steps li.is-current { color: var(--bk-navy); font-weight: 800; }
    .bk-progress-steps li.is-done { color: var(--bk-green); }
}

/* ---------- Choice buttons (real radios, visually styled) ---------- */
.bk-choice-grid { display: grid; gap: .6rem; }
.bk-choice-grid--service { grid-template-columns: 1fr; }
.bk-choice-grid--count { grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); }
.bk-choice-grid--wrap { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.bk-choice-grid--frequency { grid-template-columns: repeat(2, minmax(0, 1fr)); padding-top: .75rem; gap: .9rem .6rem; }
@media (min-width: 640px) {
    .bk-choice-grid--service { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
    .bk-choice-grid--frequency { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.bk-choice { position: relative; display: block; cursor: pointer; }
.bk-choice input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.bk-choice-face { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: center; gap: .15rem; min-height: 52px; padding: .6rem .9rem; background: #fff; border: 2px solid var(--bk-border); border-radius: 12px; transition: border-color .12s, background-color .12s; }
.bk-choice--compact .bk-choice-face { align-items: center; text-align: center; padding: .5rem; }
.bk-choice--pill .bk-choice-face { min-height: 48px; }
.bk-choice:hover .bk-choice-face { border-color: #9aa7c2; }
.bk-choice input:focus-visible + .bk-choice-face { box-shadow: var(--bk-focus); border-color: var(--bk-navy); }
.bk-choice input:checked + .bk-choice-face { border-color: var(--bk-navy); background: var(--bk-navy-soft); box-shadow: inset 0 0 0 1px var(--bk-navy); }
.bk-choice-title { font-weight: 700; line-height: 1.25; padding-right: 1.25rem; }
.bk-choice--compact .bk-choice-title { padding-right: 0; }
.bk-choice-hint { font-size: .85rem; color: var(--bk-muted); }
.bk-choice-hint.bk-save { color: var(--bk-green); font-weight: 700; }
.bk-choice-check { position: absolute; top: 6px; right: 8px; font-size: .8rem; color: #fff; background: var(--bk-navy); width: 18px; height: 18px; border-radius: 50%; display: none; align-items: center; justify-content: center; }
.bk-choice input:checked + .bk-choice-face .bk-choice-check { display: inline-flex; }
.bk-choice--compact .bk-choice-check { top: 3px; right: 3px; width: 16px; height: 16px; font-size: .65rem; }

.bk-choice--frequency .bk-choice-face { min-height: 96px; }
.bk-choice--frequency.is-popular .bk-choice-face { border-color: var(--bk-green); }
.bk-choice--frequency.is-popular input:checked + .bk-choice-face { border-color: var(--bk-navy); }
.bk-badge { position: absolute; top: -.7rem; left: 50%; transform: translateX(-50%); z-index: 2; background: var(--bk-green); color: #fff; font-size: .68rem; font-weight: 800; letter-spacing: .06em; padding: .2rem .55rem; border-radius: 999px; white-space: nowrap; pointer-events: none; }
.bk-choice-price { margin-top: .35rem; font-size: .9rem; color: var(--bk-text); }
.bk-price-main { font-weight: 800; font-size: 1rem; }
.bk-price-main.is-amount { font-size: 1.15rem; }
.bk-price-caption { display: block; color: var(--bk-muted); font-size: .68rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; margin-top: .1rem; }
.bk-price-sub { display: block; color: var(--bk-muted); font-size: .8rem; margin-top: .3rem; }
.bk-choice-price .bk-price-main:only-child:not(.is-amount) { font-weight: 400; font-size: .8rem; color: var(--bk-muted); }

/* ---------- Form fields ---------- */
.bk-grid { display: grid; gap: .9rem; margin-bottom: .9rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) {
    .bk-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .bk-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .bk-grid--address { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
}
.bk-field { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.bk-field label { font-weight: 600; }
.bk-field input, .bk-field select, .bk-promo input { width: 100%; min-height: 48px; padding: .6rem .8rem; font-size: 16px; color: var(--bk-text); background: #fff; border: 1.5px solid var(--bk-border); border-radius: 10px; font-family: inherit; }
.bk-field input:focus-visible, .bk-field select:focus-visible, .bk-promo input:focus-visible, .bk-card-wrapper.focused { outline: none; border-color: var(--bk-navy); box-shadow: var(--bk-focus); }
.bk-field input[aria-invalid="true"], .bk-field select[aria-invalid="true"] { border-color: var(--bk-danger); background: var(--bk-danger-bg); }
.bk-field-error { color: var(--bk-danger); font-size: .875rem; font-weight: 600; min-height: 0; }
.bk-optional { margin: .25rem 0 .5rem; }
.bk-optional summary { cursor: pointer; font-weight: 600; color: var(--bk-navy); padding: .5rem 0; min-height: 44px; display: flex; align-items: center; }
.bk-checkbox { display: flex; align-items: flex-start; gap: .65rem; margin: .5rem 0; min-height: 44px; cursor: pointer; line-height: 1.4; }
.bk-checkbox input { width: 22px; height: 22px; flex: 0 0 auto; margin-top: .1rem; accent-color: var(--bk-navy); }
.bk-checkbox input:focus-visible { outline: 3px solid rgba(26, 46, 90, .5); outline-offset: 2px; }
.bk-checkbox a { color: var(--bk-navy); font-weight: 700; text-decoration: underline; }

/* ---------- Buttons ---------- */
.bk-btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 48px; padding: .65rem 1.1rem; font: inherit; font-weight: 700; border-radius: 12px; border: 2px solid transparent; cursor: pointer; text-decoration: none; }
.bk-btn:focus-visible { outline: none; box-shadow: var(--bk-focus); }
.bk-btn--primary { background: var(--bk-navy); color: #fff; }
.bk-btn--primary:hover:not(:disabled) { background: #12244b; }
.bk-btn--ghost { background: #fff; color: var(--bk-navy); border-color: var(--bk-border); }
.bk-btn--ghost[aria-pressed="true"] { border-color: var(--bk-navy); background: var(--bk-navy-soft); }
.bk-btn--block { width: 100%; }
.bk-btn--xl { min-height: 56px; font-size: 1.1rem; }
.bk-btn:disabled { opacity: .55; cursor: not-allowed; }
.bk-btn.loading { position: relative; }

/* ---------- Feedback / notices ---------- */
.bk-feedback { padding: .85rem 1rem; border-radius: 12px; margin-bottom: 1rem; font-weight: 600; border: 1px solid transparent; }
.bk-feedback--error, .bk-feedback.error { background: var(--bk-danger-bg); color: var(--bk-danger); border-color: #f3b4ac; }
.bk-feedback--success, .bk-feedback.success { background: var(--bk-green-bg); color: #235c0b; border-color: #b9e29e; }
.bk-feedback--info, .bk-feedback.info { background: var(--bk-navy-soft); color: var(--bk-navy); border-color: #c5d0ea; }
.bk-step-error { margin: .75rem 0 0; padding: .7rem .9rem; background: var(--bk-danger-bg); color: var(--bk-danger); border-radius: 10px; font-weight: 700; }
.bk-missing { margin: .75rem 0; color: var(--bk-muted); font-size: .95rem; }

.bk-initial-notice, .bk-custom-quote { border-radius: var(--bk-radius); padding: 1rem 1.1rem; margin: 0 0 1.25rem; }
.bk-initial-notice { background: var(--bk-green-bg); border: 1px solid #b9e29e; }
.bk-custom-quote { background: #fff7e6; border: 1px solid #f2cf8a; }
.bk-initial-notice h3, .bk-custom-quote h3 { margin: 0 0 .4rem; font-size: 1.05rem; color: var(--bk-navy); }
.bk-initial-notice p, .bk-custom-quote p { margin: 0 0 .6rem; }
.bk-initial-prices { display: flex; flex-wrap: wrap; gap: .75rem 2rem; margin: .25rem 0 0; }
.bk-initial-prices dt { font-size: .8rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--bk-muted); }
.bk-initial-prices dd { margin: 0; font-size: 1.35rem; font-weight: 800; color: var(--bk-navy); }

/* ---------- Extras ---------- */
.bk-extras-toolbar { margin-bottom: .75rem; }
.bk-extras-grid { display: grid; gap: .75rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px) { .bk-extras-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .bk-extras-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.bk-extras-grid .bk-muted { grid-column: 1 / -1; }
.bk-extra-name { font-weight: 700; display: block; text-align: center; line-height: 1.25; font-size: .95rem; }
.bk-extra .bk-choice-face { flex-direction: column; align-items: center; justify-content: center; gap: .6rem; text-align: center; min-height: 148px; background: #fff; border-width: 1px; padding: calc(.9rem + 1px) calc(.6rem + 1px); }
.bk-extra-media { display: flex; align-items: center; justify-content: center; width: 100%; height: 72px; color: var(--bk-navy); font-size: 2.6rem; }
.bk-extra-media img { max-width: 80px; max-height: 72px; width: auto; height: auto; object-fit: contain; mix-blend-mode: multiply; }
.bk-free-badge { position: absolute; top: 8px; right: 8px; background: var(--bk-green); color: #fff; font-size: .65rem; font-weight: 800; letter-spacing: .05em; padding: .15rem .4rem; border-radius: 6px; }
.bk-extra input:checked + .bk-choice-face { border-width: 3px; padding: calc(.9rem - 1px) calc(.6rem - 1px); border-color: var(--bk-navy); background: var(--bk-navy-soft); box-shadow: 0 3px 10px rgba(26, 46, 90, .18); }
.bk-extra input:focus-visible + .bk-choice-face { outline: 3px solid rgba(26, 46, 90, .55); outline-offset: 3px; }
.bk-extra.is-locked .bk-choice-face { opacity: .85; }

/* ---------- Review ---------- */
.bk-review { border: 1px solid var(--bk-border); border-radius: var(--bk-radius); padding: 1rem; margin-bottom: 1.25rem; background: #fbfcfe; }
.bk-review h3 { margin: 0 0 .5rem; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--bk-muted); }
.bk-review-block + .bk-review-block { margin-top: 1rem; }
.bk-payment { margin-bottom: 1.25rem; }
.bk-card-wrapper { padding: .9rem; border: 1.5px solid var(--bk-border); border-radius: 10px; background: #fff; margin-top: .35rem; }
.bk-card-wrapper.error { border-color: var(--bk-danger); }
.bk-badges { display: flex; flex-wrap: wrap; gap: .5rem 1rem; margin-top: .75rem; color: var(--bk-muted); font-size: .85rem; }
.bk-terms { margin: 1rem 0; }

/* ---------- Summary ---------- */
.bk-summary { background: var(--bk-surface); border: 1px solid var(--bk-border); border-radius: var(--bk-radius); }
.bk-summary-toggle { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 1rem; min-height: 52px; font-weight: 800; color: var(--bk-navy); }
.bk-summary-toggle::-webkit-details-marker { display: none; }
.bk-summary-toggle::after { content: '\002B'; font-size: 1.2rem; margin-left: auto; }
.bk-summary-details[open] .bk-summary-toggle::after { content: '\2212'; }
.bk-summary-toggle-total { font-weight: 800; }
.bk-summary-toggle-total:empty { display: none; }
.bk-summary-body { padding: 1rem; }
@media (min-width: 1024px) { .bk-summary-body { padding: 1.25rem; } .bk-summary-body::before { content: 'Booking summary'; display: block; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; font-size: .8rem; color: var(--bk-navy); margin-bottom: .75rem; } }
.bk-summary-selections { display: grid; gap: .35rem; margin-bottom: .9rem; }
.bk-sel { display: flex; justify-content: space-between; gap: 1rem; }
.bk-sel dt { color: var(--bk-muted); }
.bk-sel dd { margin: 0; font-weight: 700; text-align: right; }
.bk-nowrap { white-space: nowrap; }
.bk-summary-lines { border-top: 1px dashed var(--bk-border); padding-top: .75rem; }
.bk-summary-lines:empty { display: none; }
.bk-line { display: flex; justify-content: space-between; gap: 1rem; padding: .2rem 0; }
.bk-line-amount { font-variant-numeric: tabular-nums; white-space: nowrap; }
.bk-line--base { font-weight: 700; }
.bk-lines-head { display: flex; justify-content: space-between; margin-top: .55rem; padding-top: .45rem; border-top: 1px dotted var(--bk-border); font-size: .75rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--bk-muted); }
.bk-lines-count { font-weight: 700; }
.bk-line--extra { font-size: .92rem; }
.bk-was { color: var(--bk-muted); font-weight: 600; }
.bk-free { color: var(--bk-green); font-weight: 800; }
.bk-line--discount .bk-line-amount { color: var(--bk-green); font-weight: 700; }
.bk-line--free .bk-tag { background: var(--bk-green); color: #fff; font-size: .65rem; font-weight: 800; padding: .1rem .35rem; border-radius: 6px; margin-left: .35rem; }
.bk-summary-total { border-top: 2px solid var(--bk-navy); margin-top: .75rem; padding-top: .75rem; position: sticky; bottom: 0; background: var(--bk-surface); }
.bk-total-row { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.bk-total-label { font-size: .8rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--bk-muted); }
.bk-total-amount { font-size: 1.6rem; font-weight: 900; color: var(--bk-navy); font-variant-numeric: tabular-nums; }
.bk-total-row--secondary .bk-total-amount { font-size: 1.15rem; white-space: nowrap; }
.bk-summary-note { margin: .9rem 0 0; font-size: .85rem; color: var(--bk-muted); }
.bk-summary-note--highlight { background: var(--bk-navy-soft); color: var(--bk-navy); padding: .6rem .75rem; border-radius: 10px; margin: 0 0 .9rem; }
.bk-promo { margin-top: .9rem; }
.bk-promo-row { display: flex; gap: .5rem; }
.bk-promo-row input { flex: 1 1 auto; min-width: 0; text-transform: uppercase; }
.bk-promo-feedback { min-height: 1.2em; margin: .35rem 0 0; font-size: .875rem; }
.bk-promo-feedback.error { color: var(--bk-danger); }
.bk-promo-feedback.success { color: var(--bk-green); }

/* ---------- Mobile bottom bar (wizard only) ---------- */
.bk-mobilebar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 900; align-items: center; gap: .75rem; padding: .65rem 1rem calc(.65rem + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--bk-border); box-shadow: 0 -4px 14px rgba(15, 30, 65, .08); }
.bk-mobilebar-total { flex: 1 1 auto; text-align: center; line-height: 1.1; }
.bk-mobilebar-total small { display: block; color: var(--bk-muted); font-weight: 700; text-transform: uppercase; font-size: .68rem; letter-spacing: .06em; }
.bk-mobilebar-total strong { font-size: 1.2rem; color: var(--bk-navy); }
.bk-mobilebar .bk-btn { flex: 0 0 auto; padding-left: .9rem; padding-right: .9rem; }
.bk-mobilebar-next { min-width: 96px; }

/* ---------- Success ---------- */
.bk-success { text-align: center; background: #fff; border: 1px solid #b9e29e; border-radius: var(--bk-radius); padding: 2.5rem 1.25rem; }
.bk-success i { font-size: 3rem; color: var(--bk-green); }
.bk-success h2 { color: var(--bk-navy); }

@media (prefers-reduced-motion: reduce) {
    .bk-page * { transition: none !important; }
}
