/**
 * Multi-step accordion booking form
 */

.jrb-ms-booking {
    --jrb-ms-primary: var(--zipscheduler-primary, #2f7800);
    --jrb-ms-primary-light: #f0f9eb;
    --jrb-ms-primary-border: #b8d4a8;
    --jrb-ms-text: #1a1a1a;
    --jrb-ms-muted: #6b7280;
    --jrb-ms-border: #e5e7eb;
    max-width: 760px;
    margin: 0 auto;
    padding: 32px 16px 48px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--jrb-ms-text);
}

.jrb-ms-booking .jrb-accordion {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Accordion card */
.jrb-ms-booking .jrb-accordion-item {
    background: #fff;
    border: 1px solid var(--jrb-ms-border);
    border-radius: 12px;
    overflow: hidden;
    transition: border-color 0.25s ease, box-shadow 0.25s ease, opacity 0.25s ease;
}

.jrb-ms-booking .jrb-accordion-item.active {
    border-color: var(--jrb-ms-primary-border);
    box-shadow: 0 2px 12px rgba(47, 120, 0, 0.08);
}

.jrb-ms-booking .jrb-accordion-item.completed {
    border-color: var(--jrb-ms-primary-border);
}

.jrb-ms-booking .jrb-accordion-item.locked {
    opacity: 0.72;
}

.jrb-ms-booking .jrb-accordion-item.locked .jrb-accordion-header {
    cursor: not-allowed;
}

.jrb-ms-booking .jrb-accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    cursor: pointer;
    background: #fff;
    border-bottom: 1px solid transparent;
    transition: background 0.25s ease;
}

.jrb-ms-booking .jrb-accordion-item.active .jrb-accordion-header {
    background: var(--jrb-ms-primary-light);
    border-bottom-color: #eef2e8;
}

.jrb-ms-booking .jrb-accordion-item.completed .jrb-accordion-header {
    background: #fafdfa;
}

.jrb-ms-booking .jrb-accordion-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.jrb-ms-step-badge {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e5e7eb;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
}

.jrb-ms-booking .jrb-accordion-item.active .jrb-ms-step-badge,
.jrb-ms-booking .jrb-accordion-item.completed .jrb-ms-step-badge {
    background: var(--jrb-ms-primary);
    color: #fff;
}

.jrb-ms-booking .jrb-accordion-item.completed .jrb-ms-step-badge {
    font-size: 0;
}

.jrb-ms-booking .jrb-accordion-item.completed .jrb-ms-step-badge::after {
    content: "✓";
    font-size: 15px;
}

.jrb-ms-step-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--jrb-ms-text);
}

.jrb-ms-step-hint {
    font-size: 13px;
    color: var(--jrb-ms-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.jrb-ms-step-hint.is-success {
    color: var(--jrb-ms-primary);
    font-weight: 600;
}

.jrb-ms-step-hint.is-progress {
    color: var(--jrb-ms-primary);
    font-weight: 500;
}

.jrb-ms-booking .jrb-accordion-content {
    display: none;
    padding: 20px;
}

.jrb-ms-booking .jrb-accordion-item.active .jrb-accordion-content {
    display: block;
}

.jrb-ms-booking .jrb-accordion-item.completed:not(.active) .jrb-accordion-content {
    display: none;
}

/* Shared blocks (mirror single-step) */
.jrb-ms-block-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #9ca3af;
    margin: 0 0 14px;
}

.jrb-ms-block {
    margin-bottom: 28px;
    padding-bottom: 28px;
    border-bottom: 1px solid #f3f4f6;
}

.jrb-ms-block:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.jrb-ms-field label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}

.jrb-ms-field label .req {
    color: #dc2626;
}

.jrb-ms-field input,
.jrb-ms-field select,
.jrb-ms-field textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    border: 1px solid var(--jrb-ms-border);
    border-radius: 8px;
    font-size: 15px;
    background: #fafafa;
    color: var(--jrb-ms-text);
}

