.zjs-booking-week {
    --zjs-primary: #fd731e;
    --zjs-primary-hover: #e76516;
    --zjs-secondary: #3e3d3d;
    --zjs-accent: #d89b2b;
    --zjs-free: #2f6f4e;
    --zjs-surface: #ffffff;
    --zjs-muted: #eef2f5;
    --zjs-border: #d8dee4;
    --zjs-text: var(--zjs-secondary);
    --zjs-radius: 0px;
    color: var(--zjs-text);
    width: 100%;
}

.zjs-booking-week__head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.zjs-booking-week__eyebrow {
    color: var(--zjs-accent);
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    margin-bottom: 2px;
}

.zjs-booking-week h2 { margin: 0; color: var(--zjs-secondary); font-size: 1.25rem; line-height: 1.15; }

.zjs-booking-week__nav {
    display: grid;
    grid-template-columns: auto minmax(145px, auto) auto;
    align-items: center;
    gap: 6px;
}

.zjs-booking-week__nav button {
    appearance: none;
    border: 1px solid var(--zjs-border);
    background: var(--zjs-surface);
    color: var(--zjs-secondary);
    border-radius: 0;
    padding: 5px 8px;
    cursor: pointer;
    font: inherit;
}

.zjs-booking-week__nav button:hover { border-color: var(--zjs-secondary); background: var(--zjs-muted); }
.zjs-booking-week__range { text-align: center; color: var(--zjs-secondary); font-size: .82rem; }

.zjs-booking-week__status {
    padding: 10px;
    border: 1px solid var(--zjs-border);
    border-radius: var(--zjs-radius);
    background: var(--zjs-muted);
}

.zjs-booking-week__scroller {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--zjs-border);
    border-radius: var(--zjs-radius);
    background: var(--zjs-surface);
    box-shadow: 0 8px 26px rgba(23, 50, 77, .06);
}

.zjs-booking-week__table {
    width: 100%;
    min-width: 690px;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    margin: 0;
}

.zjs-booking-week__table th,
.zjs-booking-week__table td {
    border-right: 1px solid var(--zjs-border);
    border-bottom: 1px solid var(--zjs-border);
    padding: 3px;
    text-align: center;
    vertical-align: middle;
}

.zjs-booking-week__table tr:last-child > * { border-bottom: 0; }
.zjs-booking-week__table tr > *:last-child { border-right: 0; }
.zjs-booking-week__table thead th { background: var(--zjs-primary); color: #fff; padding: 7px 4px; }
.zjs-booking-week__weekday, .zjs-booking-week__date { display: block; }
.zjs-booking-week__weekday { font-weight: 700; text-transform: uppercase; font-size: .66rem; letter-spacing: .06em; line-height: 1.1; }
.zjs-booking-week__date { margin-top: 1px; opacity: .8; font-size: .72rem; line-height: 1.1; }
.zjs-booking-week__time-head, .zjs-booking-week__time { width: 56px; position: sticky; left: 0; z-index: 2; }
.zjs-booking-week__time-head { z-index: 4; }
.zjs-booking-week__time { background: var(--zjs-muted); color: var(--zjs-secondary); font-weight: 700; font-size: .76rem; }

.zjs-booking-week__slot {
    min-height: 26px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 3px 4px;
    font-size: .78rem;
    text-decoration: none;
}

.zjs-booking-week__slot--free {
    background: rgba(47, 111, 78, .10);
    color: var(--zjs-free);
    border: 1px solid rgba(47, 111, 78, .28);
    font-weight: 700;
    transition: transform .12s ease, background-color .12s ease, border-color .12s ease;
}

.zjs-booking-week__slot--free:hover,
.zjs-booking-week__slot--free:focus {
    background: var(--zjs-free);
    border-color: var(--zjs-free);
    color: #fff;
    transform: translateY(-1px);
}

.zjs-booking-week__slot--booked { color: #7a858e; background: #f4f5f6; }
.zjs-booking-week__unavailable { color: #b8c0c7; background: #fafbfb; }
.zjs-booking-week.is-loading { opacity: .82; }

@media (max-width: 760px) {
    .zjs-booking-week__head { align-items: stretch; flex-direction: column; }
    .zjs-booking-week__nav { grid-template-columns: 1fr auto 1fr; }
    .zjs-booking-week__nav button span { display: none; }
}

.zjs-booking-week__debug {
    margin-top: 6px;
    padding: 5px 7px;
    border: 1px dashed #b8c0c7;
    border-radius: 7px;
    font: 12px/1.45 monospace;
    color: #5f6b75;
    background: #fafbfb;
    overflow-wrap: anywhere;
}

/* Vom ZJS-Wochenkalender aktuell in das Bookings-Formular übernommener Startslot. */
.zjs-booking-week__slot--free.is-selected {
    background: var(--zjs-free);
    border-color: var(--zjs-free);
    color: #fff;
    box-shadow: 0 0 0 2px rgba(47, 111, 78, .16);
}


.zjs-booking-week__trainer-dot,
.zjs-booking-week__legend-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--zjs-free);
    display: inline-block;
    flex: 0 0 auto;
}

.zjs-booking-week__slot {
    position: relative;
}

.zjs-booking-week__trainer-dot {
    margin-left: 1px;
    box-shadow: 0 0 0 2px rgba(47, 111, 78, .16);
}

.zjs-booking-week__legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    align-items: center;
    margin-top: 8px;
    color: var(--zjs-text);
    font-size: .78rem;
}

