/* ============================================================
   WF Booking — Frontend Styles
   ============================================================ */

/* ── Spinner animation ────────────────────────────────────── */
@keyframes wf-bk-spin {
    to { transform: rotate(360deg); }
}

.wf-bk-spinner {
    animation: wf-bk-spin 0.8s linear infinite;
    display: block;
}

/* ── Collapse the empty wf-field-wrap the parent renders before booking fields.
   When wf_waf_render_field_html returns true, the parent closes its wf-field-wrap
   immediately (empty) then fires our do_action outside it. That empty div would
   consume a flex slot and break column layout. ────────────────────────────────── */
.wf-fields-grid .wf-field-wrap:empty {
    display: none;
}

/* ── Booking field wrappers ───────────────────────────────── */
.wf-booking-date-wrap,
.wf-booking-time-wrap {
    box-sizing: border-box;
}

.wf-booking-date-wrap .wf-input-wrap,
.wf-booking-time-wrap .wf-input-wrap {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* ── Calendar — fills its container ──────────────────────── */
.wf-bk-calendar {
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    width: 100%;
    position: relative;
    user-select: none;
    box-sizing: border-box;
}

/* ── Calendar header ──────────────────────────────────────── */
.wf-bk-cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: #f9f9fb;
    border-bottom: 1px solid #e8e8ec;
}

.wf-bk-cal-month-label {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a2e;
    text-transform: capitalize;
}

.wf-bk-cal-nav {
    background: none;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #555;
    transition: background 0.15s, border-color 0.15s;
    padding: 0;
    flex-shrink: 0;
}

.wf-bk-cal-nav:hover {
    background: #f0f0f4;
    border-color: #bbb;
}

/* ── Weekday headers ──────────────────────────────────────── */
.wf-bk-cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    padding: 6px 8px 4px;
    background: #f9f9fb;
}

.wf-bk-cal-weekdays span {
    font-size: 11px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── Day grid ─────────────────────────────────────────────── */
.wf-bk-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    padding: 6px 8px 10px;
    gap: 3px;
    transition: opacity 0.2s;
}

/* ── Day buttons ──────────────────────────────────────────── */
.wf-bk-day {
    /* aspect-ratio: 1 requires iOS Safari 15+.
       min-height provides a usable fallback on older devices. */
    aspect-ratio: 1;
    min-height: 34px;
    border-radius: 7px;
    border: 1.5px solid transparent;
    background: none;
    font-size: 13px;
    font-weight: 500;
    cursor: default;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 2px;
    position: relative;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
    padding: 0;
    color: #ccc;
    line-height: 1;
    min-width: 0;
    box-sizing: border-box;
}

.wf-bk-day-empty {
    pointer-events: none;
}

.wf-bk-day-past,
.wf-bk-day-inactive,
.wf-bk-day-too_far,
.wf-bk-day-blocked {
    color: #d0d0d8;
}

.wf-bk-day-blocked {
    text-decoration: line-through;
}

.wf-bk-day-full {
    color: #bbb;
}

.wf-bk-day-available {
    color: #1a1a2e;
    cursor: pointer;
    border-color: #e0e0e8;
}

.wf-bk-day-available:hover:not(.wf-bk-day-selected) {
    background: #f0f0f8;
    border-color: #c0c0d0;
}

.wf-bk-day-selected {
    border-color: transparent;
}

.wf-bk-day-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    display: block;
}

.wf-bk-day-dot-full {
    background: #e0e0e8;
}

/* ── Calendar overlay states ──────────────────────────────── */
.wf-bk-cal-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 10px;
}

.wf-bk-cal-no-avail {
    text-align: center;
    font-size: 13px;
    color: #888;
    padding: 12px 16px 14px;
    border-top: 1px solid #f0f0f4;
}

/* ── Resource picker ──────────────────────────────────────── */
.wf-bk-resource-picker {
    margin-bottom: 12px;
}

.wf-bk-resource-picker-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.wf-bk-resource-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.wf-bk-resource-btn {
    border: 1.5px solid #e0e0e8;
    border-radius: 8px;
    background: #fff;
    padding: 8px 14px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #1a1a2e;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
    line-height: 1.3;
    min-width: 80px;
}

.wf-bk-resource-btn small {
    font-size: 11px;
    color: #999;
    font-weight: 400;
}

.wf-bk-resource-btn:hover:not(.wf-bk-resource-selected) {
    background: #f4f4fa;
    border-color: #c0c0d8;
}

.wf-bk-resource-selected {
    border-color: transparent;
}

.wf-bk-resource-selected small {
    color: rgba(255, 255, 255, 0.8);
}

/* ── Slots wrapper — fills container ─────────────────────── */
.wf-bk-slots-grid {
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    background: #fff;
    width: 100%;
    min-height: 80px;
    overflow: hidden;
    box-sizing: border-box;
}