.jrb-ms-field input:focus,
.jrb-ms-field select:focus,
.jrb-ms-field textarea:focus {
    outline: none;
    border-color: var(--jrb-ms-primary);
    box-shadow: 0 0 0 3px rgba(47, 120, 0, 0.1);
    background: #fff;
}

.jrb-ms-field input.is-filled,
.jrb-ms-field select.is-filled {
    background: var(--jrb-ms-primary-light);
    border-color: var(--jrb-ms-primary-border);
}

.jrb-ms-postcode-readonly {
    background: var(--jrb-ms-primary-light) !important;
    border-color: var(--jrb-ms-primary-border) !important;
    font-weight: 600;
}

.jrb-ms-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.jrb-ms-grid-3 {
    display: grid;
    grid-template-columns: 0.9fr 1.1fr 0.8fr;
    gap: 12px;
}

.jrb-ms-zip-row {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.jrb-ms-zip-row input {
    flex: 1;
    padding: 12px 14px;
    border: 1px solid var(--jrb-ms-border);
    border-radius: 8px;
    font-size: 15px;
}

.jrb-ms-zip-confirmed {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: var(--jrb-ms-primary-light);
    border: 1px solid var(--jrb-ms-primary-border);
    border-radius: 10px;
    margin-bottom: 12px;
}

.jrb-ms-zip-confirmed-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--jrb-ms-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.jrb-ms-zip-confirmed-label {
    font-size: 12px;
    color: var(--jrb-ms-muted);
}

.jrb-ms-zip-confirmed-value {
    font-size: 15px;
    font-weight: 700;
}

.jrb-ms-info-banner {
    padding: 12px 16px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    font-size: 14px;
    color: #1e40af;
    margin-bottom: 20px;
    line-height: 1.45;
}

.jrb-ms-appointment-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.jrb-ms-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.2s ease;
}

.jrb-ms-btn-primary {
    background: var(--jrb-ms-primary);
    color: #fff;
}

.jrb-ms-btn-primary:hover:not(:disabled) {
    filter: brightness(0.92);
}

.jrb-ms-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.jrb-ms-btn-block {
    width: 100%;
    padding: 14px 24px;
    font-size: 16px;
}

.jrb-ms-btn-outline {
    background: #fff;
    color: var(--jrb-ms-primary);
    border: 1px solid var(--jrb-ms-primary-border);
    border-radius: 8px;
    padding: 10px 14px;
    white-space: nowrap;
}

.jrb-ms-form-note {
    text-align: center;
    font-size: 13px;
    color: var(--jrb-ms-muted);
    margin-top: 14px;
}

/* Service cards */
.jrb-ms-services-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.jrb-ms-booking .jrb-service-card {
    position: relative;
    border: 1px solid var(--jrb-ms-border);
    border-radius: 10px;
    padding: 16px 12px 14px;
    text-align: center;
    cursor: pointer;
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.jrb-ms-booking .jrb-service-card.selected {
    border-color: var(--jrb-ms-primary);
    background: var(--jrb-ms-primary-light);
    box-shadow: 0 0 0 1px var(--jrb-ms-primary);
}

.jrb-ms-service-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #f3f4f6;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    color: #6b7280;
    margin-bottom: 8px;
}

.jrb-ms-booking .jrb-service-card.selected .jrb-ms-service-badge {
    background: #e8f5e0;
    color: var(--jrb-ms-primary);
}

.jrb-ms-booking .service-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--jrb-ms-text);
    margin-bottom: 4px;
}

.jrb-ms-booking .service-description {
    font-size: 12px;
    color: var(--jrb-ms-muted);
    line-height: 1.4;
    min-height: 34px;
    margin-bottom: 8px;
}

.jrb-ms-booking .service-price {
    font-size: 22px;
    font-weight: 700;
    color: var(--jrb-ms-primary);
    margin-bottom: 4px;
}

