/* =============================================================================
   Bookings settings (wave 2): Availability, Online Booking, and the booking
   parts of the product editor. AM Navy kit: flat bordered cards, no shadows on
   cards, underline tabs, pill statuses. Colours come from theme tokens only
   (--am-blue*, --accent*, --surface-*, --border-*, --text-*, --status-*), so
   Wood and the other themes reach every part of it.
   ============================================================================= */

.bks-page { display: flex; flex-direction: column; min-height: 0; }

/* ---- Header, tabs, body ---------------------------------------------------- */
.bks-header {
    display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 16px;
    padding: 22px 28px 4px;
}
.bks-header__text { min-width: 0; }
.bks-header__title { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.01em; color: var(--text-primary); }
.bks-header__description { margin: 4px 0 0; font-size: 13.5px; color: var(--text-secondary); line-height: 1.5; }
.bks-header__actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* The tabs are AM's own record tabs (records.css); this only places the strip
   on a page: the line runs from 16px so the first tab's words line up with the
   28px page title above it, as the tab's own 12px padding takes them in. */
.record-tabs.bks-tabs { margin: 14px 16px 0; padding: 0; }
.record-tabs.bks-tabs .record-tab:focus-visible { outline: none; box-shadow: var(--am-focus); border-radius: 4px; }

