/* ── Quote Modal — Mobile-first popup for maximum UX ── */
/* Drop this file in dist/css/ and link before </head> */

.ecr-modal-backdrop {
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    padding: 0; /* no padding on mobile — modal fills screen */
}
.ecr-modal-backdrop.open {
    opacity: 1; visibility: visible;
}

.ecr-modal {
    background: #fff; border-radius: 20px 20px 0 0;
    width: 100%; max-width: 520px; max-height: 100vh; max-height: 100dvh;
    overflow-y: auto; -webkit-overflow-scrolling: touch;
    position: relative;
    box-shadow: 0 -4px 30px rgba(0,0,0,0.15);
    transform: translateY(60px);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex; flex-direction: column;
}
.ecr-modal-backdrop.open .ecr-modal {
    transform: translateY(0);
}

/* Desktop: centered card */
@media (min-width: 640px) {
    .ecr-modal-backdrop { padding: 24px; }
    .ecr-modal {
        border-radius: 20px; max-height: 92vh;
        transform: translateY(30px) scale(0.96);
    }
    .ecr-modal-backdrop.open .ecr-modal {
        transform: translateY(0) scale(1);
    }
}

.ecr-modal-handle {
    display: flex; justify-content: center; padding: 12px 0 4px;
    flex-shrink: 0;
}
@media (min-width: 640px) { .ecr-modal-handle { display: none; } }

.ecr-modal-handle-bar {
    width: 40px; height: 5px; border-radius: 3px;
    background: rgba(0,0,0,0.15);
}

.ecr-modal-close {
    position: absolute; top: 12px; right: 12px; z-index: 2;
    width: 40px; height: 40px; border-radius: 50%;
    border: none; background: rgba(0,0,0,0.04);
    font-size: 22px; line-height: 1; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: rgba(0,0,0,0.5);
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}
.ecr-modal-close:hover, .ecr-modal-close:active {
    background: rgba(0,0,0,0.08); color: #111;
}

.ecr-modal-body {
    padding: 0 20px 24px; flex: 1; overflow-y: auto;
}
.ecr-modal-body > img {
    display: block; margin: 0 auto 20px; max-width: 140px; height: auto;
}

.ecr-modal-body h2 {
    text-align: center; font-family: 'Montserrat', system-ui, sans-serif;
    font-size: 1.35rem; font-weight: 700; color: #111; margin-bottom: 6px;
    letter-spacing: -0.01em;
}
.ecr-modal-body .ecr-step-description {
    text-align: center; color: rgba(0,0,0,0.38); font-size: 0.875rem;
    margin-bottom: 20px;
}

