/* ==========================================================================
   CitasPlus · Página pública de reservas (/agendar/{negocio})
   Pensada primero para celular. Sin Bootstrap ni plantilla del panel.
   Los colores de marca llegan como variables desde la vista (--brand…).
   ========================================================================== */

:root {
    --brand: #8c00db;
    --on-brand: #ffffff;
    --brand-text: #8c00db;
    --bg: #fbfaf7;
    --surface: #ffffff;
    --surface-2: #f3f0ea;
    --text: #1d1b18;
    --muted: #6b645a;
    --line: #e6e0d6;
    --danger: #b42318;
    --ok: #1f7a4d;
    --radius: 16px;
    --radius-sm: 12px;
    --font-body: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-head: var(--font-body);
    --bar-h: 76px;
}

.theme-dark {
    --bg: #141312;
    --surface: #1e1c1a;
    --surface-2: #262420;
    --text: #f3efe8;
    --muted: #b3aa9c;
    --line: #34312c;
    --danger: #ff8a80;
    --ok: #6fd3a0;
    color-scheme: dark;
}

.font-clasico { --font-body: "Public Sans", system-ui, sans-serif; --font-head: "Fraunces", Georgia, serif; }
.font-amigable { --font-body: "Nunito", system-ui, sans-serif; --font-head: "Nunito", system-ui, sans-serif; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand-text); }
h1, h2, h3 { font-family: var(--font-head); margin: 0; line-height: 1.2; }
p { margin: 0; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--brand-text); outline-offset: 2px; border-radius: 8px; }

.icon { width: 20px; height: 20px; flex: none; }

.bk-app {
    max-width: 560px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--bg);
    padding-bottom: calc(var(--bar-h) + env(safe-area-inset-bottom) + 24px);
}
@media (min-width: 600px) {
    body { background: var(--surface-2); }
    .bk-app { box-shadow: 0 0 0 1px var(--line); }
}

/* ---------- Encabezado del negocio ---------- */

.bk-cover { aspect-ratio: 16 / 7; background: var(--brand); overflow: hidden; }
.bk-cover img { width: 100%; height: 100%; object-fit: cover; }
.bk-cover.is-band { aspect-ratio: auto; height: 92px; }

.bk-identity { padding: 0 20px 18px; margin-top: -36px; position: relative; }
.bk-logo {
    width: 76px;
    height: 76px;
    border-radius: 20px;
    background: var(--surface);
    border: 3px solid var(--bg);
    box-shadow: 0 6px 18px -10px rgba(0, 0, 0, .45);
    object-fit: cover;
    display: grid;
    place-items: center;
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 26px;
    color: var(--brand-text);
    overflow: hidden;
}
.bk-identity h1 { font-size: 26px; font-weight: 700; margin-top: 12px; letter-spacing: -0.01em; }
.font-clasico .bk-identity h1 { font-weight: 600; font-size: 28px; }
.bk-welcome { color: var(--muted); margin-top: 6px; }
.bk-meta { display: flex; align-items: flex-start; gap: 6px; color: var(--muted); font-size: 14px; margin-top: 8px; }
.bk-meta .icon { width: 16px; height: 16px; margin-top: 2px; }

.bk-quick { display: flex; gap: 8px; margin-top: 14px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.bk-quick::-webkit-scrollbar { display: none; }
.bk-quick a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}
.bk-quick a .icon { width: 18px; height: 18px; color: var(--brand-text); }

/* ---------- Pestañas ---------- */

.bk-tabs {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(var(--tabs, 3), 1fr);
    background: var(--bg);
    border-bottom: 1px solid var(--line);
}
.bk-tabs button {
    min-height: 50px;
    border: 0;
    background: none;
    font-weight: 600;
    color: var(--muted);
    border-bottom: 3px solid transparent;
    cursor: pointer;
}
.bk-tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--brand); }

.bk-panel { padding: 20px; }

/* ---------- Flujo de reserva ---------- */

.bk-progress { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.bk-progress small { color: var(--muted); font-weight: 600; font-size: 13px; letter-spacing: .02em; }
.bk-dots { display: flex; gap: 6px; }
.bk-dots span { width: 22px; height: 4px; border-radius: 4px; background: var(--line); }
.bk-dots span.on { background: var(--brand); }

.bk-step h2 { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.font-clasico .bk-step h2 { font-weight: 600; }
.bk-step .bk-sub { color: var(--muted); margin-bottom: 18px; font-size: 15px; }

.bk-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    padding: 0 4px;
    border: 0;
    background: none;
    color: var(--muted);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    margin: -6px 0 6px -4px;
}

.bk-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }

