/* TCE Direct boeken — follows DESIGN.md */
.tce-qb {
    --tce-qb-accent: var(--e-global-color-secondary, #007EF5);
    --tce-qb-chip: var(--e-global-color-primary, #FDF6EC);
    --tce-qb-heading-font: var(--e-global-typography-primary-font-family, "Parkinsans"), sans-serif;
    --tce-qb-text: #1a1a1a;
    --tce-qb-muted: #5f6368;
    --tce-qb-line: rgba(0, 0, 0, .08);
    --tce-qb-shadow: 0 2px 12px rgba(0, 0, 0, .07), 0 8px 32px rgba(0, 0, 0, .06);

    --tce-qb-btn-bg: var(--tce-qb-accent);
    --tce-qb-btn-text: #fff;
    --tce-qb-btn-hover-bg: var(--tce-qb-btn-bg);
    --tce-qb-btn-hover-text: var(--tce-qb-btn-text);
    --tce-qb-btn-hover-filter: brightness(.92);
    --tce-qb-btn-radius: 10px;
    --tce-qb-btn-padding: 10px 22px;

    --tce-qb-row-btn-bg: var(--tce-qb-accent);
    --tce-qb-row-btn-text: #fff;
    --tce-qb-row-hover: var(--tce-qb-chip);
    --tce-qb-width: 560px;

    display: flex;
    justify-content: var(--tce-qb-justify, flex-start);
}

/* ── Trigger button ─────────────────────────────────────────────────── */
.tce-qb .tce-qb__trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: var(--tce-qb-btn-width, auto);
    min-height: 44px;
    margin: 0;
    padding: var(--tce-qb-btn-padding);
    font-family: var(--tce-qb-heading-font);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    color: var(--tce-qb-btn-text);
    background: var(--tce-qb-btn-bg);
    border: 0;
    border-radius: var(--tce-qb-btn-radius);
    box-shadow: none;
    cursor: pointer;
    box-sizing: border-box;
}
/* Extra class beats theme button resets (Hello: pink on hover/focus) */
.tce-qb .tce-qb__trigger:hover,
.tce-qb .tce-qb__trigger:focus {
    color: var(--tce-qb-btn-hover-text);
    background: var(--tce-qb-btn-hover-bg);
    filter: var(--tce-qb-btn-hover-filter);
}
.tce-qb .tce-qb__trigger-icon { display: inline-flex; line-height: 0; }
.tce-qb .tce-qb__trigger-icon i { font-size: .95em; }
.tce-qb .tce-qb__trigger-icon svg { width: 1em; height: 1em; fill: currentColor; }

/* ── Dialog ─────────────────────────────────────────────────────────── */
.tce-qb .tce-qb__dialog {
    width: min(var(--tce-qb-width), calc(100vw - 32px));
    max-width: none;
    max-height: min(720px, 85vh);
    margin: auto;
    padding: 0;
    color: var(--tce-qb-text);
    background: #fff;
    border: 0;
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, .22);
    overflow: hidden;
    box-sizing: border-box;
}
.tce-qb .tce-qb__dialog[open] { display: flex; }
.tce-qb .tce-qb__dialog::backdrop {
    background: rgba(0, 0, 0, .45);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
}

.tce-qb .tce-qb__panel {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 0;
    max-height: inherit;
    outline: none;
}

.tce-qb .tce-qb__head {
    flex: 0 0 auto;
    padding: 16px 16px 12px;
    border-bottom: 1px solid var(--tce-qb-line);
}
.tce-qb .tce-qb__handle { display: none; }
.tce-qb .tce-qb__title {
    margin: 4px 4px 12px;
    font-family: var(--tce-qb-heading-font);
    font-size: 20px;
    font-weight: 700;
    line-height: 1.25;
    color: var(--tce-qb-text);
}

.tce-qb .tce-qb__search {
    position: relative;
    display: flex;
    align-items: center;
}
.tce-qb .tce-qb__search > .tce-qb__icon--search {
    position: absolute;
    left: 14px;
    color: var(--tce-qb-muted);
    pointer-events: none;
}
.tce-qb .tce-qb__input,
.tce-qb .tce-qb__input[type="search"] {
    -webkit-appearance: none;
    appearance: none;
    flex: 1 1 auto;
    width: 100%;
    height: 48px;
    margin: 0;
    padding: 0 52px 0 44px;
    font-family: inherit;
    font-size: 16px; /* no iOS zoom on focus */
    line-height: 1.2;
    color: var(--tce-qb-text);
    background: var(--tce-qb-chip);
    border: 2px solid transparent;
    border-radius: 12px;
    box-shadow: none;
    outline: none;
    box-sizing: border-box;
}
.tce-qb .tce-qb__input::placeholder { color: var(--tce-qb-muted); opacity: 1; }
.tce-qb .tce-qb__input::-webkit-search-cancel-button { display: none; }
.tce-qb .tce-qb__input:focus {
    background: #fff;
    border-color: var(--tce-qb-accent);
}

.tce-qb .tce-qb__close {
    position: absolute;
    right: 2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    color: var(--tce-qb-muted);
    background: transparent;
    border: 0;
    border-radius: 10px;
    box-shadow: none;
    cursor: pointer;
}
.tce-qb .tce-qb__close:hover,
.tce-qb .tce-qb__close:focus {
    color: var(--tce-qb-text);
    background: transparent;
}

/* ── List ───────────────────────────────────────────────────────────── */
.tce-qb .tce-qb__list {
    flex: 1 1 auto;
    min-height: 0;
    margin: 0;
    padding: 8px;
    list-style: none;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}
.tce-qb .tce-qb__item { margin: 0; padding: 0; }
.tce-qb .tce-qb__item[hidden] { display: none; }