.zjs-booking-week__legend-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.zjs-booking-week__legend-chip {
    min-height: 24px;
    border-radius: 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 3px 7px;
    font-size: .76rem;
    font-weight: 700;
    border: 1px solid transparent;
}

.zjs-booking-week__legend-chip--free {
    background: rgba(47, 111, 78, .10);
    color: var(--zjs-free);
    border-color: rgba(47, 111, 78, .28);
}

.zjs-booking-week__legend-chip--booked {
    color: #7a858e;
    background: #f4f5f6;
    border-color: #e3e7ea;
}

.zjs-booking-week__legend-text {
    color: var(--zjs-text);
}

/* 0.9: Resource-/Trainerauswahl bewusst vor der Terminwahl. */
.zjs-booking-week__resource-choice {
    display: grid;
    grid-template-columns: auto minmax(180px, 280px) 1fr;
    gap: 8px 10px;
    align-items: center;
    margin: 0 0 10px;
    padding: 8px 10px;
    border: 1px solid var(--zjs-border);
    border-radius: 7px;
    background: var(--zjs-muted);
}

.zjs-booking-week__resource-label {
    color: var(--zjs-primary);
    font-size: .82rem;
    font-weight: 700;
    margin: 0;
}

.zjs-booking-week__resource-select {
    width: 100%;
    min-height: 32px;
    margin: 0;
    padding: 4px 28px 4px 8px;
    border: 1px solid var(--zjs-border);
    border-radius: 6px;
    background: var(--zjs-surface);
    color: var(--zjs-text);
    font: inherit;
    font-size: .82rem;
}

.zjs-booking-week__resource-choice.has-error {
    border-color: #b24b3f;
    box-shadow: 0 0 0 2px rgba(178, 75, 63, .10);
}

.zjs-booking-week__resource-note {
    color: #69747d;
    font-size: .74rem;
}

.zjs-booking-week__original-resource-hidden,
.zjs-booking-week__original-resource-select-hidden {
    display: none !important;
}

.zjs-booking-week__slot--trainer-unavailable {
    color: #a8b0b6;
    background: #fafbfb;
    border: 1px solid #eef0f2;
}

@media (max-width: 760px) {
    .zjs-booking-week__resource-choice {
        grid-template-columns: 1fr;
        gap: 5px;
    }
}

.zjs-booking-week__nav button:disabled,
.zjs-booking-week__nav button[aria-disabled="true"] {
    opacity: .38;
    cursor: default;
    pointer-events: none;
}

/* 1.0: Eigene Endzeit-Auswahl nach dem Startslot. */
.zjs-booking-week__end-choice {
    display: grid;
    grid-template-columns: auto minmax(180px, 280px) 1fr;
    gap: 8px 10px;
    align-items: center;
    margin: 0 0 10px;
    padding: 8px 10px;
    border: 1px solid var(--zjs-border);
    border-radius: 7px;
    background: var(--zjs-surface);
}

.zjs-booking-week__end-label {
    color: var(--zjs-primary);
    font-size: .82rem;
    font-weight: 700;
    margin: 0;
}

.zjs-booking-week__end-select {
    width: 100%;
    min-height: 32px;
    margin: 0;
    padding: 4px 28px 4px 8px;
    border: 1px solid var(--zjs-border);
    border-radius: 6px;
    background: var(--zjs-surface);
    color: var(--zjs-text);
    font: inherit;
    font-size: .82rem;
}

.zjs-booking-week__end-select:disabled {
    opacity: .62;
    cursor: not-allowed;
    background: var(--zjs-muted);
}

.zjs-booking-week__end-choice.is-ready {
    border-color: rgba(23, 50, 77, .28);
}

.zjs-booking-week__end-note {
    color: #69747d;
    font-size: .74rem;
}