/* ── Placeholder / empty / loading ───────────────────────── */
.wf-bk-slots-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 24px 16px;
    color: #aaa;
    font-size: 13px;
    text-align: center;
}

.wf-bk-slots-placeholder svg {
    opacity: 0.45;
}

.wf-bk-slots-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    color: #aaa;
}

.wf-bk-slots-empty {
    padding: 20px 16px;
    text-align: center;
    font-size: 13px;
    color: #888;
}

/* ── Slot list — CSS Grid, auto-fill ─────────────────────── */
.wf-bk-slots-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 8px;
    padding: 12px;
    box-sizing: border-box;
}

/* ── Individual slot button ───────────────────────────────── */
.wf-bk-slot {
    border: 1.5px solid #e0e0e8;
    border-radius: 8px;
    background: #fff;
    padding: 10px 6px;
    cursor: pointer;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
    width: 100%;
    box-sizing: border-box;
}

.wf-bk-slot:hover:not([disabled]):not(.wf-bk-slot-selected) {
    background: #f4f4fa;
    border-color: #c0c0d8;
}

.wf-bk-slot-selected {
    border-color: transparent;
}

.wf-bk-slot[disabled] {
    cursor: not-allowed;
    opacity: 0.55;
}

.wf-bk-slot-time {
    font-size: 12px;
    font-weight: 600;
    color: inherit;
    display: block;
    line-height: 1.3;
}

.wf-bk-slot-remain {
    font-size: 10px;
    color: inherit;
    opacity: 0.75;
    display: block;
}

.wf-bk-slot-full {
    font-size: 10px;
    color: #c0c0c8;
    display: block;
}

/* ── Validation error ─────────────────────────────────────── */
.wf-bk-field-error {
    color: #c0392b;
    font-size: 12px;
    margin: 6px 0 0;
    line-height: 1.4;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 480px) {
    .wf-bk-slots-list {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }

    .wf-bk-resource-btn {
        min-width: 60px;
        padding: 6px 10px;
    }
}

/* ═══════════════════════════════════════════════════════════
   WAITLIST MINI-FORM
   ═══════════════════════════════════════════════════════════ */

/* ── Slot lleno con botón de lista de espera ──────────────── */
.wf-bk-slot-full-wrap {
    border: 1.5px solid #e8e8ec;
    border-radius: 8px;
    background: #fafafa;
    padding: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    box-sizing: border-box;
}

.wf-bk-wl-join-btn {
    background: none;
    border: 1px solid #c0c0d0;
    border-radius: 6px;
    font-size: 10px;
    color: #666;
    cursor: pointer;
    padding: 3px 8px;
    line-height: 1.4;
    transition: background .12s, color .12s;
    width: 100%;
}

.wf-bk-wl-join-btn:hover {
    background: #1a1a2e;
    color: #fff;
    border-color: #1a1a2e;
}

/* ── Panel de lista de espera ─────────────────────────────── */
.wf-bk-wl-panel {
    display: none;
    border: 1.5px solid #e0e0e8;
    border-radius: 10px;
    background: #fff;
    overflow: hidden;
    margin-top: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,.08);
}

.wf-bk-wl-panel.is-open {
    display: block;
}

.wf-bk-wl-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #1a1a2e;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
}

.wf-bk-wl-close {
    background: none;
    border: none;
    color: rgba(255,255,255,.7);
    cursor: pointer;
    padding: 2px;
    display: flex;
    align-items: center;
}

.wf-bk-wl-close:hover { color: #fff; }

.wf-bk-wl-panel-body {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wf-bk-wl-label {
    font-size: 12px;
    font-weight: 600;
    color: #555;
    display: block;
    margin-bottom: 2px;
}

.wf-bk-wl-input {
    width: 100%;
    border: 1px solid #c3c4c7;
    border-radius: 6px;
    font-size: 13px;
    color: #1a1a2e;
    padding: 8px 10px;
    box-sizing: border-box;
}

.wf-bk-wl-input:focus {
    border-color: #2271b1;
    outline: 2px solid rgba(34,113,177,.2);
    outline-offset: 0;
}

.wf-bk-wl-panel-msg {
    padding: 10px 14px;
    font-size: 13px;
    line-height: 1.5;
}

.wf-bk-wl-msg-ok    { background: #f0fdf4; color: #065f46; }
.wf-bk-wl-msg-error { background: #fff5f5; color: #991b1b; }

.wf-bk-wl-panel-footer {
    padding: 10px 14px;
    border-top: 1px solid #e8e8ec;
}

.wf-bk-wl-submit {
    width: 100%;
    background: #1a1a2e;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    padding: 10px;
    cursor: pointer;
    transition: background .12s;
}

.wf-bk-wl-submit:hover:not(:disabled) { background: #2e2e52; }
.wf-bk-wl-submit:disabled { opacity: .6; cursor: not-allowed; }