.jrb-ms-booking .service-duration {
    font-size: 12px;
    color: var(--jrb-ms-muted);
}

.jrb-ms-service-selected,
.jrb-ms-booking .selected-badge {
    display: none;
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--jrb-ms-primary);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 999px;
}

.jrb-ms-booking .jrb-service-card.selected .jrb-ms-service-selected,
.jrb-ms-booking .jrb-service-card.selected .selected-badge {
    display: block;
}

/* Booking type toggle */
.jrb-ms-type-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.jrb-ms-type-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border: 1px solid var(--jrb-ms-border);
    border-radius: 10px;
    cursor: pointer;
    background: #fff;
    transition: all 0.2s ease;
}

.jrb-ms-type-option:has(input:checked) {
    border-color: var(--jrb-ms-primary);
    background: var(--jrb-ms-primary-light);
}

.jrb-ms-type-option input {
    accent-color: var(--jrb-ms-primary);
    width: 18px;
    height: 18px;
    margin: 0;
}

.jrb-ms-type-option span {
    font-weight: 600;
    font-size: 15px;
}

/* Address */
.jrb-ms-address-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.jrb-ms-address-row input {
    flex: 1;
}

.jrb-ms-map-placeholder {
    margin: 12px 0;
    padding: 48px 16px;
    text-align: center;
    background: var(--jrb-ms-primary-light);
    border: 2px dashed var(--jrb-ms-primary-border);
    border-radius: 10px;
    color: var(--jrb-ms-muted);
    font-size: 14px;
}

.jrb-ms-map-placeholder:has(+ .jrb-map-container:not([style*="display: none"])) {
    display: none;
}

/* Payment cards */
.jrb-ms-payment-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.jrb-ms-booking .payment-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--jrb-ms-border);
    border-radius: 10px;
    cursor: pointer;
    background: #fff;
    transition: all 0.2s ease;
}

.jrb-ms-booking .payment-option.selected,
.jrb-ms-booking .payment-option:has(input:checked) {
    border-color: var(--jrb-ms-primary);
    background: var(--jrb-ms-primary-light);
}

.jrb-ms-booking .payment-option input {
    margin-top: 3px;
    accent-color: var(--jrb-ms-primary);
}

.jrb-ms-booking .payment-title {
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 4px;
}

.jrb-ms-booking .payment-desc {
    font-size: 13px;
    color: var(--jrb-ms-muted);
}

/* Promo */
.jrb-ms-promo-group {
    margin-top: 12px;
}

.jrb-ms-promo-row {
    display: flex;
    align-items: stretch;
    gap: 10px;
}

.jrb-ms-promo-row input {
    flex: 1;
    min-width: 0;
    box-sizing: border-box;
    height: 46px;
    padding: 0 14px;
    border: 1px solid var(--jrb-ms-border);
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: #fff;
    color: var(--jrb-ms-text);
}

.jrb-ms-promo-row input:focus {
    outline: none;
    border-color: var(--jrb-ms-primary);
    box-shadow: 0 0 0 3px rgba(47, 120, 0, 0.1);
}

.jrb-ms-promo-row input:-webkit-autofill,
.jrb-ms-promo-row input:-webkit-autofill:hover,
.jrb-ms-promo-row input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px #fff inset;
    -webkit-text-fill-color: var(--jrb-ms-text);
    transition: background-color 9999s ease-out 0s;
}

.jrb-ms-promo-row .jrb-promo-apply-btn {
    flex-shrink: 0;
    height: 46px;
    min-height: 46px;
    padding: 0 20px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1;
    white-space: nowrap;
}

.jrb-ms-booking .jrb-promo-message {
    margin-top: 0;
    padding: 0;
    background: transparent;
    border: none;
}

.jrb-ms-booking .jrb-promo-message:not(:empty) {
    margin-top: 10px;
}

.jrb-ms-booking .jrb-promo-message.jrb-ms-message:empty {
    display: none;
    margin: 0;
    padding: 0;
}

