/**
 * Silva Customer Portal - Booking Modal Styles
 * Mobile-first bottom sheet with compact steps
 */

.silva-booking-btn {
    background: #014385;
    color: #ffffff;
    padding: 14px 28px;
    border-radius: 8px;
    border: none;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(1, 67, 133, 0.15);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
}

.silva-booking-btn:hover {
    background: #012d5a;
}

.silva-booking-btn:focus-visible {
    outline: 3px solid rgba(1, 67, 133, 0.4);
    outline-offset: 2px;
}

body.silva-modal-open {
    overflow: hidden !important;
}

.silva-booking-modal,
#silva-portal-booking-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    align-items: flex-end;
    justify-content: center;
    z-index: var(--z-booking);
    padding: 0;
    display: none;
    overflow: hidden;
}

.silva-booking-modal.is-open,
#silva-portal-booking-modal.is-open,
body.silva-modal-open .silva-booking-modal.is-open,
body.silva-modal-open #silva-portal-booking-modal.is-open {
    display: flex;
    z-index: var(--z-booking-open);
}

.silva-booking-modal-inner {
    background: #fff;
    width: 100%;
    max-width: 520px;
    max-height: min(92dvh, 720px);
    border-radius: 16px 16px 0 0;
    position: relative;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.18);
    overflow: hidden;
}

@media (min-width: 769px) {
    .silva-booking-modal,
    #silva-portal-booking-modal {
        align-items: center;
        padding: 16px;
    }

    .silva-booking-modal-inner {
        border-radius: 12px;
        max-height: 90vh;
    }
}

.booking-modal-header {
    flex-shrink: 0;
    padding: 16px 48px 12px 16px;
    border-bottom: 1px solid #e5e7eb;
    position: relative;
}

.booking-modal-header h2 {
    margin: 0 0 4px;
    font-size: 1.25rem;
    font-weight: 700;
    color: #111827;
}

.booking-modal-subtitle {
    margin: 0;
    font-size: 0.875rem;
    color: #6b7280;
    line-height: 1.4;
}

.booking-step-indicator {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.booking-step-indicator__pill {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 999px;
    background: #f3f4f6;
    color: #6b7280;
}

.booking-step-indicator__pill.is-active {
    background: #dbeafe;
    color: #1d4ed8;
}

.booking-modal-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px;
}

.booking-modal-footer {
    flex-shrink: 0;
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid #e5e7eb;
    background: #fff;
}

.booking-modal-footer .silva-booking-btn,
.booking-modal-footer .booking-back-btn {
    flex: 1;
    min-height: 48px;
}

.booking-back-btn {
    background: #f3f4f6;
    color: #374151;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

.silva-close {
    position: absolute;
    right: 12px;
    top: 12px;
    background: #f3f4f6;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #374151;
    line-height: 1;
    border-radius: 50%;
    z-index: 11;
}

.silva-close:hover {
    background: #e5e7eb;
}

.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e5e7eb;
    border-top-color: #1e73be;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.field-error {
    display: none;
    color: #dc2626;
    font-size: 0.8125rem;
    margin-top: 4px;
    font-weight: 500;
}

.booking-field {
    margin-bottom: 14px;
}

.booking-field label,
.silva-booking-modal label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

.booking-field-hint {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 4px;
}

.silva-booking-modal input[type="text"],
.silva-booking-modal input[type="email"],
.silva-booking-modal input[type="tel"],
.silva-booking-modal input[type="date"],
.silva-booking-modal select,
.silva-booking-modal textarea {
    width: 100%;
    padding: 12px 14px;
    box-sizing: border-box;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.silva-booking-modal textarea {
    min-height: 72px;
    resize: vertical;
    line-height: 1.45;
}

.silva-booking-modal input:focus,
.silva-booking-modal select:focus,
.silva-booking-modal textarea:focus {
    outline: none;
    border-color: #1e73be;
    box-shadow: 0 0 0 3px rgba(30, 115, 190, 0.12);
}

.silva-booking-modal input.field-invalid,
.silva-booking-modal select.field-invalid,
.silva-booking-modal textarea.field-invalid {
    border-color: #f87171;
}

.silva-booking-modal .silva-submit {
    background: #1e73be;
    color: #fff;
    touch-action: manipulation;
}

.silva-booking-modal .silva-submit:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* Contact summary — skips retyping for logged-in users */
.booking-contact-summary {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    margin-bottom: 14px;
}

.booking-contact-summary__text {
    font-size: 0.875rem;
    color: #0c4a6e;
    line-height: 1.45;
}

.booking-contact-edit {
    background: none;
    border: none;
    color: #1d4ed8;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    padding: 0;
}

.booking-contact-fields[hidden] {
    display: none !important;
}

.booking-address-saved {
    padding: 12px 14px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.875rem;
    color: #374151;
    margin-bottom: 8px;
}

.booking-address-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #4b5563;
    margin-bottom: 14px;
    cursor: pointer;
}

.booking-address-toggle input {
    width: auto;
    margin: 0;
}

/* Time slot chips — one tap instead of dropdown */
.booking-time-slots {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 8px;
}

@media (min-width: 480px) {
    .booking-time-slots {
        grid-template-columns: repeat(4, 1fr);
    }
}

.booking-time-slot {
    appearance: none;
    border: 1.5px solid #d1d5db;
    background: #fff;
    border-radius: 8px;
    padding: 10px 6px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    text-align: center;
    min-height: 44px;
    transition: all 0.15s;
}

.booking-time-slot:hover {
    border-color: #93c5fd;
    background: #eff6ff;
}

.booking-time-slot.is-selected {
    border-color: #1e73be;
    background: #1e73be;
    color: #fff;
}

.booking-time-slots__empty,
.booking-time-slots__loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 16px;
    font-size: 0.875rem;
    color: #6b7280;
}

.booking-time-slots__loading {
    color: #1e73be;
}

/* Optional project notes — collapsed by default */
.booking-notes-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f9fafb;
    border: 1px dashed #d1d5db;
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    margin-bottom: 0;
}

.booking-notes-panel {
    margin-top: 10px;
}

.booking-notes-panel[hidden] {
    display: none !important;
}

.booking-step[hidden] {
    display: none !important;
}

.booking-visit-summary {
    font-size: 0.8125rem;
    color: #047857;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 8px;
    padding: 10px 12px;
    margin-top: 12px;
    line-height: 1.4;
}
