/* Crystalsutraa Booking - Frontend Styles */
/* Uses theme CSS variables when available, with graceful fallbacks. */

/* Login gate / status notifications / My Appointments */
.csb-login-required {
    padding: 12px 0;
}
.csb-login-required-inner {
    max-width: 560px;
    margin: 0 auto;
    background: var(--csb-surface, #ffffff);
    border: 1px solid var(--csb-border, #e5dcc8);
    border-radius: var(--csb-radius, 10px);
    padding: 28px;
    text-align: center;
}
.csb-login-required-inner h2 {
    margin: 0 0 10px;
    color: var(--csb-text, #1a1a2e);
}
.csb-login-required-inner p {
    color: var(--csb-muted, #77726a);
    margin: 0 0 18px;
}
.csb-login-required-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}
.csb-login-required-actions .csb-btn {
    text-decoration: none;
}
.csb-table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    background: var(--csb-surface, #ffffff);
    border: 1px solid var(--csb-border, #e5dcc8);
    border-radius: var(--csb-radius, 10px);
    overflow: hidden;
}
.csb-table th,
.csb-table td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--csb-border, #e5dcc8);
    font-size: 14px;
}
.csb-table th {
    background: var(--csb-bg, #faf7f2);
    font-weight: 600;
}
.csb-table tbody tr:last-child td {
    border-bottom: none;
}
.csb-status-msg {
    margin: 12px 0 0;
    font-size: 14px;
}
.csb-status-loading {
    color: var(--csb-muted, #77726a);
}
.csb-status-error {
    color: var(--csb-danger, #c62828);
}
@media (max-width: 600px) {
    .csb-table {
        display: block;
        overflow-x: auto;
    }
}

:root {
    --csb-primary: var(--wp--preset--color--primary, var(--wp--custom--color--primary, #8b6914));
    --csb-primary-dark: var(--wp--custom--color--primary-dark, #6d5210);
    --csb-accent: var(--wp--preset--color--tertiary, #b8860b);
    --csb-bg: var(--wp--preset--color--pale-pink, #faf7f2);
    --csb-surface: #ffffff;
    --csb-border: var(--wp--preset--color--light-grey-primary, #e5dcc8);
    --csb-text: var(--wp--preset--color--foreground, #1a1a2e);
    --csb-muted: #77726a;
    --csb-success: #2e7d32;
    --csb-danger: #c62828;
    --csb-radius: var(--wp--custom--radius, 10px);
    --csb-font: inherit;
    --csb-btn-bg: var(--wp--preset--color--primary, #8b6914);
    --csb-btn-color: #ffffff;
}

.csb-booking {
    font-family: var(--csb-font);
    max-width: 860px;
    margin: 0 auto;
    color: var(--csb-text);
    line-height: 1.6;
}

.csb-booking *,
.csb-booking *::before,
.csb-booking *::after {
    box-sizing: border-box;
}

/* ---------- Step Indicator ---------- */
.csb-booking-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin-bottom: 28px;
    padding: 14px;
    background: var(--csb-surface);
    border: 1px solid var(--csb-border);
    border-radius: var(--csb-radius);
}

.csb-step {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--csb-muted);
    padding: 7px 14px;
    border-radius: 999px;
    background: var(--csb-bg);
    border: 1px solid var(--csb-border);
    cursor: default;
    white-space: nowrap;
}

.csb-step-active {
    background: var(--csb-primary);
    color: #fff;
    border-color: var(--csb-primary);
}

/* ---------- Panels ---------- */
.csb-booking-main .csb-panel-heading {
    font-size: 24px;
    font-weight: 700;
    color: var(--csb-text);
    margin: 0 0 20px;
    text-align: center;
}

.csb-step-panel {
    background: var(--csb-surface);
    border: 1px solid var(--csb-border);
    border-radius: var(--csb-radius);
    padding: 28px;
}

/* ---------- Service Cards ---------- */
.csb-services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.csb-service-card {
    border: 2px solid var(--csb-border);
    border-radius: var(--csb-radius);
    padding: 18px;
    cursor: pointer;
    transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
    background: var(--csb-bg);
    text-align: center;
    outline: none;
}

.csb-service-card:hover,
.csb-service-card:focus-visible {
    border-color: var(--csb-primary);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .08);
}

.csb-service-card.csb-selected {
    border-color: var(--csb-primary);
    background: #fffef8;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--csb-primary) 22%, transparent);
}

.csb-service-card.csb-selected {
    box-shadow: 0 0 0 3px rgba(139, 105, 20, .22);
}

.csb-service-img {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 10px;
    display: block;
}

.csb-service-img-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--csb-primary);
    color: #fff;
    font-size: 30px;
    font-weight: 700;
}

.csb-service-name {
    font-size: 18px;
    margin: 0 0 6px;
    color: var(--csb-text);
}

.csb-service-desc {
    font-size: 13px;
    color: var(--csb-muted);
    margin: 0 0 12px;
    min-height: 2.4em;
}

.csb-service-meta {
    display: flex;
    justify-content: center;
    gap: 14px;
    font-size: 13px;
}

.csb-service-price {
    font-weight: 700;
    color: var(--csb-primary);
}

.csb-service-duration {
    color: var(--csb-muted);
}

/* ---------- Form Fields ---------- */
.csb-field {
    margin-bottom: 18px;
}

.csb-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 14px;
}

.csb-required {
    color: var(--csb-danger);
}

.csb-field input,
.csb-field textarea,
.csb-booking select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--csb-border);
    border-radius: 8px;
    background: var(--csb-bg);
    color: var(--csb-text);
    font-size: 15px;
    font-family: inherit;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.csb-field input:focus,
.csb-field textarea:focus,
.csb-booking select:focus {
    outline: none;
    border-color: var(--csb-primary);
    box-shadow: 0 0 0 3px rgba(139, 105, 20, .15);
}

.csb-field textarea {
    min-height: 90px;
    resize: vertical;
}

.csb-field .csb-error {
    display: none;
    color: var(--csb-danger);
    font-size: 13px;
    margin-top: 5px;
}

.csb-field.csb-field-error input,
.csb-field.csb-field-error textarea {
    border-color: var(--csb-danger);
}

.csb-field.csb-field-error .csb-error {
    display: block;
}

/* ---------- Datepicker ---------- */
.csb-datepicker {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    background: var(--csb-bg);
    border: 1px solid var(--csb-border);
    border-radius: var(--csb-radius);
    padding: 16px;
    box-sizing: border-box;
    overflow: hidden;
}

.csb-dp-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.csb-dp-title {
    font-weight: 700;
    font-size: 15px;
}

.csb-dp-nav {
    background: none;
    border: 1px solid var(--csb-border);
    border-radius: 6px;
    width: 32px;
    height: 32px;
    font-size: 16px;
    cursor: pointer;
    color: var(--csb-text);
}

.csb-dp-nav:hover {
    border-color: var(--csb-primary);
    color: var(--csb-primary);
}

#csb-booking .csb-dp-weekdays,
#csb-booking .csb-dp-grid {
    display: grid !important;
    grid-template-columns: repeat(7, 1fr) !important;
    gap: 4px;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.csb-dp-weekdays span {
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--csb-muted);
    padding: 4px 0;
}

#csb-booking .csb-dp-day {
    min-width: 0;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    font-size: 13px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: var(--csb-surface);
    cursor: default;
    color: var(--csb-muted);
    margin: 0;
    padding: 0;
    line-height: 1.2;
    text-align: center;
    vertical-align: middle;
    overflow: hidden;
    -webkit-appearance: none;
    appearance: none;
}

#csb-booking .csb-dp-day-empty {
    background: transparent;
    border-color: transparent;
}

.csb-dp-day-available {
    background: var(--csb-surface);
    border-color: var(--csb-border);
    cursor: pointer;
    color: var(--csb-text);
    font-weight: 600;
}

.csb-dp-day-available:hover,
.csb-dp-day-available:focus-visible {
    border-color: var(--csb-primary);
    background: color-mix(in srgb, var(--csb-primary) 10%, white);
    background: #fdf6e3;
}

.csb-dp-day-selected {
    background: var(--csb-primary) !important;
    color: #fff !important;
    border-color: var(--csb-primary) !important;
}

.csb-dp-day-today {
    box-shadow: inset 0 0 0 1px var(--csb-accent);
}

.csb-dp-day-unavailable {
    opacity: .45;
    text-decoration: line-through;
}

/* ---------- Time Slots ---------- */
.csb-time-slots {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
    max-height: 260px;
    overflow-y: auto;
    padding: 6px;
}

.csb-slot {
    padding: 12px 8px;
    border: 1px solid var(--csb-border);
    border-radius: 8px;
    background: var(--csb-surface);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    color: var(--csb-text);
    transition: border-color .2s ease, background .2s ease;
}

.csb-slot:hover,
.csb-slot:focus-visible {
    border-color: var(--csb-primary);
    outline: none;
}

.csb-slot.csb-slot-selected {
    background: var(--csb-primary);
    border-color: var(--csb-primary);
    color: #fff;
}

.csb-slot:disabled {
    opacity: .4;
    cursor: not-allowed;
    text-decoration: line-through;
    background: var(--csb-bg);
}

.csb-status-msg {
    text-align: center;
    color: var(--csb-muted);
    font-size: 14px;
    margin: 12px 0 0;
}

/* ---------- Summary ---------- */
.csb-summary {
    max-width: 440px;
    margin: 0 auto;
}

.csb-summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--csb-border);
}

.csb-summary-item:last-child {
    border-bottom: none;
}

.csb-summary-label {
    color: var(--csb-muted);
    font-size: 14px;
}

.csb-summary-value {
    font-weight: 700;
    font-size: 15px;
}

.csb-summary-total {
    border-top: 2px solid var(--csb-primary);
    border-bottom: none !important;
    margin-top: 6px;
    padding-top: 16px;
}

.csb-summary-total .csb-summary-value {
    color: var(--csb-primary);
    font-size: 20px;
}

/* ---------- Navigation Buttons ---------- */
.csb-nav-buttons {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 22px;
    flex-wrap: wrap;
}

.csb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 13px 28px;
    border: 1px solid var(--csb-primary);
    border-radius: 999px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    text-decoration: none;
    transition: background .2s ease, color .2s ease, transform .1s ease;
}

.csb-btn:hover {
    transform: translateY(-1px);
}

.csb-btn:focus-visible {
    outline: 3px solid rgba(139, 105, 20, .4);
    outline-offset: 2px;
}

.csb-btn-primary,
.cta-btn {
    background: var(--csb-primary);
    color: #fff;
    border-color: var(--csb-primary);
}

.csb-btn-primary:hover,
.cta-btn:hover {
    background: var(--csb-primary-dark);
    color: #fff;
}

.csb-btn-back {
    background: transparent;
    color: var(--csb-text);
}

.csb-btn-back:hover {
    background: var(--csb-bg);
    color: var(--csb-text);
    transform: none;
}

/* ---------- Messages ---------- */
.csb-form-error {
    color: var(--csb-danger);
    font-weight: 600;
    text-align: center;
    margin: 14px 0 0;
    min-height: 1em;
}

.csb-form-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 22px;
    color: var(--csb-primary);
    font-weight: 600;
}