.bks-body { padding: 20px 28px 32px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.bks-loading { margin: 8px 0; font-size: 13.5px; color: var(--text-muted); }

.bks-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.bks-main, .bks-aside { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* ---- Cards -------------------------------------------------------------- */
.bks-card { border: 1px solid var(--border-default); border-radius: 8px; background: var(--surface-panel); min-width: 0; }
.bks-card__head { display: flex; align-items: flex-start; gap: 12px; padding: 16px 20px 0; }
.bks-card__icon {
    display: inline-flex; align-items: center; justify-content: center; flex: none; width: 34px; height: 34px;
    border-radius: 8px; background: var(--am-blue-soft); color: var(--am-blue);
}
.bks-card__titles { flex: 1 1 auto; min-width: 0; }
.bks-card__title { margin: 0; font-size: 15px; font-weight: 700; color: var(--text-primary); line-height: 1.3; }
.bks-card__hint { margin: 3px 0 0; font-size: 12.5px; color: var(--text-secondary); line-height: 1.5; }
.bks-card__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.bks-card__body { padding: 16px 20px 20px; }

/* ---- Fields ------------------------------------------------------------- */
.bks-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.bks-grid--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.bks-stack { display: flex; flex-direction: column; gap: 12px; }
.bks-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.bks-field--wide { grid-column: 1 / -1; }
.bks-field__label { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--text-primary); }
.bks-field__count { font-weight: 500; color: var(--text-muted); }
.bks-field__input {
    width: 100%; min-height: 38px; padding: 8px 11px; border: 1px solid var(--border-strong); border-radius: var(--am-radius);
    background: var(--surface-panel); color: var(--text-primary); font-family: inherit; font-size: 13.5px; line-height: 1.4;
    box-sizing: border-box;
}
textarea.bks-field__input { min-height: 92px; resize: vertical; }
select.bks-field__input { padding-right: 28px; }
.bks-field__input::placeholder { color: var(--text-muted); }
.bks-field__input:hover:not(:disabled) { border-color: var(--text-muted); }
.bks-field__input:focus { outline: none; border-color: var(--am-blue); box-shadow: var(--am-focus); }
.bks-field__input:disabled { background: var(--surface-subtle); color: var(--text-muted); }
.bks-field__input--invalid { border-color: var(--status-danger); }
.bks-field__hint { font-size: 12px; color: var(--text-muted); line-height: 1.45; }

/* The kit's fields are the AM notched field (kudio-field.css). Under the
   outline: helper text on the left, the character count on the right. */
.bks-field__foot { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; min-width: 0; }
.bks-field__foot .kudio-field-hint { margin: 0 2px; }
.bks-field__foot .bks-field__count { flex: none; margin-left: auto; font-size: var(--font-size-tiny); line-height: 1.5; font-variant-numeric: tabular-nums; }
.bks-grow { flex: 1 1 auto; min-width: 0; }
.kudio-field .bks-colour-input { padding: 2px 0; cursor: pointer; }
.kudio-field .bks-colour-input:disabled { cursor: not-allowed; }

/* A notched outline around more than one control (kit.outline): an image slot
   with its buttons, a rich text editor. */
.bks-outline > .bks-image { padding: 6px 0 6px; }
.bks-category-line { align-items: center; }

/* A DEX.MultiSelectField put in the outline (kit.notchPicker): the control
   gives up its own box, and the outline shows the accent while the menu is
   open (focus has moved to the menu's search on <body> by then). */
.kudio-field.bks-picker .multi-select__control,
.kudio-field.bks-picker .multi-select__control:focus-visible {
    min-height: 30px; padding: 2px 22px 3px 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; outline: 0;
}
.kudio-field.bks-picker .multi-select__caret { right: 2px; }
.multi-select--open > .kudio-field.bks-picker { border-color: var(--accent); border-width: 2px; padding: 0 10px 3px; }
.multi-select--open > .kudio-field.bks-picker .kudio-field__label { color: var(--accent); }

/* A rich text editor inside the outline gives up its own box: the outline is
   the field's only edge and carries the 2px accent on focus. */
.kudio-field .rich-text--field,
.kudio-field .rich-text--field:focus-within { border: 0; border-radius: 0; box-shadow: none; background: transparent; }
.kudio-field .rich-text--field .rich-text__toolbar { padding: 2px 0 4px; background: transparent; }
.kudio-field .rich-text--field .rich-text__editor { padding: 8px 0 4px; }

/* ---- Switch rows -------------------------------------------------------- */
.bks-switch-list { display: flex; flex-direction: column; }
.bks-switch-row {
    display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0;
    border-top: 1px solid var(--border-subtle);
}
.bks-switch-row:first-child { border-top: 0; padding-top: 0; }
.bks-switch-row__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bks-switch-row__label { font-size: 13.5px; font-weight: 600; color: var(--text-primary); }
.bks-switch-row__hint { font-size: 12.5px; color: var(--text-secondary); line-height: 1.45; }

.bks-switch { position: relative; display: inline-flex; flex: none; width: 40px; height: 22px; cursor: pointer; }
.bks-switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.bks-switch__track {
    width: 40px; height: 22px; border-radius: 999px; background: var(--border-strong);
    transition: background-color .15s ease; pointer-events: none;
}
.bks-switch__track::after {
    content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
    background: var(--surface-panel); transition: transform .15s ease;
}
.bks-switch input:checked + .bks-switch__track { background: var(--am-blue); }
.bks-switch input:checked + .bks-switch__track::after { transform: translateX(18px); }
.bks-switch input:focus-visible + .bks-switch__track { box-shadow: var(--am-focus); }
.bks-switch input:disabled { cursor: not-allowed; }
.bks-switch input:disabled + .bks-switch__track { opacity: .5; }

/* ---- Pills, notices, states --------------------------------------------- */
.bks-pill {
    display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: var(--radius-chip, 4px);
    font-size: 11.5px; font-weight: 600; white-space: nowrap; background: var(--status-neutral-tint); color: var(--status-neutral);
}
.bks-pill--success { background: var(--status-success-tint); color: var(--status-success); }
.bks-pill--warning { background: var(--status-warning-tint); color: var(--status-warning); }
.bks-pill--danger { background: var(--status-danger-tint); color: var(--status-danger); }
.bks-pill--info { background: var(--status-info-tint); color: var(--status-info); }
.bks-pill--accent { background: var(--am-blue-soft); color: var(--am-blue); }

.bks-notice {
    display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 1px solid var(--accent-border);
    border-radius: 8px; background: var(--am-blue-tint); color: var(--text-primary); font-size: 13px; line-height: 1.5;
}
.bks-notice__icon { display: inline-flex; flex: none; color: var(--am-blue); margin-top: 1px; }
.bks-notice--warning { border-color: var(--status-warning-tint); background: var(--status-warning-tint); }
.bks-notice--warning .bks-notice__icon { color: var(--status-warning); }

.bks-empty { padding: 28px 16px; text-align: center; color: var(--text-secondary); font-size: 13px; }
.bks-empty strong { display: block; margin-bottom: 4px; font-size: 14px; color: var(--text-primary); }

/* ---- Save bar ------------------------------------------------------------ */
.bks-savebar {
    position: sticky; bottom: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px;
    margin: 4px -28px -32px; padding: 12px 28px; border-top: 1px solid var(--border-default); background: var(--surface-panel);
}
.bks-savebar__status { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); }
.bks-savebar__status::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--status-success); }
.bks-savebar--dirty .bks-savebar__status { color: var(--status-warning); font-weight: 600; }
.bks-savebar--dirty .bks-savebar__status::before { background: var(--status-warning); }
.bks-savebar__actions { display: flex; gap: 8px; }

