/*
 * The booking form: message editor, voice-note recorder, and field errors.
 * Used only by app/Views/booking/create.php, alongside assets/js/booking.js.
 *
 * Colours and type come from the variables defined in layouts/public.php
 * (--ink, --gold, --lamp, --mist, --muted, --line, --display), so a change
 * there reaches this file too. Everything here is prefixed bk- so it can never
 * collide with Bootstrap or the rest of the site.
 */

/* ---------- small shared pieces ---------- */
.bk-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.bk-js .bk-js-hidden { display: none; }
.bk-optional { font-weight: 400; color: var(--muted); }
.bk-help { margin: 0 0 .85rem; color: var(--muted); font-size: .95rem; }
.bk-status { margin: 0; font-size: .95rem; color: var(--muted); }
.bk-error, .bk-warn { margin: .5rem 0 0; padding: .55rem .8rem; border-radius: 8px; font-size: .95rem; line-height: 1.45; }
.bk-error { background: #FDE7E7; color: #7A1010; border-left: 4px solid var(--lamp); }
.bk-warn  { background: #FFF3D1; color: #5C4200; border-left: 4px solid var(--gold); }
.bk-error[hidden], .bk-warn[hidden] { display: none; }

.bk-link { background: none; border: 0; padding: .35rem .15rem; font: inherit; font-weight: 700; color: var(--ink);
    text-decoration: underline; text-underline-offset: 3px; cursor: pointer; min-height: 44px; }
.bk-link:hover { color: var(--panel); }

.bk-btn { display: inline-flex; align-items: center; justify-content: center; gap: .55rem; min-height: 3rem; padding: .65rem 1.3rem;
    border-radius: 999px; border: 2px solid transparent; font: inherit; font-weight: 700; line-height: 1.2; cursor: pointer; }
.bk-btn:disabled { opacity: .55; cursor: not-allowed; }
.bk-btn--rec   { background: var(--lamp); color: #fff; }
.bk-btn--rec:hover:not(:disabled) { background: #B91F1F; }
.bk-btn--stop  { background: var(--ink); color: #fff; }
.bk-btn--stop:hover { background: var(--panel); }
.bk-btn--ghost { background: transparent; color: var(--ink); border-color: var(--ink); }
.bk-btn--ghost:hover:not(:disabled) { background: var(--ink); color: #fff; }
.bk-btn svg { flex: none; }

:where(.bk-btn, .bk-link, .bk-chip, .bk-pill):focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

/* ---------- field errors ---------- */
.bk-js [aria-invalid="true"]:not(.bk-pkgs) { border-color: var(--lamp); box-shadow: 0 0 0 3px rgba(214, 40, 40, .15); }

/* ---------- package choice: the selected one should look selected ---------- */
.bk-pkg { display: block; height: 100%; padding: 1rem 1.1rem; border: 2px solid var(--line); border-radius: 12px; cursor: pointer; background: #fff; transition: border-color .12s, background-color .12s; }
.bk-pkg:hover { border-color: #9FB0D6; }
.bk-pkg:has(input:checked) { border-color: var(--ink); background: var(--mist); }
.bk-pkg:has(input:focus-visible) { outline: 3px solid var(--ink); outline-offset: 2px; }
.bk-pkg-row { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.bk-pkg-name { font-weight: 700; }
.bk-pkg-price { font-family: var(--display); font-weight: 800; white-space: nowrap; }
.bk-pkg-note { margin: .25rem 0 0 1.75rem; color: var(--muted); font-size: .92rem; }

/* ---------- message editor ---------- */
.bk-editor textarea { min-height: 9.5rem; font-size: 1.0625rem; line-height: 1.6; resize: vertical; }
.bk-editor-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .35rem 1rem; margin-top: .55rem; }
.bk-editor-foot .bk-status { display: flex; flex-wrap: wrap; gap: .1rem 1.25rem; }
.bk-tools { display: flex; gap: .5rem; }
.bk-meter { height: 5px; margin-top: .45rem; border-radius: 999px; background: var(--line); overflow: hidden; }
.bk-meter > span { display: block; height: 100%; width: 0; background: var(--ink); border-radius: inherit; transition: width .12s linear, background-color .15s; }
.bk-near .bk-meter > span { background: var(--gold); }
.bk-over .bk-meter > span { background: var(--lamp); }
.bk-over #charLine { color: #9C1717; font-weight: 700; }
.bk-near #charLine { color: #6B4D00; font-weight: 700; }

.bk-templates { margin-bottom: 1.1rem; }
.bk-label { margin: 0 0 .5rem; font-weight: 700; }
.bk-pills, .bk-chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.bk-pills { margin-bottom: .6rem; }
.bk-pill { min-height: 36px; padding: .2rem .85rem; border-radius: 999px; border: 2px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-size: .92rem; font-weight: 700; cursor: pointer; }
.bk-pill[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.bk-chip { min-height: 44px; padding: .45rem 1rem; border-radius: 999px; border: 2px solid var(--ink); background: #fff; color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; }
.bk-chip:hover { background: var(--ink); color: #fff; }

.bk-notice { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem 1rem; margin-bottom: 1rem; padding: .6rem .9rem; border-radius: 10px; background: var(--mist); font-size: .95rem; }
.bk-notice[hidden] { display: none; }
.bk-notice > span { flex: 1 1 18rem; }
.bk-notice--replace { background: #FFF3D1; }

/* ---------- voice note ---------- */
.bk-voice { margin: 0; padding: 1.1rem 1.15rem 1.25rem; border: 2px solid var(--line); border-radius: 14px; min-inline-size: 0; }
.bk-voice > legend { float: none; width: auto; margin: 0; padding: 0 .4rem; font-family: var(--display); font-weight: 800; font-size: 1.1rem; }
.bk-voice [hidden] { display: none !important; }
/* The Record / Choose buttons only work with JavaScript. Without it the plain file picker (below) is shown instead,
   so there is never a button that does nothing. */
#voiceIdle { display: none; }
.bk-js #voiceIdle { display: block; }
.bk-voice-actions { display: flex; flex-wrap: wrap; gap: .75rem; }
/* Without JavaScript the plain file picker shows. With it, the buttons replace the picker, which stays in the page
   (some mobile browsers won't open a picker for an input that is display:none) but is visually hidden. */
.bk-voice-note-nojs { margin-top: .5rem; }
.bk-js .bk-voice-note-nojs { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.bk-rec { display: grid; gap: .8rem; }
.bk-rec-top { display: flex; align-items: center; gap: .75rem; }
.bk-rec-dot { width: .9rem; height: .9rem; border-radius: 50%; background: var(--lamp); flex: none; animation: bk-pulse 1.1s ease-in-out infinite; }
.bk-time { font-family: var(--display); font-weight: 800; font-size: 2rem; line-height: 1; font-variant-numeric: tabular-nums; }
.bk-time-max { color: var(--muted); }
.bk-bar { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.bk-bar > span { display: block; height: 100%; width: 0; background: var(--lamp); border-radius: inherit; }
.bk-level-row { display: flex; align-items: center; gap: .6rem; color: var(--muted); }
.bk-level-row .bk-level { flex: 1; }
.bk-level { height: 6px; border-radius: 999px; background: var(--mist); overflow: hidden; }
.bk-level > span { display: block; height: 100%; width: 0; background: var(--ink); border-radius: inherit; transition: width .08s linear; }

.bk-ready { display: grid; gap: .65rem; }
.bk-ready audio { width: 100%; max-width: 28rem; }
.bk-meta { margin: 0; color: var(--muted); font-size: .95rem; }

@keyframes bk-pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .45; transform: scale(.8); } }
@media (prefers-reduced-motion: reduce) {
    .bk-rec-dot { animation: none; }
    .bk-meter > span, .bk-level > span { transition: none; }
}

/* ---------- small screens ---------- */
@media (max-width: 560px) {
    .bk-voice-actions .bk-btn { flex: 1 1 100%; }
    .bk-time { font-size: 1.75rem; }
    .bk-editor textarea { min-height: 11rem; }
}