.tce-qb .tce-qb__row {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    padding: 8px 8px 8px 12px;
    color: var(--tce-qb-text);
    text-decoration: none;
    border-radius: 12px;
    box-sizing: border-box;
}
.tce-qb .tce-qb__row:hover,
.tce-qb .tce-qb__row:focus,
.tce-qb .tce-qb__item.is-first .tce-qb__row {
    color: var(--tce-qb-text);
    background: var(--tce-qb-row-hover);
    text-decoration: none;
}
.tce-qb .tce-qb__row > .tce-qb__icon--pin {
    flex: 0 0 auto;
    color: var(--tce-qb-accent);
}
.tce-qb .tce-qb__name {
    flex: 1 1 auto;
    min-width: 0;
    font-family: var(--tce-qb-heading-font);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
}
.tce-qb .tce-qb__price {
    display: block;
    margin-top: 2px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 400;
    color: var(--tce-qb-muted);
}
.tce-qb .tce-qb__price .woocommerce-Price-amount { font-weight: 500; }

.tce-qb .tce-qb__book {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    padding: 6px 16px;
    font-family: var(--tce-qb-heading-font);
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    color: var(--tce-qb-row-btn-text);
    background: var(--tce-qb-row-btn-bg);
    border-radius: 999px;
    box-sizing: border-box;
}
.tce-qb .tce-qb__book-icon { display: inline-flex; line-height: 0; }
.tce-qb .tce-qb__book-icon i { font-size: 14px; }
.tce-qb .tce-qb__book-icon svg { width: 14px; height: 14px; fill: currentColor; }
.tce-qb .tce-qb__row:hover .tce-qb__book { filter: brightness(.92); }

/* Clicked: spinner instead of the arrow, other rows locked (no double adds) */
.tce-qb .tce-qb__list.is-busy { pointer-events: none; }
.tce-qb .tce-qb__list.is-busy .tce-qb__item:not(.is-loading) { opacity: .5; }
.tce-qb .tce-qb__item.is-loading .tce-qb__book-icon { display: none; }
.tce-qb .tce-qb__item.is-loading .tce-qb__book::after {
    content: "";
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: tce-qb-spin .7s linear infinite;
}

.tce-qb .tce-qb__empty {
    margin: 0;
    padding: 32px 24px;
    font-size: 15px;
    text-align: center;
    color: var(--tce-qb-muted);
}
.tce-qb .tce-qb__empty[hidden] { display: none; }

.tce-qb .tce-qb__status {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── Focus ──────────────────────────────────────────────────────────── */
.tce-qb .tce-qb__trigger:focus-visible,
.tce-qb .tce-qb__close:focus-visible,
.tce-qb .tce-qb__row:focus-visible {
    outline: 2px solid var(--tce-qb-accent);
    outline-offset: 2px;
}
.tce-qb .tce-qb__row:focus-visible { outline-offset: -2px; }

/* ── Phone: bottom sheet ────────────────────────────────────────────── */
@media (max-width: 767px) {
    .tce-qb .tce-qb__dialog {
        width: 100%;
        max-height: 88vh;
        max-height: 88dvh;
        margin: auto 0 0;
        border-radius: 20px 20px 0 0;
    }
    .tce-qb .tce-qb__head { padding: 0 12px 12px; }
    /* Drag zone: the handle (taller than its bar) and the title; swipe down closes (quick-book.js). */
    .tce-qb .tce-qb__handle,
    .tce-qb .tce-qb__title { touch-action: none; }
    .tce-qb .tce-qb__handle {
        display: block;
        height: 22px;
        margin: 0 -12px;
        cursor: grab;
    }
    .tce-qb .tce-qb__handle::before {
        content: "";
        display: block;
        width: 40px;
        height: 4px;
        margin: 8px auto 0;
        background: rgba(0, 0, 0, .15);
        border-radius: 999px;
    }
    .tce-qb .tce-qb__title { font-size: 18px; margin: 0 4px 10px; }
    .tce-qb .tce-qb__list { padding: 6px 6px calc(12px + env(safe-area-inset-bottom, 0px)); }
    .tce-qb .tce-qb__row { gap: 10px; padding-left: 8px; }
    .tce-qb .tce-qb__book { min-height: 40px; padding: 8px 16px; }
}

/* ── Motion ─────────────────────────────────────────────────────────── */
@keyframes tce-qb-spin { to { transform: rotate(360deg); } }
@keyframes tce-qb-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes tce-qb-sheet { from { transform: translateY(100%); } }
@keyframes tce-qb-fade { from { opacity: 0; } }

@media (prefers-reduced-motion: no-preference) {
    .tce-qb .tce-qb__trigger { transition: background-color .15s ease, color .15s ease, filter .15s ease; }
    .tce-qb .tce-qb__row { transition: background-color .12s ease; }
    .tce-qb .tce-qb__input { transition: border-color .15s ease, background-color .15s ease; }
    .tce-qb .tce-qb__dialog[open] { animation: tce-qb-in .2s ease-out; }
    .tce-qb .tce-qb__dialog[open]::backdrop { animation: tce-qb-fade .2s ease-out; }
}
@media (prefers-reduced-motion: no-preference) and (max-width: 767px) {
    .tce-qb .tce-qb__dialog[open] {
        animation: tce-qb-sheet .28s cubic-bezier(.2, .8, .2, 1);
        transition: transform .25s cubic-bezier(.2, .8, .2, 1);
    }
    .tce-qb .tce-qb__dialog.is-dragging { transition: none; }
}
@media (prefers-reduced-motion: reduce) {
    .tce-qb .tce-qb__item.is-loading .tce-qb__book::after { animation-duration: 1.5s; }
}

html.tce-qb-lock { overflow: hidden; }