/* ── Stepper ── */
.ecr-modal-stepper {
    display: flex; align-items: center; justify-content: center; gap: 0;
    margin-bottom: 24px; padding: 0 8px;
}
.ecr-modal-step {
    display: flex; align-items: center; gap: 6px; flex: 1; justify-content: center;
}
.ecr-modal-step-circle {
    width: 34px; height: 34px; border-radius: 50%;
    border: 2px solid rgba(0,0,0,0.1); background: transparent;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem; font-weight: 700; color: rgba(0,0,0,0.38);
    flex-shrink: 0; transition: all 0.3s ease;
}
.ecr-modal-step.active .ecr-modal-step-circle {
    background: #F95108; border-color: #F95108; color: #fff;
    box-shadow: 0 0 0 4px rgba(249,81,8,0.12);
}
.ecr-modal-step.done .ecr-modal-step-circle {
    background: #1E9771; border-color: #1E9771; color: #fff;
}
.ecr-modal-step-line {
    width: 20px; height: 2px; background: rgba(0,0,0,0.06);
    border-radius: 1px; flex-shrink: 0; margin: 0 2px;
    transition: background 0.3s ease;
}
.ecr-modal-step-line.done { background: #1E9771; }

@media (max-width: 400px) {
    .ecr-modal-step-label { display: none; }
    .ecr-modal-step-line { width: 12px; }
}

/* ── Form elements ── */
.ecr-modal-body .form-group { margin-bottom: 14px; }
.ecr-modal-body .form-group label {
    display: block; margin-bottom: 4px; font-weight: 600; font-size: 0.875rem;
    color: rgba(0,0,0,0.75);
}
.ecr-modal-body .form-group input,
.ecr-modal-body .form-group textarea,
.ecr-modal-body .form-group select {
    width: 100%; padding: 14px 16px;
    border: 1px solid rgba(0,0,0,0.08); border-radius: 12px;
    font-size: 16px; /* prevent iOS zoom */
    font-family: 'Inter', system-ui, sans-serif;
    color: #111; background: #FAFAFA;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
    line-height: 1.5; min-height: 48px;
    -webkit-appearance: none;
}
.ecr-modal-body .form-group input:focus,
.ecr-modal-body .form-group textarea:focus,
.ecr-modal-body .form-group select:focus {
    border-color: #F95108; box-shadow: 0 0 0 3px rgba(249,81,8,0.12);
    outline: none; background: #fff;
}
.ecr-modal-body .ecr-field-error {
    color: #D93838; font-size: 0.75rem; font-weight: 500; margin-top: 4px;
    display: none;
}
.ecr-modal-body .ecr-field-error.show { display: block; }
.ecr-modal-body input.invalid, .ecr-modal-body select.invalid, .ecr-modal-body textarea.invalid {
    border-color: #D93838; box-shadow: 0 0 0 3px rgba(217,56,56,0.08);
}

.ecr-modal-buttons {
    display: flex; gap: 10px; margin-top: 20px;
}
.ecr-modal-buttons button {
    padding: 14px 24px; border-radius: 12px; font-size: 1rem;
    font-weight: 700; font-family: 'Inter', system-ui, sans-serif;
    cursor: pointer; border: none; transition: all 0.2s;
    min-height: 48px; -webkit-tap-highlight-color: transparent;
}
.ecr-btn-primary {
    flex: 1; background: #F95108; color: #fff;
    text-transform: uppercase; letter-spacing: 0.04em;
}
.ecr-btn-primary:hover, .ecr-btn-primary:active {
    background: #D94400; box-shadow: 0 0 0 4px rgba(249,81,8,0.12);
    transform: translateY(-1px);
}
.ecr-btn-back {
    background: transparent; color: rgba(0,0,0,0.6);
    border: 1px solid rgba(0,0,0,0.1); font-weight: 600;
}
.ecr-btn-back:hover, .ecr-btn-back:active {
    background: rgba(0,0,0,0.03); color: #111;
    border-color: rgba(0,0,0,0.2);
}
.ecr-btn-submit {
    flex: 1; background: #F95108; color: #fff;
    text-transform: uppercase; letter-spacing: 0.04em;
}

.ecr-modal-geo {
    display: flex; align-items: center; gap: 8px; padding: 8px 12px;
    border-radius: 10px; font-size: 0.75rem; margin-top: 8px;
}
.ecr-modal-geo.searching { background: rgba(0,0,0,0.02); color: rgba(0,0,0,0.38); }
.ecr-modal-geo.found { background: rgba(30,151,113,0.06); color: #1E9771; }
.ecr-modal-geo.denied { background: rgba(232,139,0,0.04); color: #E88B00; }

.ecr-modal-error-summary {
    display: none; background: rgba(217,56,56,0.05); border: 1px solid #D93838;
    border-radius: 10px; padding: 12px 16px; margin-bottom: 16px;
    color: #D93838; font-size: 0.875rem;
}
.ecr-modal-error-summary.show { display: block; }

.ecr-modal-spinner {
    width: 16px; height: 16px; border: 2px solid rgba(0,0,0,0.06);
    border-top-color: #F95108; border-radius: 50%;
    animation: ecrSpin 0.8s linear infinite; display: inline-block;
}
@keyframes ecrSpin { to { transform: rotate(360deg); } }

.ecr-modal-overlay {
    position: fixed; inset: 0; z-index: 10000;
    background: rgba(0,0,0,0.3); backdrop-filter: blur(4px);
    display: none; align-items: center; justify-content: center;
}
.ecr-modal-overlay.show { display: flex; }
.ecr-modal-overlay-card {
    background: #fff; border-radius: 20px; padding: 32px 24px;
    text-align: center; max-width: 300px; box-shadow: 0 12px 40px rgba(0,0,0,0.1);
}

/* Hide modal step panels by default */
.ecr-modal-step-panel { display: none; }
.ecr-modal-step-panel.active { display: block; }

/* Safe area for notched phones */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .ecr-modal { padding-bottom: env(safe-area-inset-bottom); }
}
