/* ==========================================================
   TAPPITRACK — MULTI-STEP QUOTE MODAL
   Markup: components/quote-modal.html
   Script: assets/js/quote-form.js
   ========================================================== */

/* Layout: fixed header, progress and footer; only the step in the
   middle scrolls. Works at any viewport height and browser zoom. */
.quote-modal {
    width: min(100% - 32px, 680px);
    max-height: min(100dvh - 32px, 780px);
    padding: 0;
    overflow: hidden;
    color: var(--tt-text);
    background: var(--tt-white);
    border: 0;
    border-radius: var(--tt-radius-lg);
    box-shadow: 0 30px 80px rgba(11, 29, 48, 0.35);
}

.quote-modal::backdrop {
    background: rgba(11, 29, 48, 0.62);
    backdrop-filter: blur(3px);
}

.quote-modal[open] {
    animation: quote-in 260ms var(--tt-ease);
}

@keyframes quote-in {
    from {
        opacity: 0;
        transform: translateY(14px) scale(0.98);
    }
}

.quote-form {
    display: flex;
    flex-direction: column;
    max-height: min(100dvh - 32px, 780px);
}

.quote-modal-head,
.quote-progress,
.quote-status,
.quote-actions {
    flex: 0 0 auto;
}

.quote-modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 24px 14px;
}

.quote-step-label {
    color: var(--tt-blue);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.quote-modal-head h2 {
    margin: 4px 0 0;
    font-size: clamp(19px, 2.4vw, 23px);
}

.quote-close {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    color: var(--tt-muted);
    background: var(--tt-light);
    border: 0;
    border-radius: 50%;
    cursor: pointer;
}

.quote-close:hover {
    color: var(--tt-dark);
}

.quote-close svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}

.quote-progress {
    height: 3px;
    margin: 0 24px;
    background: var(--tt-border);
    border-radius: 3px;
}

.quote-progress span {
    display: block;
    width: 33%;
    height: 100%;
    background: var(--tt-blue);
    border-radius: inherit;
    transition: width 320ms var(--tt-ease);
}

.quote-step {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    margin: 0;
    padding: 16px 24px;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 0;
}

.quote-intro {
    margin: 0 0 12px;
    color: var(--tt-muted);
    font-size: 14px;
}

/* ---------- Step 1 options ---------- */

.quote-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.quote-option {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border: 1.5px solid var(--tt-border);
    border-radius: var(--tt-radius);
    cursor: pointer;
    transition: border-color 160ms ease, background-color 160ms ease;
}

.quote-option--wide {
    grid-column: 1 / -1;
}

.quote-option:hover {
    border-color: #A9C6F2;
}

.quote-option:has(input:checked) {
    background: var(--tt-blue-soft);
    border-color: var(--tt-blue);
}

.quote-option:has(input:focus-visible) {
    outline: 3px solid rgba(0, 103, 238, 0.4);
    outline-offset: 2px;
}

.quote-option input {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    margin: 2px 0 0;
    accent-color: var(--tt-blue);
}

.quote-option strong {
    display: block;
    color: var(--tt-dark);
    font-size: 14px;
    line-height: 1.35;
}

.quote-option small {
    display: block;
    margin-top: 2px;
    color: var(--tt-muted);
    font-size: 12.5px;
    line-height: 1.4;
}

/* ---------- Fields ---------- */

.quote-field {
    display: grid;
    gap: 5px;
    margin-bottom: 12px;
}

.quote-field-label {
    color: var(--tt-dark);
    font-size: 13px;
    font-weight: 700;
}

.quote-field-label small {
    color: var(--tt-muted);
    font-weight: 500;
}

.quote-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 16px;
}

.quote-form input[type="text"],
.quote-form input[type="tel"],
.quote-form input[type="email"],
.quote-form select,
.quote-form textarea {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    font-size: 15px;
    color: var(--tt-dark);
    background: var(--tt-white);
    border: 1.5px solid #CBD6E2;
    border-radius: var(--tt-radius-sm);
}

.quote-form textarea {
    height: auto;
    min-height: 60px;
    padding: 8px 12px;
    resize: vertical;
}

.quote-form input:focus,
.quote-form select:focus,
.quote-form textarea:focus {
    border-color: var(--tt-blue);
    outline: 3px solid rgba(0, 103, 238, 0.18);
    outline-offset: 0;
}

.quote-form [aria-invalid="true"] {
    border-color: var(--tt-red);
}

.quote-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.quote-chip input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.quote-chip span {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 13px;
    border: 1.5px solid #CBD6E2;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease;
}

.quote-chip input:checked + span {
    color: var(--tt-white);
    background: var(--tt-blue);
    border-color: var(--tt-blue);
}

.quote-chip input:focus-visible + span {
    outline: 3px solid rgba(0, 103, 238, 0.4);
    outline-offset: 2px;
}

/* Consent stays pinned to the bottom of the scrolling step so it is
   always visible above the Back / Submit buttons. */
.quote-consent {
    position: sticky;
    bottom: -16px;
    z-index: 1;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 4px 0 -16px;
    padding: 10px 0 16px;
    color: var(--tt-text);
    background: var(--tt-white);
    font-size: 13px;
    line-height: 1.45;
}

.quote-consent input {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    margin-top: 2px;
    accent-color: var(--tt-blue);
}

.quote-honeypot {
    position: absolute;
    left: -9999px;
}

.quote-error {
    margin: 14px 0 0;
    color: #C4000B;
    font-size: 14px;
    font-weight: 600;
}

.quote-status {
    margin: 0 24px;
    color: #C4000B;
    font-size: 14px;
}

.quote-status:empty {
    display: none;
}

/* ---------- Success ---------- */

.quote-success {
    padding-top: 32px;
    text-align: center;
}

.quote-success-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    margin-bottom: 12px;
    color: var(--tt-white);
    background: var(--tt-success);
    border-radius: 50%;
}

.quote-success-icon svg {
    width: 30px;
    height: 30px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.quote-success p {
    max-width: 460px;
    margin: 0 auto 10px;
}

.quote-success a {
    color: var(--tt-blue);
    font-weight: 700;
}

/* ---------- Footer actions ---------- */

.quote-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 24px 16px;
    background: var(--tt-white);
    border-top: 1px solid var(--tt-border);
}

.quote-actions .btn {
    min-height: 42px;
}

.quote-actions [hidden] {
    display: none;
}

.quote-actions [data-quote-back] {
    margin-right: auto;
}

.quote-form.is-sending [data-quote-submit] {
    opacity: 0.7;
    pointer-events: none;
}

@media (max-width: 600px) {
    .quote-modal {
        width: 100%;
        max-width: none;
        max-height: 100dvh;
        height: 100dvh;
        margin: 0;
        border-radius: 0;
    }

    .quote-form {
        height: 100%;
        max-height: 100dvh;
    }

    .quote-modal-head,
    .quote-step,
    .quote-actions {
        padding-inline: 16px;
    }

    .quote-progress,
    .quote-status {
        margin-inline: 16px;
    }

    .quote-actions .btn {
        flex: 1 1 0;
    }

    .quote-options {
        grid-template-columns: minmax(0, 1fr);
    }

    /* Pairs (name/company, phone/email, county/timeline) stay side by
       side on phones and only stack on very narrow screens. */
    .quote-grid {
        gap: 0 10px;
    }
}

@media (max-width: 359px) {
    .quote-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}
