/* ── Popup Overlay ─────────────────────────────────── */

.wcsb-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: wcsb-fadeIn 0.2s ease;
}

@keyframes wcsb-fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ── Popup Container ──────────────────────────────── */

.wcsb-popup {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 960px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: wcsb-slideUp 0.25s ease;
}

@keyframes wcsb-slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.wcsb-popup-close {
    position: sticky;
    top: 0;
    float: right;
    margin: 12px 12px 0 0;
    background: #f5f5f5;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.15s;
    z-index: 10;
    line-height: 1;
}

.wcsb-popup-close:hover {
    background: #e0e0e0;
    color: #1a1a1a;
}

/* ── Popup Body ───────────────────────────────────── */

.wcsb-popup-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 400px;
}

.wcsb-popup-left {
    padding: 32px;
    border-right: 1px solid #eee;
}

.wcsb-popup-right {
    padding: 32px;
}

.wcsb-popup-title {
    font-size: 22px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 20px;
    letter-spacing: -0.02em;
}

/* ── Services List ────────────────────────────────── */

.wcsb-popup-services {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.wcsb-svc-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 2px solid #e8e8e8;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s;
}

.wcsb-svc-item:hover {
    border-color: #ccc;
    background: #fafafa;
}

.wcsb-svc-item.wcsb-svc-selected {
    border-color: #1a1a1a;
    background: #f8f8f8;
}

.wcsb-svc-check {
    width: 22px;
    height: 22px;
    border: 2px solid #ccc;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
    font-size: 14px;
    color: transparent;
}

.wcsb-svc-selected .wcsb-svc-check {
    border-color: #1a1a1a;
    background: #1a1a1a;
    color: #fff;
}

.wcsb-svc-info {
    flex: 1;
    min-width: 0;
}

.wcsb-svc-name {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.3;
}

.wcsb-svc-price {
    font-size: 13px;
    color: #888;
    margin-top: 2px;
}

.wcsb-svc-summary {
    margin-top: 6px;
}

.wcsb-svc-booked {
    font-size: 12px;
    font-weight: 600;
    color: #2e7d32;
    display: inline-block;
    background: #edf7ed;
    padding: 3px 8px;
    border-radius: 4px;
}

.wcsb-svc-partial {
    font-size: 12px;
    color: #b77c00;
    display: inline-block;
    background: #fff8e1;
    padding: 3px 8px;
    border-radius: 4px;
}

/* ── Popup Calendar ───────────────────────────────── */

.wcsb-pcal {
    user-select: none;
}

.wcsb-pcal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.wcsb-pcal-title {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
}

.wcsb-pcal-nav {
    background: none;
    border: 1px solid #e2e2e2;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    color: #555;
    transition: all 0.15s;
}

.wcsb-pcal-nav:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.wcsb-pcal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    margin-bottom: 4px;
}

.wcsb-pcal-wd {
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: #999;
    padding: 4px 0;
    text-transform: uppercase;
}

.wcsb-pcal-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.wcsb-pcal-day {
    text-align: center;
    padding: 8px 2px;
    font-size: 13px;
    color: #1a1a1a;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.12s;
    border: none;
    background: none;
    font-weight: 500;
    line-height: 1;
}

.wcsb-pcal-day:hover:not(.wcsb-pcal-day--off):not(.wcsb-pcal-day--empty) {
    background: #f0f0f0;
}

.wcsb-pcal-day--today {
    background: #f5f5f5;
    font-weight: 700;
}

.wcsb-pcal-day--sel {
    background: #1a1a1a !important;
    color: #fff !important;
    font-weight: 700;
}

.wcsb-pcal-day--off {
    color: #ccc;
    cursor: default;
}

.wcsb-pcal-day--empty {
    cursor: default;
}

/* ── Popup Right Hero ──────────────────────────────── */

.wcsb-popup-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 200px;
    text-align: center;
    padding: 20px;
}

.wcsb-popup-hero-img {
    width: 100%;
    height: 220px;
    border-radius: 12px;
    background: linear-gradient(135deg, #f5f5f5, #e8e8e8);
    background-size: cover;
    background-position: center;
    margin-bottom: 16px;
    overflow: hidden;
}

.wcsb-popup-hero-img.wcsb-has-img {
    background-color: transparent;
}

.wcsb-popup-hero-name {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 4px;
}

.wcsb-popup-hero-price {
    font-size: 15px;
    color: #888;
}

.wcsb-popup-hero-text p {
    font-size: 14px;
    color: #999;
    margin: 0;
}

/* ── Time Slots (popup) ───────────────────────────── */

.wcsb-popup-date-title {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 12px;
}

.wcsb-popup-slots {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 20px;
}

.wcsb-pslot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 10px 6px;
    background: #fff;
    border: 1px solid #e2e2e2;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.12s;
}

