/* ===================================================
   KSM Booking Widget — Two-Stage Calendar Form
   =================================================== */

.ksm-booking-widget * {
    box-sizing: border-box;
}

/* ── Card shell ── */
.ksm-bk-card {
    display: flex;
    background: #fff;
    border-radius: 16px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 2px 20px rgba(0,0,0,.09);
    overflow: hidden;
    min-height: 460px;
}

/* ── Left info panel ── */
.ksm-bk-left {
    width: 280px;
    min-width: 180px;
    padding: 28px 22px;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.ksm-bk-back {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #dc2626;
    background: #fff;
    color: #dc2626;
    cursor: pointer;
    font-size: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
}
.ksm-bk-back:hover { background: #fee2e2; }

.ksm-bk-cat {
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 8px;
}

.ksm-bk-headline {
    font-size: 21px;
    font-weight: 800;
    color: #111827;
    margin: 0 0 18px;
    line-height: 1.3;
}

.ksm-bk-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #374151;
    margin-bottom: 10px;
}
.ksm-bk-meta svg { flex-shrink: 0; color: #6b7280; }

.ksm-bk-class-row {
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 700;
    color: #111827;
}

.ksm-bk-class-row .ksm-sel-class {
    display: block;
}

.ksm-bk-programme-select-wrap {
    margin-top: 10px;
    margin-bottom: 14px;
    position: relative;
    z-index: 3;
}
.ksm-bk-programme-select-right { margin-bottom: 18px; }
.ksm-bk-programme-label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .02em;
    color: #6b7280;
    text-transform: uppercase;
}
.ksm-bk-programme-select {
    width: 100%;
    padding: 9px 11px;
    border: 1.5px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    color: #111827;
    background: #fff;
    position: relative;
    z-index: 4;
    pointer-events: auto;
    cursor: pointer;
}
.ksm-bk-programme-select:focus {
    border-color: #dc2626;
    outline: none;
}
.ksm-bk-location-select-wrap[hidden] {
    display: none !important;
}

/* ── Right interactive panel ── */
.ksm-bk-right {
    flex: 1;
    padding: 26px 24px;
    min-width: 0;
    overflow: hidden;
}

.ksm-bk-s-heading {
    font-size: 17px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 18px;
}

/* ── Calendar nav ── */
.ksm-bk-cal-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.ksm-bk-cal-nav button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 26px;
    color: #d1d5db;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}
.ksm-bk-cal-nav button:hover:not([disabled]) {
    background: #fee2e2;
    color: #dc2626;
}
.ksm-bk-cal-nav button[disabled] {
    color: #374151;
    cursor: default;
}
.ksm-bk-cal-title {
    font-weight: 700;
    font-size: 15px;
    color: #111827;
}

/* ── Calendar grid ── */
.ksm-bk-cal-hdr {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    margin-bottom: 2px;
}
.ksm-bk-cal-hdr > div {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    padding: 4px 0;
}

.ksm-bk-cal-body {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}
.ksm-bk-cal-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 1px 0 4px;
    position: relative;
}

.ksm-day-num {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 13px;
    color: #9ca3af;
    font-weight: 400;
}