.bk-option {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 14px;
    text-align: left;
    padding: 14px 16px;
    min-height: 64px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--surface);
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.bk-option:hover { border-color: var(--muted); }
.bk-option[aria-pressed="true"] { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.bk-option .bk-opt-main { flex: 1; min-width: 0; }
.bk-option strong { display: block; font-size: 16px; }
.bk-option .bk-opt-desc {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--muted);
    font-size: 14px;
    margin-top: 2px;
}
.bk-option .bk-opt-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; font-size: 13px; color: var(--muted); }
.bk-option .bk-price { font-weight: 700; color: var(--text); white-space: nowrap; }
.bk-option .chev { color: var(--muted); }

.bk-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    flex: none;
    object-fit: cover;
    background: var(--surface-2);
    display: grid;
    place-items: center;
    font-weight: 700;
    color: var(--brand-text);
}

.bk-deposit {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    font-size: 14px;
    margin-top: 14px;
}
.bk-deposit .icon { color: var(--brand-text); margin-top: 1px; }

/* Días */
.bk-days {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    padding: 2px 2px 10px;
    margin: 0 -20px;
    padding-left: 20px;
    padding-right: 20px;
    scrollbar-width: none;
}
.bk-days::-webkit-scrollbar { display: none; }
.bk-day {
    flex: none;
    width: 62px;
    min-height: 72px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--surface);
    display: grid;
    place-content: center;
    text-align: center;
    gap: 2px;
    cursor: pointer;
    scroll-snap-align: start;
}
.bk-day small { font-size: 12px; color: var(--muted); text-transform: capitalize; font-weight: 600; }
.bk-day b { font-size: 20px; }
.bk-day[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.bk-day[aria-pressed="true"] small { color: var(--on-brand); opacity: .85; }
.bk-day:disabled { opacity: .38; cursor: not-allowed; text-decoration: line-through; }

.bk-month-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 0;
    background: none;
    color: var(--brand-text);
    font-weight: 700;
    font-size: 14px;
    min-height: 40px;
    cursor: pointer;
    padding: 0;
}

.bk-month { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 12px; margin-bottom: 12px; }
.bk-month-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.bk-month-head strong { text-transform: capitalize; }
.bk-month-head button { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); cursor: pointer; }
.bk-month-head button:disabled { opacity: .35; cursor: not-allowed; }
.bk-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.bk-grid .wd { font-size: 12px; color: var(--muted); font-weight: 600; padding: 4px 0; }
.bk-grid button {
    aspect-ratio: 1;
    border: 0;
    border-radius: 10px;
    background: none;
    font-weight: 600;
    cursor: pointer;
}
.bk-grid button:disabled { color: var(--muted); opacity: .4; cursor: not-allowed; }
.bk-grid button[aria-pressed="true"] { background: var(--brand); color: var(--on-brand); }

/* Horas */
.bk-slots-group { margin-top: 16px; }
.bk-slots-group h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-family: var(--font-body); margin-bottom: 8px; }
.bk-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.bk-slot {
    min-height: 46px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--surface);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
}
.bk-slot[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }

.bk-empty { padding: 18px; border-radius: var(--radius); background: var(--surface-2); color: var(--muted); text-align: center; }

.bk-skeleton { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
.bk-skeleton span { height: 46px; border-radius: 12px; background: var(--surface-2); animation: bk-pulse 1.2s ease-in-out infinite; }
@keyframes bk-pulse { 50% { opacity: .5; } }

/* Datos */
.bk-summary { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 14px 16px; margin-bottom: 18px; }
.bk-summary dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; font-size: 15px; }
.bk-summary dt { color: var(--muted); }
.bk-summary dd { margin: 0; font-weight: 600; text-align: right; }

.bk-field { display: grid; gap: 6px; margin-bottom: 14px; }
.bk-field label { font-weight: 600; font-size: 15px; }
.bk-field small { color: var(--muted); font-size: 13px; }
.bk-input, .bk-select {
    width: 100%;
    min-height: 50px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--surface);
    font-size: 16px; /* 16px evita el zoom automático de iOS */
}
.bk-input:focus, .bk-select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
.bk-input[aria-invalid="true"] { border-color: var(--danger); }
.bk-phone { display: grid; grid-template-columns: 96px 1fr; gap: 8px; }
.bk-error { color: var(--danger); font-size: 14px; }

.bk-remember { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); margin-bottom: 14px; font-size: 14px; }
.bk-remember button { border: 0; background: none; color: var(--brand-text); font-weight: 700; cursor: pointer; min-height: 40px; }