.csb-form-loading span::after {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-left: 8px;
    border: 2px solid var(--csb-border);
    border-top-color: var(--csb-primary);
    border-radius: 50%;
    animation: csb-spin .7s linear infinite;
    vertical-align: middle;
}

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

/* ---------- Confirmation ---------- */
.csb-confirmation {
    background: var(--csb-surface);
    border: 1px solid var(--csb-border);
    border-radius: var(--csb-radius);
    padding: 44px 24px;
    text-align: center;
}

.csb-confirmation-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 18px;
    border-radius: 50%;
    background: var(--csb-success);
    color: #fff;
    font-size: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.csb-confirmation h2 {
    font-size: 26px;
    margin: 0 0 8px;
    color: var(--csb-text);
}

.csb-confirmation-details {
    max-width: 420px;
    margin: 22px auto;
    text-align: left;
    background: var(--csb-bg);
    border: 1px solid var(--csb-border);
    border-radius: 10px;
    padding: 18px 22px;
}

.csb-confirmation-details p {
    margin: 6px 0;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
}

.csb-confirmation-details strong {
    font-weight: 700;
}

.csb-confirm-booking-id {
    font-weight: 700;
    color: var(--csb-primary);
    letter-spacing: .04em;
    margin: 10px 0 0;
}

.csb-confirmation-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