.zjs-booking-week__original-end-hidden,
.zjs-booking-week__original-end-select-hidden {
    display: none !important;
}

@media (max-width: 760px) {
    .zjs-booking-week__end-choice {
        grid-template-columns: 1fr;
        gap: 5px;
    }
}

/* 1.1: Direkte Zeitraumwahl in der Wochenübersicht. */
.zjs-booking-week__slot--free.is-end-candidate {
    border-color: var(--zjs-accent);
    background: rgba(216, 155, 43, .10);
    color: var(--zjs-primary);
    box-shadow: inset 0 0 0 1px rgba(216, 155, 43, .18);
}

.zjs-booking-week__slot--free.is-end-candidate:hover,
.zjs-booking-week__slot--free.is-end-candidate:focus {
    background: var(--zjs-accent);
    border-color: var(--zjs-accent);
    color: #fff;
}

.zjs-booking-week__slot--free.is-in-range {
    background: rgba(47, 111, 78, .18);
    border-color: rgba(47, 111, 78, .34);
    color: var(--zjs-free);
}

.zjs-booking-week__slot--free.is-end-selected {
    background: var(--zjs-accent);
    border-color: var(--zjs-accent);
    color: #fff;
    box-shadow: 0 0 0 2px rgba(216, 155, 43, .18);
}

.zjs-booking-week__slot--free.is-selected {
    position: relative;
    z-index: 1;
}


/* 1.1.1: Letzte von WooCommerce erlaubte Endzeit als eigener Raster-Endpunkt. */
.zjs-booking-week__terminal-end-row > * {
    border-top: 1px dashed rgba(216, 155, 43, .42);
}

.zjs-booking-week__terminal-end-time {
    color: var(--zjs-primary);
    font-weight: 700;
}

.zjs-booking-week__terminal-end {
    border-style: dashed;
}

.zjs-booking-week__terminal-end-empty {
    background: #fcfcfc;
}


/* 1.1.3: Das künstliche letzte Endfeld darf sich beim Hover nicht verschieben.
 * Der allgemeine Slot-Hover nutzt translateY(-1px). Bei der terminalen Endzelle
 * kann das die Hitbox unter dem Mauszeiger verlassen und einen Hover-Loop auslösen. */
.zjs-booking-week__terminal-end,
.zjs-booking-week__terminal-end:hover,
.zjs-booking-week__terminal-end:focus,
.zjs-booking-week__terminal-end:active {
    transform: none !important;
}

.zjs-booking-week__terminal-end {
    width: 100%;
    min-height: 26px;
    box-sizing: border-box;
    transition: background-color .12s ease, border-color .12s ease, color .12s ease !important;
}

/* 1.2 Frontend Mode: WooCommerce Bookings bleibt die technische Engine,
   die native Datums-/Zeit-/Resource-Bedienung wird aber nicht mehr angezeigt. */
.zjs-booking-week__native-date-hidden,
.zjs-booking-week__native-time-hidden,
.zjs-booking-week__native-control-hidden,
.zjs-booking-week__frontend-form .zjs-booking-week__native-date-hidden,
.zjs-booking-week__frontend-form .zjs-booking-week__native-time-hidden,
.zjs-booking-week__frontend-form .zjs-booking-week__native-control-hidden {
    display: none !important;
}

/* Das eigene Endzeit-Select bleibt als unsichtbarer Mirror für WooCommerce im DOM. */
.zjs-booking-week__end-choice[hidden] {
    display: none !important;
}

.zjs-booking-week__summary {
    margin-top: 14px;
    border: 1px solid var(--zjs-border);
    border-radius: var(--zjs-radius);
    background: var(--zjs-surface);
    padding: 12px 14px;
}