/* ---- List toolbar (title, search, then buttons) --------------------------- */
.bks-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.bks-toolbar__title { margin: 0 auto 0 0; font-size: 15px; font-weight: 700; color: var(--text-primary); }
/* The AM list search (form-field__control invoice-search); only its width here. */
.bks-search { flex: 0 1 300px; width: auto; min-width: 200px; }
.bks-chips { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---- Row lists -------------------------------------------------------------- */
.bks-rows { display: flex; flex-direction: column; border: 1px solid var(--border-default); border-radius: 8px; background: var(--surface-panel); overflow: hidden; }
.bks-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border-subtle); min-width: 0; }
.bks-row:first-child { border-top: 0; }
.bks-row__icon {
    display: inline-flex; align-items: center; justify-content: center; flex: none; width: 34px; height: 34px;
    border-radius: 8px; background: var(--am-blue-soft); color: var(--am-blue); font-size: 12px; font-weight: 700;
}
.bks-row__main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.bks-row__title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--text-primary); overflow-wrap: anywhere; }
.bks-row__meta { font-size: 12.5px; color: var(--text-secondary); overflow-wrap: anywhere; }
.bks-row__actions { display: flex; flex: none; gap: 6px; }
.bks-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--border-default); }

.bks-icon-button {
    display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0;
    border: 0; border-radius: var(--am-radius); background: transparent; color: var(--text-secondary); cursor: pointer;
}
.bks-icon-button:hover:not(:disabled) { background: var(--am-blue-tint); color: var(--am-blue); }
.bks-icon-button--danger:hover:not(:disabled) { background: var(--status-danger-tint); color: var(--status-danger); }
.bks-icon-button:disabled { opacity: .4; cursor: not-allowed; }
.bks-icon-button:focus-visible { outline: none; box-shadow: var(--am-focus); }