.jrb-ms-booking .jrb-promo-message .success-message,
.jrb-ms-booking .jrb-promo-message .error-message {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    margin: 0;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
}

.jrb-ms-booking .jrb-promo-message .success-message {
    background: var(--jrb-ms-primary-light);
    color: var(--jrb-ms-primary);
    border: 1px solid var(--jrb-ms-primary-border);
}

.jrb-ms-booking .jrb-promo-message .error-message {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

/* Price summary — legacy hooks; receipt styles live in style.css */
.jrb-ms-price-summary:not(.jrb-discount-receipt) {
    margin-top: 16px;
    padding: 16px;
    background: var(--jrb-ms-primary-light);
    border: 1px solid var(--jrb-ms-primary-border);
    border-radius: 10px;
}

.jrb-ms-booking .jrb-discount-receipt {
    margin-top: 14px;
}

.jrb-ms-price-summary:not(.jrb-discount-receipt) .summary-head {
    font-weight: 700;
    color: var(--jrb-ms-primary);
    margin-bottom: 12px;
    font-size: 14px;
}

.jrb-ms-price-summary:not(.jrb-discount-receipt) .price-row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    margin-bottom: 6px;
}

.jrb-ms-price-summary:not(.jrb-discount-receipt) .price-row.discount span:last-child {
    color: #dc2626;
}

.jrb-ms-price-summary:not(.jrb-discount-receipt) .price-row.total {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--jrb-ms-primary-border);
    font-size: 16px;
    font-weight: 700;
    color: var(--jrb-ms-primary);
}

/* Checkbox */
.jrb-ms-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 14px;
    cursor: pointer;
    margin-bottom: 12px;
}

.jrb-ms-checkbox input {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: var(--jrb-ms-primary);
    flex-shrink: 0;
}

.jrb-ms-consent-note {
    margin: 8px 0 0 28px;
    font-size: 12px;
    color: var(--jrb-ms-muted);
}

/* Trust badges */
.jrb-ms-trust-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px 24px;
    margin-top: 16px;
    font-size: 13px;
    color: var(--jrb-ms-muted);
}

.jrb-ms-trust-badges span::before {
    content: "✓ ";
    color: var(--jrb-ms-primary);
    font-weight: 700;
}

.jrb-ms-hidden {
    display: none !important;
}

.jrb-ms-message {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    margin-top: 12px;
}

.jrb-ms-message.error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.jrb-ms-message.success {
    background: var(--jrb-ms-primary-light);
    color: var(--jrb-ms-primary);
    border: 1px solid var(--jrb-ms-primary-border);
}

.jrb-ms-booking .jrb-spinner {
    border: 3px solid #f3f4f6;
    border-top: 3px solid var(--jrb-ms-primary);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    animation: jrb-ms-spin 0.8s linear infinite;
    margin: 0 auto 10px;
}

.jrb-ms-field .flatpickr-input[readonly],
.jrb-ms-field .jrb-ms-date-display {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    border: 1px solid var(--jrb-ms-border);
    border-radius: 8px;
    font-size: 15px;
    background: #fafafa;
    color: var(--jrb-ms-text);
    cursor: pointer;
}

.jrb-ms-field .flatpickr-input.is-filled,
.jrb-ms-field .jrb-ms-date-display.is-filled {
    background: var(--jrb-ms-primary-light);
    border-color: var(--jrb-ms-primary-border);
}

@keyframes jrb-ms-spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 640px) {
    .jrb-ms-appointment-row,
    .jrb-ms-grid-2,
    .jrb-ms-grid-3,
    .jrb-ms-services-row,
    .jrb-ms-payment-row,
    .jrb-ms-type-row {
        grid-template-columns: 1fr;
    }

    .jrb-ms-zip-row {
        flex-direction: column;
    }

    .jrb-ms-step-hint {
        display: none;
    }
}
