/* ==========================================================================
   Multi-Step Booking Modal Styles
   ========================================================================== */

/* Overlay Background */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(5, 11, 20, 0.85);
    backdrop-filter: blur(5px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* Main Modal Container */
.modal-container {
    background: #ffffff;
    width: 95%;
    max-width: 800px;
    height: 90vh; /* Fixed height for internal scrolling */
    max-height: 850px;
    border-radius: 12px;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Contains the header/footer */
    
    transform: translateY(20px) scale(0.95);
    transition: transform 0.3s ease;
}

.modal-overlay.show .modal-container {
    transform: translateY(0) scale(1);
}

/* Close Button - Floats over header */
.modal-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255,255,255,0.2);
    font-size: 1.5rem;
    color: #ffffff;
    cursor: pointer;
    width: 35px;
    height: 35px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    z-index: 10;
}

.modal-close-btn:hover {
    background: var(--racing-red);
    border-color: var(--racing-red);
    color: #ffffff;
}

/* Modal Header (Dark) */
.modal-header-brand {
    background: var(--primary-blue);
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    border-bottom: 4px solid var(--racing-red);
}

.modal-logo {
    height: 70px;
    width: auto;
    object-fit: contain;
}

.modal-contact-info {
    display: flex;
    flex-direction: column;
    text-align: right;
    padding-right: 3rem; /* Space for close btn */
}

/* Modal Body Wrapper (Scrollable) */
.modal-body-wrapper {
    flex: 1;
    overflow-y: auto;
    background: #f8fafc;
    position: relative;
    padding: 2rem;
}

/* Generic Step Class */
.modal-step {
    width: 100%;
    transition: opacity 0.3s ease;
}

.modal-step.hidden,
#modalStep1.hidden,
#modalStep2.hidden,
#modalStep3.hidden,
#modalStep4.hidden {
    display: none !important;
    opacity: 0 !important;
}

/* STEP 1: Loading State */
#modalStep1 {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    min-height: 400px;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    animation: spin 2s linear infinite;
    margin-bottom: 1.5rem;
}

@keyframes spin {
    100% { transform: rotate(360deg); }
}

.loading-text {
    font-family: var(--font-body);
    font-size: 1.2rem;
    color: #64748b;
}

/* STEP 2: Service Grid */
.step-title {
    font-family: var(--font-heading);
    font-size: 1rem;
    color: var(--primary-blue);
    text-align: center;
    margin-bottom: 1.5rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    position: relative;
}

.step-title::before, .step-title::after {
    content: "";
    display: inline-block;
    width: 60px;
    height: 1px;
    background: #cbd5e1;
    vertical-align: middle;
    margin: 0 15px;
}

.service-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.service-card {
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.2rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.service-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.service-card.selected {
    border-color: var(--racing-red);
    background: #fffcfc;
}

/* Checkbox visual inside card */
.checkbox-box {
    width: 24px;
    height: 24px;
    border: 2px solid #cbd5e1;
    border-radius: 4px;
    flex-shrink: 0;
    position: relative;
    transition: all 0.2s ease;
}

.service-card.selected .checkbox-box {
    background: var(--racing-red);
    border-color: var(--racing-red);
}

.service-card.selected .checkbox-box::after {
    content: "";
    position: absolute;
    left: 7px;
    top: 3px;
    width: 6px;
    height: 12px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Service SVG Icon */
.service-icon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    color: var(--primary-blue);
    transition: color 0.2s ease;
    margin-top: -2px; /* Slight alignment tweak */
}

.service-card.selected .service-icon {
    color: var(--racing-red);
}

.service-card-content h4 {
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--primary-blue);
    margin-bottom: 0.25rem;
}

.service-card-content p {
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: #64748b;
    line-height: 1.4;
}

/* Bottom Inputs (Phone & SMS) */
.modal-bottom-inputs {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.phone-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.phone-input {
    flex: 1;
    max-width: 300px;
    padding: 0.8rem 1rem;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-family: var(--font-body);
    font-size: 1rem;
}

.phone-input:focus {
    outline: none;
    border-color: var(--primary-blue);
}

.phone-hint {
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: #64748b;
    flex: 2;
}

/* Custom SMS Consent Checkbox */
.consent-checkbox-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    cursor: pointer;
}

.consent-checkbox-wrapper input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.custom-checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid #cbd5e1;
    border-radius: 4px;
    margin-top: 2px;
    position: relative;
    flex-shrink: 0;
}

.consent-checkbox-wrapper input:checked ~ .custom-checkmark {
    background-color: var(--primary-blue);
    border-color: var(--primary-blue);
}

.custom-checkmark::after {
    content: "";
    position: absolute;
    display: none;
    left: 5px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.consent-checkbox-wrapper input:checked ~ .custom-checkmark::after {
    display: block;
}

.consent-text strong {
    display: block;
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--primary-blue);
    margin-bottom: 0.25rem;
}

.consent-text p {
    font-family: var(--font-body);
    font-size: 0.8rem;
    color: #64748b;
    line-height: 1.4;
}

/* Modal Footer (Dark) */
.modal-footer {
    background: #475569; /* Lighter slate than primary blue */
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.powered-by {
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: #cbd5e1;
}

.powered-by strong {
    color: #ffffff;
}

.next-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 4px;
    font-family: var(--font-body);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.next-btn:not(:disabled):hover {
    background: var(--primary-blue);
}

.next-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .phone-row {
        flex-direction: column;
        align-items: stretch;
    }
    .phone-input {
        max-width: 100%;
    }
}