.ksm-can-book { cursor: pointer; }
.ksm-can-book .ksm-day-num {
    background: #fee2e2;
    color: #dc2626;
    font-weight: 600;
}
.ksm-can-book:hover .ksm-day-num { background: #fca5a5; }

.ksm-fully-booked {
    cursor: not-allowed;
}
.ksm-fully-booked .ksm-day-num {
    background: #f3f4f6;
    color: #9ca3af;
    text-decoration: line-through;
}

.ksm-time-btn.ksm-time-full {
    opacity: 0.72;
    cursor: not-allowed;
    background: #f9fafb;
    border-color: #e5e7eb;
    pointer-events: none;
}
.ksm-time-full-label {
    margin-top: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #b91c1c;
}
.ksm-bk-date-full-msg {
    margin: 12px 0 0;
    padding: 10px 12px;
    border-radius: 8px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
}
.ksm-is-sel .ksm-day-num {
    background: #dc2626 !important;
    color: #fff !important;
}

.ksm-bk-cal-cell.ksm-holiday-closed {
    cursor: not-allowed;
}

.ksm-bk-cal-cell.ksm-holiday-closed .ksm-day-num {
    background: #f3f4f6;
    color: #9ca3af;
    opacity: 0.55;
    font-weight: 500;
}

.ksm-today-dot {
    position: absolute;
    bottom: 1px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #dc2626;
}

/* ── Calendar + time-slot row ── */
.ksm-bk-cal-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.ksm-bk-cal-wrap { flex: 1; min-width: 0; }

.ksm-bk-mobile-selection { display: none; }
.ksm-bk-details-selection { display: none; }

.ksm-bk-holiday-hint {
    margin: 10px 0 0;
    font-size: 12px;
    color: #6b7280;
}

.ksm-bk-timeslot-col {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 108px;
    padding-top: 46px;
}

/* Left-column times list shown under selected date */
.ksm-bk-times-left {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ksm-bk-times-left .ksm-time-btn {
    border: 2px solid #dc2626;
    border-radius: 6px;
    padding: 10px 8px;
    cursor: pointer;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    color: #dc2626;
    background: transparent;
    line-height: 1.3;
}
.ksm-bk-times-left .ksm-time-btn:hover { background: #0000002e; }
.ksm-bk-times-left .ksm-time-sel {
    background: #6b7280 !important;
    border-color: #6b7280 !important;
    color: #fff !important;
}

.ksm-bk-times-left .ksm-time-main { font-weight:700; color: #dc2626; }
.ksm-bk-times-left .ksm-class-title { color: #ffffff; font-size:12px; margin-top:6px; font-weight:600; }

.ksm-bk-times-left .ksm-go-btn {
    background: #f59e0b;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 10px 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    width: 100%;
}
.ksm-bk-times-left .ksm-go-btn:hover { background: #d97706; }

.ksm-time-btn {
    border: 2px solid #dc2626;
    border-radius: 6px;
    padding: 10px 8px;
    cursor: pointer;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    color: #dc2626;
    line-height: 1.3;
}
.ksm-time-btn:hover { background: #fee2e2; }
.ksm-time-sel {
    background: #6b7280 !important;
    border-color: #6b7280 !important;
    color: #fff !important;
}

.ksm-go-btn {
    background: #dc2626;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 10px 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    width: 100%;
}
.ksm-go-btn:hover { background: #b91c1c; }

/* Timezone row removed (not used) */

/* ── Stage 2: personal details form ── */
.ksm-bk-form-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 18px 18px 4px;
    margin-bottom: 14px;
}
.ksm-bk-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}
.ksm-bk-form-row label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}
.ksm-bk-form-row input {
    padding: 9px 11px;
    border: 1.5px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    color: #111827;
    outline: none;
    width: 100%;
}
.ksm-bk-form-row select {
    padding: 9px 11px;
    border: 1.5px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    color: #111827;
    outline: none;
    width: 100%;
    background: #fff;
}
.ksm-bk-form-row input:focus { border-color: #dc2626; }
.ksm-bk-form-row select:focus { border-color: #dc2626; }
.ksm-bk-form-row input::placeholder { color: #9ca3af; font-weight: 400; }

/* Notes row — single column, textarea mirrors inputs exactly */
.ksm-bk-form-row--full {
    grid-template-columns: 1fr;
}

.ksm-bk-dob-row .ksm-em-dob-age {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin-top: 4px;
}

.ksm-bk-dob-row .ksm-em-dob-age input[type="date"] {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
    padding: 9px 11px;
    border: 1.5px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    color: #111827;
    box-sizing: border-box;
}

.ksm-bk-dob-row .ksm-em-dob-age-sep {
    flex-shrink: 0;
    font-weight: 600;
    color: #64748b;
}

.ksm-bk-dob-row .ksm-em-dob-age-value {
    flex-shrink: 0;
    min-width: 2.5em;
    font-weight: 600;
    color: #dc2626;
    white-space: nowrap;
}

.ksm-bk-form-row textarea {
    padding: 9px 11px;
    border: 1.5px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    color: #111827;
    outline: none;
    width: 100%;
    resize: vertical;
    min-height: 80px;
    box-sizing: border-box;
    font-family: inherit;
    line-height: inherit;
}
.ksm-bk-form-row textarea:focus { border-color: #dc2626; }
.ksm-bk-form-row textarea::placeholder { color: #9ca3af; font-weight: 400; }

.ksm-bk-terms {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 12px;
    color: #374151;
    line-height: 1.5;
    margin-bottom: 8px;
}
.ksm-bk-terms input[type="checkbox"] {
    margin-top: 3px;
    flex-shrink: 0;
    accent-color: #dc2626;
    width: auto;
    padding: 0;
    border: none;
}
.ksm-bk-terms a { color: #2563eb; }

.ksm-bk-sub-row { display: flex; justify-content: flex-end; }
.ksm-bk-sub-btn {
    background: #dc2626;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 12px 22px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}
.ksm-bk-sub-btn:hover { background: #b91c1c; }

/* Confirmation card rows: use inline SVG icons consistently */
.ksm-bk-confirm-card .ksm-bk-confirm-row { display:flex; align-items:center; gap:10px; font-size:13px; }
.ksm-bk-confirm-card .ksm-bk-confirm-row svg { width:18px; height:18px; flex-shrink:0; color:#6b7280; }
.ksm-bk-confirm-card .ksm-bk-confirm-row span { font-weight:600; }

/* ── Responsive ── */
@media (max-width: 660px) {
    .ksm-bk-card { flex-direction: column; }
    .ksm-bk-left { width: auto; min-width: auto; border-right: none; border-bottom: 1px solid #e5e7eb; padding: 18px; }
    .ksm-bk-right { padding: 18px 0; }
    .ksm-bk-s1 { padding-left: 18px; padding-right: 18px; }
    .ksm-bk-cal-row {
        flex-direction: column;
        margin-left: -18px;
        margin-right: -18px;
    }
    .ksm-bk-cal-wrap { width: 100%; }
    .ksm-bk-mobile-selection {
        display: block;
        width: 100%;
        padding: 12px 18px 0;
    }
    .ksm-bk-left .ksm-bk-class-row,
    .ksm-bk-left .ksm-bk-date-row { display: none !important; }
    .ksm-bk-times-left { display: none !important; }
    .ksm-booking-widget.ksm-bk-stage-details .ksm-bk-details-selection {
        display: block;
        width: 100%;
        padding: 12px 0 0;
        margin-bottom: 4px;
    }
    .ksm-bk-s2 {
        padding-left: 18px;
        padding-right: 18px;
    }
    .ksm-bk-timeslot-col {
        padding-left: 18px;
        padding-right: 18px;
        flex-direction: column;
        flex-wrap: nowrap;
        padding-top: 12px;
        min-width: 0;
        width: 100%;
        gap: 10px;
    }
    .ksm-bk-timeslot-col .ksm-time-btn {
        border: 2px solid #dc2626;
        border-radius: 6px;
        padding: 10px 8px;
        cursor: pointer;
        text-align: left;
        font-size: 12px;
        font-weight: 700;
        color: #dc2626;
        background: transparent;
        line-height: 1.3;
        width: 100%;
    }
    .ksm-bk-timeslot-col .ksm-time-btn:hover { background: #fee2e2; }
    .ksm-bk-timeslot-col .ksm-time-sel {
        background: #6b7280 !important;
        border-color: #6b7280 !important;
        color: #fff !important;
    }
    .ksm-bk-timeslot-col .ksm-time-main { font-weight: 700; color: #dc2626; }
    .ksm-bk-timeslot-col .ksm-time-sel .ksm-time-main { color: #fff; }
    .ksm-bk-timeslot-col .ksm-class-title { font-size: 12px; margin-top: 6px; font-weight: 600; }
    .ksm-bk-timeslot-col .ksm-time-sel .ksm-class-title { color: #fff; }
    .ksm-bk-timeslot-col .ksm-go-btn {
        background: #f59e0b;
        color: #fff;
        border: none;
        border-radius: 6px;
        padding: 10px 8px;
        cursor: pointer;
        font-size: 13px;
        font-weight: 700;
        width: 100%;
    }
    .ksm-bk-timeslot-col .ksm-go-btn:hover { background: #d97706; }
    .ksm-bk-form-row { grid-template-columns: 1fr; }
}

/* Kanban stage badge */
.ksm-kanban-card { position: relative; }
.ksm-stage-badge { position: absolute; top: 8px; right: 8px; padding: 4px 8px; border-radius: 6px; font-weight:700; font-size:12px; color:#fff; line-height:1; }
.ksm-stage-s1 { background: #0891b2; }
.ksm-stage-s2 { background: #d97706; }
.ksm-stage-s3 { background: #7c3aed; }
.ksm-stage-done { background: #059669; }

/* WP admin filter links spacing when this stylesheet is used in admin context */
.subsubsub {
    margin: 8px 25px 0;
}

/* Class title displayed alongside the times in the right panel */
.ksm-class-title {
    font-size: 12px;
    font-weight: 600;
    color: #ffffff;
    margin-top: 4px;
}

/* ── Booking processing overlay ── */
.ksm-booking-widget {
    position: relative;
}

.ksm-bk-loading-overlay {
    position: absolute;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background: rgba(255, 255, 255, 0.84);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 16px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.22s ease, visibility 0.22s ease;
}

.ksm-bk-loading-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

.ksm-bk-loading-card {
    width: min(100%, 320px);
    padding: 28px 24px 26px;
    border-radius: 16px;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow:
        0 4px 6px rgba(15, 23, 42, 0.04),
        0 20px 48px rgba(15, 23, 42, 0.12);
    text-align: center;
    transform: translateY(6px) scale(0.98);
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.ksm-bk-loading-overlay.is-visible .ksm-bk-loading-card {
    transform: translateY(0) scale(1);
}

.ksm-bk-spinner {
    position: relative;
    width: 52px;
    height: 52px;
    margin: 0 auto 18px;
}

.ksm-bk-spinner-ring,
.ksm-bk-spinner-ring::before {
    position: absolute;
    inset: 0;
    border-radius: 50%;
}

.ksm-bk-spinner-ring {
    border: 3px solid rgba(220, 38, 38, 0.12);
    border-top-color: #dc2626;
    animation: ksmBkWidgetSpin 0.75s linear infinite;
}

.ksm-bk-spinner-ring::before {
    content: '';
    inset: 7px;
    border: 3px solid transparent;
    border-top-color: #f87171;
    animation: ksmBkWidgetSpin 1.1s linear infinite reverse;
}

.ksm-bk-spinner-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    margin: -4px 0 0 -4px;
    border-radius: 50%;
    background: #dc2626;
    animation: ksmBkWidgetPulse 1.2s ease-in-out infinite;
}

.ksm-bk-loading-title {
    margin: 0 0 6px;
    font-size: 17px;
    font-weight: 700;
    color: #111827;
}

.ksm-bk-loading-sub {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: #6b7280;
}

.ksm-bk-loading-dots {
    display: inline-flex;
    gap: 4px;
    margin-top: 14px;
    justify-content: center;
}

.ksm-bk-loading-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #9ca3af;
    animation: ksmBkWidgetDot 1.2s ease-in-out infinite;
}

.ksm-bk-loading-dots span:nth-child(2) { animation-delay: 0.15s; }
.ksm-bk-loading-dots span:nth-child(3) { animation-delay: 0.3s; }

.ksm-bk-sub-btn.is-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
    cursor: wait;
}

.ksm-bk-sub-btn.is-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: ksmBkWidgetSpin 0.65s linear infinite;
}

.ksm-bk-sub-btn:disabled {
    opacity: 0.78;
    cursor: wait;
}

@keyframes ksmBkWidgetSpin {
    to { transform: rotate(360deg); }
}

@keyframes ksmBkWidgetPulse {
    0%, 100% { transform: scale(0.85); opacity: 0.55; }
    50% { transform: scale(1); opacity: 1; }
}

@keyframes ksmBkWidgetDot {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.45; }
    40% { transform: translateY(-4px); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .ksm-bk-spinner-ring,
    .ksm-bk-spinner-ring::before,
    .ksm-bk-spinner-dot,
    .ksm-bk-loading-dots span,
    .ksm-bk-sub-btn.is-loading::after {
        animation: none;
    }
}