.wcsb-pslot:hover:not(.wcsb-pslot--full) {
    border-color: #1a1a1a;
}

.wcsb-pslot--sel {
    background: #1a1a1a !important;
    color: #fff !important;
    border-color: #1a1a1a !important;
}

.wcsb-pslot--sel .wcsb-pslot-avail {
    color: rgba(255,255,255,0.6) !important;
}

.wcsb-pslot--full {
    opacity: 0.3;
    cursor: default;
}

.wcsb-pslot-time {
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
}

.wcsb-pslot-avail {
    font-size: 10px;
    color: #888;
}

.wcsb-popup-no-slots {
    padding: 16px;
    text-align: center;
    color: #999;
    font-size: 13px;
    background: #fafafa;
    border-radius: 8px;
    border: 1px dashed #ddd;
}

/* ── Custom Fields ────────────────────────────────── */

.wcsb-popup-custom-fields {
    margin-bottom: 16px;
}

.wcsb-popup-cf-group {
    margin-bottom: 12px;
}

.wcsb-popup-cf-title {
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin-bottom: 6px;
}

.wcsb-popup-cf-field {
    margin-bottom: 8px;
}

.wcsb-popup-cf-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    margin-bottom: 3px;
}

.wcsb-popup-cf-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #e2e2e2;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    box-sizing: border-box;
}

.wcsb-popup-cf-input:focus {
    outline: none;
    border-color: #1a1a1a;
}

/* ── Contact Info ─────────────────────────────────── */

.wcsb-popup-contact h3 {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 12px;
}

.wcsb-popup-fields {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.wcsb-popup-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.wcsb-popup-field input,
.wcsb-popup-field select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e2e2;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.15s;
}

.wcsb-popup-field input:focus {
    outline: none;
    border-color: #1a1a1a;
}

.wcsb-popup-field input.wcsb-error {
    border-color: #dc3232;
}

/* ── People Count ─────────────────────────────────── */

.wcsb-popup-people {
    margin-bottom: 20px;
}

.wcsb-popup-people label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 8px;
}

.wcsb-popup-qty {
    display: flex;
    align-items: center;
    gap: 0;
    width: fit-content;
}

.wcsb-qty-btn {
    width: 38px;
    height: 38px;
    border: 1px solid #e2e2e2;
    background: #f8f8f8;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.12s;
    color: #333;
}

.wcsb-qty-btn:first-child {
    border-radius: 8px 0 0 8px;
}

.wcsb-qty-btn:last-child {
    border-radius: 0 8px 8px 0;
}

.wcsb-qty-btn:hover {
    background: #eee;
}

.wcsb-popup-qty input {
    width: 50px;
    height: 38px;
    border: 1px solid #e2e2e2;
    border-left: none;
    border-right: none;
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    -moz-appearance: textfield;
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

.wcsb-popup-qty input::-webkit-inner-spin-button,
.wcsb-popup-qty input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* ── Submit Button ────────────────────────────────── */

.wcsb-popup-submit {
    margin-top: 4px;
}

/* Uses WooCommerce button class for theme compatibility */
.wcsb-popup-submit .button {
    width: 100%;
    text-align: center;
    display: block;
}

.wcsb-popup-submit .button:disabled {
    opacity: 0.4;
    cursor: default;
}

/* ── Messages ─────────────────────────────────────── */

.wcsb-popup-message {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    text-align: center;
}

.wcsb-popup-message--success {
    background: #edf7ed;
    color: #2e7d32;
}

.wcsb-popup-message--error {
    background: #fdecea;
    color: #c62828;
}

/* ── Loading ──────────────────────────────────────── */

.wcsb-popup-loading {
    text-align: center;
    padding: 20px;
    color: #999;
    font-size: 13px;
}

.wcsb-popup-loading::after {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #ddd;
    border-top-color: #666;
    border-radius: 50%;
    animation: wcsb-spin 0.6s linear infinite;
    margin-left: 6px;
    vertical-align: middle;
}

@keyframes wcsb-spin {
    to { transform: rotate(360deg); }
}

/* ── Trigger Button ────────────────────────────────── */
/* Uses WooCommerce .button class for theme compatibility.
   No custom styling — inherits from theme. */

/* ── Responsive ───────────────────────────────────── */

@media (max-width: 700px) {
    .wcsb-popup-body {
        grid-template-columns: 1fr;
    }
    .wcsb-popup-left {
        border-right: none;
        border-bottom: 1px solid #eee;
        padding: 24px 20px;
    }
    .wcsb-popup-right {
        padding: 24px 20px;
    }
    .wcsb-popup {
        max-height: 95vh;
        border-radius: 12px;
    }
    .wcsb-popup-overlay {
        padding: 10px;
    }
    .wcsb-popup-slots {
        grid-template-columns: repeat(3, 1fr);
    }
}