.bk-notes { border-left: 3px solid var(--brand); background: var(--surface-2); padding: 12px 14px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin-bottom: 16px; font-size: 15px; white-space: pre-line; }
.bk-notes strong { display: block; margin-bottom: 4px; }

.bk-check { display: flex; gap: 12px; align-items: flex-start; margin: 4px 0 16px; font-size: 15px; }
.bk-check input { width: 22px; height: 22px; margin-top: 1px; accent-color: var(--brand); flex: none; }

.bk-turnstile { min-height: 70px; margin-bottom: 8px; }

/* ---------- Barra inferior ---------- */

.bk-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    background: var(--bg);
    border-top: 1px solid var(--line);
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}
.bk-bar-inner { max-width: 528px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.bk-bar-info { flex: 1; min-width: 0; font-size: 13px; color: var(--muted); line-height: 1.3; }
.bk-bar-info strong { display: block; color: var(--text); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.bk-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 52px;
    padding: 0 22px;
    border-radius: 999px;
    border: 1px solid transparent;
    background: var(--brand);
    color: var(--on-brand);
    font-weight: 700;
    font-size: 16px;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}
.bk-btn:disabled { opacity: .45; cursor: not-allowed; }
.bk-btn-ghost { background: var(--surface); color: var(--text); border-color: var(--line); }
.bk-btn-block { width: 100%; }
.bk-btn-danger { background: transparent; color: var(--danger); border-color: var(--line); }

/* ---------- Confirmación y cita ---------- */

.bk-done { text-align: center; padding-top: 8px; }
.bk-done-icon { width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 14px; display: grid; place-items: center; background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.bk-done-icon .icon { width: 32px; height: 32px; }
.bk-done h2 { font-size: 24px; margin-bottom: 6px; }
.bk-done > p { color: var(--muted); margin-bottom: 18px; }
.bk-folio { display: inline-block; font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-weight: 700; letter-spacing: .08em; background: var(--surface-2); padding: 4px 10px; border-radius: 8px; }

.bk-actions { display: grid; gap: 10px; margin-top: 18px; }
.bk-actions .bk-btn { width: 100%; }
.bk-actions-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.bk-appt { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 18px; margin-bottom: 22px; }
.bk-appt-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.bk-appt-head h2 { font-size: 20px; }
.bk-status { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); white-space: nowrap; }
.bk-status.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.bk-status.off { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.bk-appt .bk-summary { margin-bottom: 0; }
.bk-appt-note { font-size: 14px; color: var(--muted); margin-top: 12px; }

/* ---------- Galería ---------- */

.bk-gallery { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bk-gallery button { border: 0; padding: 0; background: var(--surface-2); border-radius: 12px; overflow: hidden; aspect-ratio: 1; cursor: zoom-in; }
.bk-gallery img { width: 100%; height: 100%; object-fit: cover; }
.bk-lightbox { border: 0; padding: 0; background: transparent; max-width: min(92vw, 560px); width: 100%; }
.bk-lightbox::backdrop { background: rgba(0, 0, 0, .82); }
.bk-lightbox figure { margin: 0; background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.bk-lightbox figcaption { padding: 12px 16px; }
.bk-lightbox figcaption small { color: var(--muted); display: block; }
.bk-lightbox .close { position: absolute; top: 8px; right: 8px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .55); color: #fff; cursor: pointer; display: grid; place-items: center; }

/* ---------- Mis citas ---------- */

.bk-my-list { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 10px; }
.bk-my-list li { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); padding: 12px 14px; font-size: 15px; }
.bk-my-list li strong { display: block; }
.bk-my-list li span { color: var(--muted); font-size: 14px; }

/* ---------- Avisos ---------- */

.bk-toast {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: calc(var(--bar-h) + 16px + env(safe-area-inset-bottom));
    z-index: 40;
    max-width: 528px;
    margin: 0 auto;
    background: var(--text);
    color: var(--bg);
    padding: 14px 16px;
    border-radius: 14px;
    font-size: 15px;
    box-shadow: 0 12px 30px -12px rgba(0, 0, 0, .5);
}

.bk-unavailable { margin: 20px; padding: 18px; border-radius: var(--radius); background: var(--surface-2); }
.bk-unavailable h2 { font-size: 19px; margin-bottom: 6px; }

.bk-preview-banner { background: var(--text); color: var(--bg); text-align: center; font-size: 13px; font-weight: 600; padding: 8px; }

.bk-footer { text-align: center; padding: 28px 20px 8px; font-size: 13px; color: var(--muted); }
.bk-footer a { color: var(--muted); font-weight: 600; }