/* ---- Weekly hours grid ------------------------------------------------------ */
.bks-week { display: flex; flex-direction: column; }
.bks-day {
    display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; align-items: start; gap: 12px;
    padding: 12px 0; border-top: 1px solid var(--border-subtle);
}
.bks-day:first-child { border-top: 0; padding-top: 0; }
.bks-day__name { display: flex; align-items: center; gap: 10px; min-height: 42px; font-size: 13.5px; font-weight: 600; color: var(--text-primary); }
.bks-day__ranges { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.bks-day__closed { display: flex; align-items: center; min-height: 42px; font-size: 13px; color: var(--text-muted); }
.bks-range { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.bks-range .bks-field__input { width: 124px; }
.bks-range > .bks-field:not(.bks-grow) { flex: none; width: 132px; }
.bks-range__dash { color: var(--text-muted); }
.bks-day__add { min-height: 38px; }

/* ---- Pop-up under a button ------------------------------------------------ */
.bks-pop {
    position: fixed; z-index: 1300; width: min(380px, calc(100vw - 16px)); overflow: auto;
    padding: 14px; border: 1px solid var(--border-default); border-radius: 8px; background: var(--surface-panel);
    box-shadow: var(--shadow-dropdown);
}
.bks-pop__title { margin: 0 0 12px; font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); }
.bks-pop__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.bks-pop .bks-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

/* ---- Segmented choice (one-off / weekly) --------------------------------- */
.bks-choice { display: inline-flex; gap: 6px; flex-wrap: wrap; }

/* ---- Public link strip ------------------------------------------------------ */
.bks-link {
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 12px;
    border: 1px solid var(--border-default); border-radius: var(--am-radius); background: var(--surface-subtle);
}
.bks-link__url { flex: 1 1 220px; min-width: 0; font-family: var(--font-monospace, ui-monospace, monospace); font-size: 13px; color: var(--text-primary); overflow-wrap: anywhere; }

/* ---- Images ----------------------------------------------------------------- */
.bks-image { display: flex; flex-direction: column; gap: 10px; }
.bks-image__slot {
    display: flex; align-items: center; justify-content: center; aspect-ratio: 3 / 1; overflow: hidden;
    border: 1px dashed var(--border-strong); border-radius: 8px; background: var(--surface-subtle); color: var(--text-muted); font-size: 12.5px;
}
.bks-image__slot--square { aspect-ratio: 16 / 10; }
.bks-image__slot img { width: 100%; height: 100%; object-fit: cover; }
.bks-image__actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---- Tag list (Good to know) ------------------------------------------------ */
.bks-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.bks-tag {
    display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 4px 0 10px; border-radius: var(--radius-chip, 4px);
    background: var(--am-blue-soft); color: var(--am-blue); font-size: 12.5px; font-weight: 500;
}
.bks-tag button { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border: 0; border-radius: 50%; background: none; color: inherit; cursor: pointer; }
.bks-tag button:hover { background: var(--am-blue-soft-hover); }
.bks-tag-add { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.bks-tag-add .bks-field__input { flex: 1 1 auto; }

/* ---- Editor blocks inside the product editor (variants, allowances) ------- */
.bks-editor { display: flex; flex-direction: column; gap: 10px; }
.bks-editor__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.bks-editor__title { margin: 0; font-size: 13.5px; font-weight: 700; color: var(--text-primary); }
.bks-editor__hint { margin: 0; font-size: 12px; color: var(--text-muted); line-height: 1.45; }
.bks-editor__item { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid var(--border-default); border-radius: 8px; background: var(--surface-panel); }
.bks-editor__item-head { display: flex; align-items: center; gap: 8px; }
.bks-editor__item-head .bks-field { flex: 1 1 auto; }
.bks-editor__item-tools { display: flex; gap: 2px; flex: none; align-self: flex-end; }
.bks-section-title { margin: 6px 0 0; padding-top: 14px; border-top: 1px solid var(--border-subtle); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }

/* ---- Responsive ------------------------------------------------------------- */
@media (max-width: 1100px) {
    .bks-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
    .bks-day { grid-template-columns: minmax(0, 1fr) auto; }
    .bks-day__ranges { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
    .bks-header { padding: 16px 16px 2px; }
    .record-tabs.bks-tabs { margin: 10px 4px 0; }
    .bks-body { padding: 16px 16px 24px; }
    .bks-savebar { margin: 4px -16px -24px; padding: 12px 16px; }
    .bks-card__head { padding: 14px 16px 0; }
    .bks-card__body { padding: 14px 16px 16px; }
    .bks-grid, .bks-grid--three, .bks-pop .bks-grid { grid-template-columns: minmax(0, 1fr); }
    .bks-search { flex: 1 1 100%; min-width: 0; order: 2; }
    .bks-row { flex-wrap: wrap; }
    .bks-row__actions { margin-left: auto; }
}
@media (max-width: 560px) {
    .bks-page .bks-field__input, .bks-pop .bks-field__input, .bks-page .bks-search, .bks-editor .bks-field__input { font-size: 16px; }
    .bks-page .am-btn, .bks-pop .am-btn, .bks-editor .am-btn { min-height: 40px; }
    .bks-icon-button { width: 40px; height: 40px; }
    .bks-range .bks-field__input { width: calc(50% - 40px); min-width: 108px; }
    .bks-range > .bks-field:not(.bks-grow) { width: calc(50% - 30px); min-width: 108px; }
}
@media (prefers-reduced-motion: reduce) {
    .bks-switch__track, .bks-switch__track::after { transition: none; }
}