/* ==========================================================================
   STEP 3: Calendar & Drop-off (2-Column Layout)
   ========================================================================== */

#modalStep3 {
    height: 100%;
}

.step3-container {
    display: flex;
    gap: 1.5rem;
    height: 100%;
    align-items: flex-start;
}

.step3-left, .step3-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.selection-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.card-title {
    font-family: var(--font-body);
    font-size: 1.05rem;
    color: var(--primary-blue);
    margin-bottom: 1rem;
    text-align: center;
}

.text-center {
    text-align: center;
}

/* Drop-off Buttons */
.dropoff-options {
    display: flex;
    gap: 1rem;
}

.dropoff-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--primary-blue);
    font-weight: 600;
}

.dropoff-btn svg {
    width: 24px;
    height: 24px;
}

.dropoff-btn:hover {
    border-color: #94a3b8;
}

.dropoff-btn.selected {
    background: #475569; /* Slate/Dark blue */
    border-color: #475569;
    color: #ffffff;
}

/* Calendar Styling */
.calendar-card {
    padding: 1.5rem;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.calendar-month-year {
    font-family: var(--font-body);
    font-size: 1.1rem;
    color: var(--primary-blue);
    font-weight: 700;
}

.calendar-nav {
    display: flex;
    gap: 0.5rem;
}

.cal-nav-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: var(--primary-blue);
    font-size: 1.2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cal-nav-btn:hover {
    background: #f1f5f9;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary-blue);
    margin-bottom: 0.5rem;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.25rem;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: #64748b;
    border-radius: 6px;
    cursor: pointer;
    background: #f1f5f9;
    transition: all 0.2s ease;
}

.calendar-day:hover:not(.disabled) {
    background: #e2e8f0;
}

.calendar-day.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    background: transparent;
}

.calendar-day.selected {
    background: #475569;
    color: #ffffff;
    font-weight: 700;
}

/* Time Slot Column */
.timeslot-card {
    height: 100%;
}

.timeslot-subtitle {
    text-align: center;
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 1.5rem;
    margin-top: -0.5rem;
}

.timeslot-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.timeslot-btn {
    background: #ffffff;
    border: 1px solid var(--primary-blue);
    color: var(--primary-blue);
    padding: 0.8rem;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.timeslot-btn:hover {
    background: #f1f5f9;
}

.timeslot-btn.selected {
    background: var(--primary-blue);
    color: #ffffff;
}

/* Back Button */
.back-btn {
    background: #ffffff;
    color: var(--primary-blue);
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 4px;
    font-family: var(--font-body);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.back-btn:hover {
    background: #f1f5f9;
}

.back-btn.hidden {
    display: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .step3-container {
        flex-direction: column;
    }
}

/* ==========================================================================
   STEP 4: Appointment Summary
   ========================================================================== */

#modalStep4 {
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.summary-card {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

.summary-text-container {
    margin-bottom: 1.5rem;
}

.summary-text {
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: #475569;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.summary-text strong {
    color: var(--primary-blue);
    font-weight: 700;
}

.comments-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.comments-label {
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary-blue);
}

.required-text {
    color: var(--racing-red);
    font-weight: 400;
}

.comments-textarea {
    width: 100%;
    min-height: 120px;
    padding: 1rem;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s ease;
}

.comments-textarea:focus {
    border-color: var(--primary-blue);
}

.edit-appointment-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: none;
    color: var(--primary-blue);
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.edit-appointment-btn svg {
    width: 16px;
    height: 16px;
}

.edit-appointment-btn:hover {
    background: #f1f5f9;
}

/* Progressive Disclosure for Step 3 */
.progressive-hidden {
    opacity: 0.15;
    pointer-events: none;
    filter: grayscale(100%);
    transition: opacity 0.4s ease, filter 0.4s ease;
}

.progressive-reveal {
    opacity: 1;
    pointer-events: auto;
    filter: grayscale(0%);
    transition: opacity 0.4s ease, filter 0.4s ease;
}

@keyframes fadeInReveal {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}


/* ==========================================================================
   STEP 5: Abandonment Screen
   ========================================================================== */
#modalStepAbandon {
    padding: 1rem;
}

.abandonment-title {
    font-family: var(--font-body);
    font-size: 1.25rem;
    color: var(--primary-blue);
    margin-bottom: 1rem;
}

.abandonment-alert {
    background-color: #eef2f6;
    padding: 1rem 1.5rem;
    border-radius: 6px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: #475569;
    margin-bottom: 2rem;
}

.abandonment-form {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
}

.abandonment-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.abandonment-right {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-group.h-100 {
    height: 100%;
}

.form-group label {
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--primary-blue);
}

.abandon-input, .abandon-textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 0.6rem 0.8rem;
    font-family: var(--font-body);
    outline: none;
    transition: border-color 0.2s ease;
}

.abandon-input:focus, .abandon-textarea:focus {
    border-color: #4ca3ff; /* Lighter blue */
}

.abandon-textarea {
    flex-grow: 1;
    resize: vertical;
    min-height: 120px;
}

.abandonment-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #f1f5f9;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--primary-blue);
    color: var(--primary-blue);
    padding: 0.6rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-outline:hover {
    background: #f1f5f9;
}

.btn-solid {
    background: var(--primary-blue);
    border: 1px solid var(--primary-blue);
    color: #ffffff;
    padding: 0.6rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-solid:hover {
    background: #1e293b;
}

@media (max-width: 768px) {
    .abandonment-form {
        flex-direction: column;
        gap: 1rem;
    }
}