.zjs-booking-week__summary-title {
    color: var(--zjs-primary);
    font-size: .78rem;
    line-height: 1.2;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.zjs-booking-week__summary-grid {
    display: grid;
    grid-template-columns: minmax(90px, auto) 1fr;
    gap: 5px 14px;
    align-items: baseline;
}

.zjs-booking-week__summary-label {
    color: #6e7982;
    font-size: .8rem;
    font-weight: 600;
}

.zjs-booking-week__summary-value {
    color: var(--zjs-text);
    font-size: .9rem;
    font-weight: 700;
}

.zjs-booking-week__summary.is-complete {
    border-color: rgba(47, 111, 78, .38);
    background: rgba(47, 111, 78, .045);
}

@media (max-width: 600px) {
    .zjs-booking-week__summary-grid {
        grid-template-columns: 1fr;
        gap: 2px;
    }

    .zjs-booking-week__summary-value + .zjs-booking-week__summary-label {
        margin-top: 7px;
    }
}


/* 1.2.5: Trainerhinweis – nur der Punkt nutzt die Primärfarbe. */
.zjs-booking-week__legend-item--trainer .zjs-booking-week__legend-text {
    color: var(--zjs-secondary);
    font-weight: 700;
}


/* 1.2.5: Klares, eckiges UI ohne abgerundete Ecken.
   Die beiden Trainer-Indikatoren bleiben als echte Punkte rund. */
.zjs-booking-week__nav button,
.zjs-booking-week__status,
.zjs-booking-week__scroller,
.zjs-booking-week__slot,
.zjs-booking-week__debug,
.zjs-booking-week__legend-chip,
.zjs-booking-week__resource-choice,
.zjs-booking-week__resource-select,
.zjs-booking-week__end-choice,
.zjs-booking-week__end-select,
.zjs-booking-week__summary {
    border-radius: 0 !important;
}

.zjs-booking-week__trainer-dot,
.zjs-booking-week__legend-dot {
    background: var(--zjs-free) !important;
    border-radius: 50% !important;
}

/* 1.2.8: Dreistufige Endzeit-UX.
   Nach Startwahl sind spätere Slots zunächst nur verblasst und inaktiv.
   Sobald WooCommerce die Endzeiten geliefert hat, werden nur gültige Endpunkte
   wieder normal/anklickbar. Eine Bereichsfarbe erscheint erst nach der Endwahl. */
.zjs-booking-week__slot--free.is-end-loading,
.zjs-booking-week__slot--free.is-end-unavailable {
    opacity: .34;
    filter: saturate(.35);
    pointer-events: none;
    transform: none !important;
}

.zjs-booking-week__slot--free.is-end-loading {
    cursor: progress;
}

.zjs-booking-week__slot--free.is-end-unavailable {
    cursor: not-allowed;
}

/* Gültige Endzeit-Kandidaten bleiben optisch normale freie Slots.
   Keine gelbe Vorab-Markierung mehr. */
.zjs-booking-week__slot--free.is-end-candidate,
.zjs-booking-week__slot--free.is-end-candidate:visited {
    opacity: 1;
    filter: none;
    background: rgba(47, 111, 78, .10);
    border-color: rgba(47, 111, 78, .28);
    color: var(--zjs-free);
    box-shadow: none;
}

.zjs-booking-week__slot--free.is-end-candidate:hover,
.zjs-booking-week__slot--free.is-end-candidate:focus {
    background: var(--zjs-free);
    border-color: var(--zjs-free);
    color: #fff;
}

/* Ladeindikator direkt neben dem Start-Label. */
.zjs-booking-week__start-loader {
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-left: 3px;
    border: 2px solid rgba(255, 255, 255, .45);
    border-top-color: #fff;
    border-radius: 50% !important;
    box-sizing: border-box;
    animation: zjs-booking-week-spin .7s linear infinite;
    flex: 0 0 auto;
}

@keyframes zjs-booking-week-spin {
    to { transform: rotate(360deg); }
}


/* 1.2.9: Finaler Zustand der Zeitraumwahl.
   Ende bleibt kräftig orange; erst NACH Endauswahl wird der Bereich dazwischen
   in einem helleren Orangeton markiert. Slots hinter der ersten Blockierung
   bleiben dauerhaft verblasst. */
.zjs-booking-week__slot--free.is-in-range {
    background: rgba(253, 115, 30, .16) !important;
    border-color: rgba(253, 115, 30, .38) !important;
    color: var(--zjs-primary) !important;
    box-shadow: inset 0 0 0 1px rgba(253, 115, 30, .08);
}

.zjs-booking-week__slot--free.is-end-selected,
.zjs-booking-week__slot--free.is-end-selected:visited,
.zjs-booking-week__slot--free.is-end-selected:hover,
.zjs-booking-week__slot--free.is-end-selected:focus {
    opacity: 1 !important;
    filter: none !important;
    pointer-events: auto !important;
    background: var(--zjs-primary) !important;
    border-color: var(--zjs-primary) !important;
    color: #fff !important;
    box-shadow: 0 0 0 2px rgba(253, 115, 30, .16) !important;
}

.zjs-booking-week__slot--free.is-after-blocked,
.zjs-booking-week__slot--free.is-after-blocked:hover,
.zjs-booking-week__slot--free.is-after-blocked:focus {
    opacity: .34 !important;
    filter: saturate(.35) !important;
    pointer-events: none !important;
    cursor: not-allowed !important;
    transform: none !important;
}