/* ---------- Accessibility: reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .csb-service-card,
    .csb-btn,
    .csb-slot {
        transition: none;
    }
    .csb-form-loading span::after {
        animation: none;
    }
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .csb-booking-main .csb-panel-heading {
        font-size: 20px;
    }
    .csb-step-panel {
        padding: 20px 16px;
    }
    .csb-services-grid {
        grid-template-columns: 1fr;
    }
    .csb-time-slots {
        grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
        max-height: 300px;
    }
    .csb-nav-buttons {
        flex-direction: column-reverse;
    }
    .csb-btn {
        width: 100%;
        padding: 14px;
    }
    .csb-confirmation {
        padding: 34px 16px;
    }
}

@media (max-width: 480px) {
    .csb-booking-steps {
        gap: 4px;
        padding: 10px;
    }
    .csb-step {
        font-size: 10px;
        padding: 6px 10px;
    }
    .csb-datepicker {
        padding: 10px;
    }
    .csb-confirmation-details p {
        font-size: 13px;
    }
}

/* ---------- Guest note ---------- */
.csb-guest-note {
    background: rgba(139, 105, 20, 0.08);
    border: 1px dashed var(--csb-primary, #8b6914);
    border-radius: var(--csb-radius, 10px);
    padding: 14px 16px;
    margin-bottom: 18px;
    color: #5a4a20;
    font-size: 14px;
}
.csb-guest-note p {
    margin: 0 0 6px;
}
.csb-guest-note p:last-child {
    margin-bottom: 0;
}
.csb-guest-note-actions a {
    font-weight: 600;
    color: var(--csb-primary, #8b6914);
    text-decoration: underline;
}

/* ---------- My Appointments (WooCommerce account + shortcode) ---------- */
.csb-my-appointments-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.csb-my-appointments-head h2 {
    margin: 0;
}
.csb-my-appointments .csb-table th,
.csb-my-appointments .csb-table td {
    padding: 10px 12px;
}
.woocommerce-account .csb-my-appointments .csb-table {
    max-width: 100%;
    overflow-x: auto;
    display: block;
}
@media (max-width: 600px) {
    .csb-my-appointments-head .csb-btn {
        width: auto;
    }
}