/* ============================================================
   Elway SRP — inventory-srp-elway.css
   Mobile-first, Inter font, design tokens from ColorPalette
   ============================================================ */

/* --- Design Tokens --- */
:root {
    --ew-text-primary: #181D27;
    --ew-text-secondary: #414651;
    --ew-text-tertiary: #535862;
    --ew-text-quaternary: #717680;
    --ew-text-placeholder: #A4A7AE;
    --ew-border: #E9EAEB;
    --ew-border-primary: #D5D7DA;
    --ew-bg-card: #F9F9F9;
    --ew-bg-white: #fff;
    --ew-badge-bg: #181D27;
    --ew-dot-active: #DE1C21;
    --ew-dot-inactive: #DDD;
    --ew-green: #47916F;
    --ew-btn-dark: #1F2A37;
    --ew-shadow-xs: rgba(10, 13, 18, 0.05);
    --ew-shadow-border: rgba(10, 13, 18, 0.18);
    --ew-shadow-inner: rgba(10, 13, 18, 0.05);
}

/* --- Container --- */
/* Kill .site-content top padding on SRP pages */
.site-content:has(.ew-srp) {
    padding-top: 0;
}

.ew-srp {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0;
    font-family: 'Montserrat', sans-serif;
}

/* --- Search Row (full-width, breaks out of .site-content) --- */
.ew-search-row {
    display: flex;
    align-items: center;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    width: 100vw;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: 16px 24px;
    box-sizing: border-box;
}

.ew-search-row .ew-search-input {
    flex: 1;
    min-width: 0;
    height: 50px;
    padding: 12px 130px 12px 16px;
    border: 1px solid #d1d5dc;
    border-radius: 8px;
    font-size: 16px;
    background: #fff;
    outline: none;
}

.ew-search-row .ew-search-input::placeholder {
    color: rgba(10, 10, 10, 0.5);
}

.ew-search-row .ew-search-btn {
    position: absolute;
    right: 21px;
    display: flex;
    align-items: center;
    gap: 6px;
    height: 40px;
    padding: 0 20px;
    background: #1f2937;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}

/* --- Top Bar (count + filter btn + sort) --- */
.ew-topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    margin-bottom: 16px;
}

.ew-vehicle-count {
    font-size: 14px;
    font-weight: 500;
    color: var(--ew-text-primary);
    white-space: nowrap;
}

.ew-mobile-filter-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    padding: 8px 16px;
    border: 1px solid var(--ew-border);
    border-radius: 6px;
    background: var(--ew-bg-white);
    font-size: 14px;
    font-weight: 500;
    color: var(--ew-text-primary);
    cursor: pointer;
}

.ew-mobile-filter-btn svg {
    width: 20px;
    height: 20px;
}

/* Search bar — hidden on mobile, shown on desktop */
.ew-search-bar {
    display: none;
}

/* Sort dropdown — hidden on mobile (inside filter overlay) */
.ew-sort-wrap {
    display: none;
}

/* --- Layout: sidebar + grid --- */
.ew-layout {
    display: flex;
}

/* Sidebar — hidden on mobile */
.ew-sidebar {
    display: none;
}

/* Grid area */
.ew-main {
    flex: 1;
    min-width: 0;
    padding: 0 16px 24px;
}

/* --- Card Grid --- */
.ew-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    max-width: 420px;
    margin: 0 auto;
}

/* Card styles are in shared inventory-card-elway.css */

/* SRP-specific card override: 4:3 on mobile (full-width single column) */
.ew-grid .ew-card-image-wrap {
    aspect-ratio: 4 / 3;
}

/* Tablet: restore 2-column grid */
@media (min-width: 769px) {
    .ew-grid {
        grid-template-columns: repeat(2, 1fr);
        max-width: none;
        margin: 0;
    }

    .ew-grid .ew-card-image-wrap {
        aspect-ratio: 1 / 1;
    }
}

/* --- Infinite scroll loader --- */
.ew-scroll-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 24px 0;
}

/* --- Loading --- */
.ew-loading {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 40px 0;
    gap: 12px;
    grid-column: 1 / -1;
}

.ew-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--ew-border);
    border-top-color: var(--ew-text-primary);
    border-radius: 50%;
    animation: ew-spin 0.8s linear infinite;
}

@keyframes ew-spin {
    to { transform: rotate(360deg); }
}

.ew-loading-text {
    font-size: 14px;
    color: var(--ew-text-tertiary);
}

/* --- Empty state --- */
.ew-empty {
    text-align: left;
    padding: 40px 0;
    color: var(--ew-text-tertiary);
    grid-column: 1 / -1;
}

.ew-empty svg {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    opacity: 0.4;
}

.ew-empty p {
    font-size: 16px;
    margin: 0;
}

/* --- Mobile Filter Overlay --- */
.ew-filter-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--ew-bg-white);
    z-index: 1000;
    display: none;
    flex-direction: column;
}

.ew-filter-overlay.open {
    display: flex;
}

.ew-filter-overlay-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    flex-shrink: 0;
}

.ew-filter-overlay-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--ew-text-primary);
    margin: 0;
}

.ew-filter-close {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--ew-text-primary);
}

.ew-filter-close svg {
    width: 24px;
    height: 24px;
}

/* Sort dropdown inside overlay */
.ew-overlay-sort {
    padding: 0 16px 16px;
    border-bottom: 1px solid var(--ew-border);
}

.ew-overlay-sort select {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    border: 1px solid var(--ew-border);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--ew-text-primary);
    background: var(--ew-bg-white);
    appearance: auto;
}

/* Filter sections (shared between sidebar and overlay) */
.ew-filter-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.ew-filter-section {
    margin-bottom: 32px;
}

.ew-filter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}

.ew-filter-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--ew-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0;
    margin: 0;
}

.ew-filter-toggle {
    width: 20px;
    height: 20px;
    color: var(--ew-text-primary);
    flex-shrink: 0;
}

.ew-filter-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.ew-filter-section.collapsed .ew-filter-options,
.ew-filter-section.collapsed .ew-price-slider-wrap {
    display: none;
}

/* Checkbox rows */
.ew-checkbox-row {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.ew-checkbox {
    width: 18px;
    height: 18px;
    border: 1px solid var(--ew-border);
    border-radius: 4px;
    background: var(--ew-bg-white);
    appearance: none;
    cursor: pointer;
    flex-shrink: 0;
}

.ew-checkbox:checked {
    background: var(--ew-text-primary);
    border-color: var(--ew-text-primary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 12px;
}

.ew-checkbox-label {
    font-size: 14px;
    font-weight: 500;
    color: #252B37;
    line-height: 20px;
}

/* Price filter */
.ew-price-slider-wrap {
    margin-top: 20px;
}

.ew-price-track {
    position: relative;
    height: 14px;
    display: flex;
    align-items: center;
}

.ew-price-range {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 2px;
    background: var(--ew-text-primary);
    border-radius: 100px;
    outline: none;
}

.ew-price-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: var(--ew-text-primary);
    border-radius: 100px;
    cursor: pointer;
}

.ew-price-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}

.ew-price-input-wrap {
    position: relative;
    flex: 1;
}

.ew-price-input-wrap .ew-price-symbol {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: var(--ew-text-tertiary);
    pointer-events: none;
}

.ew-price-input {
    width: 100%;
    height: 36px;
    padding: 0 8px 0 18px;
    border: 1px solid var(--ew-border);
    border-radius: 8px;
    font-size: 12px;
    color: var(--ew-text-tertiary);
    text-align: right;
    box-sizing: border-box;
}

.ew-price-to {
    font-size: 14px;
    color: var(--ew-text-primary);
    flex-shrink: 0;
}

/* Bottom buttons */
.ew-filter-bottom {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-top: 1px solid var(--ew-border);
    flex-shrink: 0;
}

.ew-btn-clear {
    flex: 1;
    height: 44px;
    border: 1px solid var(--ew-border);
    border-radius: 6px;
    background: var(--ew-bg-white);
    font-size: 14px;
    font-weight: 600;
    color: var(--ew-text-primary);
    cursor: pointer;
}

.ew-btn-apply {
    flex: 1;
    height: 44px;
    border: none;
    border-radius: 4px;
    background: var(--ew-btn-dark);
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    text-transform: uppercase;
}

/* ============================================================
   DESKTOP — min-width: 1025px
   ============================================================ */
@media (min-width: 1025px) {

    .ew-topbar {
        padding: 0;
        gap: 12px 16px;
        margin-top: 0;
    }

    .ew-vehicle-count {
        font-size: 18px;
        font-weight: 600;
        line-height: 24px;
    }

    .ew-mobile-filter-btn {
        display: none;
    }

    /* Search bar */
    .ew-search-bar {
        display: flex;
        align-items: center;
        flex: 1;
        max-width: 600px;
        height: 44px;
        border: 1px solid var(--ew-border);
        border-radius: 6px;
        background: var(--ew-bg-white);
        overflow: hidden;
    }

    .ew-search-dropdown {
        display: flex;
        align-items: center;
        gap: 4px;
        padding: 0 12px;
        height: 100%;
        font-size: 14px;
        font-weight: 400;
        color: var(--ew-text-primary);
        border: none;
        background: none;
        cursor: pointer;
        white-space: nowrap;
    }

    .ew-search-dropdown svg {
        width: 16px;
        height: 16px;
    }

    .ew-search-divider {
        width: 1px;
        height: 100%;
        background: var(--ew-border);
        flex-shrink: 0;
    }

    .ew-search-input {
        flex: 1;
        height: 100%;
        padding: 0 12px;
        border: none;
        outline: none;
        font-size: 14px;
        color: var(--ew-text-primary);
        background: none;
    }

    .ew-search-input::placeholder {
        color: var(--ew-text-placeholder);
    }

    .ew-search-btn {
        display: flex;
        align-items: center;
        gap: 6px;
        height: 36px;
        padding: 0 16px;
        margin: 4px;
        border: none;
        border-radius: 4px;
        background: var(--ew-btn-dark);
        color: #fff;
        font-size: 14px;
        cursor: pointer;
    }

    .ew-search-btn svg {
        width: 20px;
        height: 20px;
    }

    /* Sort dropdown */
    .ew-sort-wrap {
        display: flex;
        align-items: center;
        height: 44px;
        border: 1px solid var(--ew-border);
        border-radius: 6px;
        background: var(--ew-bg-white);
        padding: 0 12px;
    }

    .ew-sort-select {
        border: none;
        background: none;
        font-size: 14px;
        font-weight: 500;
        color: var(--ew-text-primary);
        outline: none;
        cursor: pointer;
        appearance: auto;
        padding-right: 8px;
    }

    /* Layout */
    .ew-sidebar {
        display: block;
        width: 256px;
        flex-shrink: 0;
        padding: 24px 25px 24px 24px;
        border-right: 1px solid #e5e7eb;
        background: #fff;
    }

    .ew-main {
        padding: 24px 0 48px 24px;
    }

    .ew-topbar {
        margin-bottom: 20px;
    }

    /* Grid: 3 columns */
    .ew-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 28px;
    }

    /* Desktop: restore standard card aspect ratio (overrides mobile square) */
    .ew-grid .ew-card-image-wrap {
        aspect-ratio: 320 / 348;
    }

}

/* ============================================================
   WIDE DESKTOP — min-width: 1600px (4 columns)
   ============================================================ */
@media (min-width: 1600px) {
    .ew-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ============================================================
   Ask a Question modal (SRP — mirrors VDP ew-prequal-modal)
   ============================================================ */
.ew-prequal-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ew-prequal-modal[hidden] { display: none; }
.ew-prequal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}
.ew-prequal-inner {
    position: relative;
    z-index: 1;
    width: min(440px, 92vw);
    max-height: 90vh;
    overflow-y: auto;
    background: #fff;
    border-radius: 12px;
}
.ew-prequal-close {
    position: absolute;
    top: 10px;
    right: 12px;
    z-index: 2;
    background: rgba(0, 0, 0, 0.08);
    color: #414651;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.ew-prequal-close:hover { background: rgba(0, 0, 0, 0.15); }
.ew-prequal-content { padding: 24px 24px 28px; }
.ew-prequal-title {
    font-size: 22px;
    font-weight: 700;
    color: #181d27;
    margin: 0 0 4px;
}
.ew-prequal-subtitle {
    font-size: 14px;
    color: #717680;
    margin: 0 0 16px;
}
.ew-prequal-comments {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d5d7da;
    border-radius: 8px;
    font-size: 15px;
    color: #181d27;
    background: #fff;
    resize: vertical;
    box-sizing: border-box;
    font-family: inherit;
    transition: border-color 0.15s;
    margin-bottom: 16px;
}
.ew-prequal-comments:focus {
    outline: none;
    border-color: #006883;
    box-shadow: 0 0 0 3px rgba(0, 104, 131, 0.12);
}
#ew-srp-inquiry-form-wrap dot-form form {
    background: transparent;
    padding: 0;
    border: none;
    box-shadow: none;
}
#ew-srp-inquiry-form-wrap dot-form-column { margin: 0 0.5rem; }
#ew-srp-inquiry-form-wrap dot-form-row { margin-bottom: 0; }
#ew-srp-inquiry-form-wrap dot-form .dot-form__buttons { position: relative !important; margin-top: 12px; padding: 0; }
#ew-srp-inquiry-form-wrap .dot-form__required-mark { margin-bottom: 8px; }
#ew-srp-inquiry-form-wrap dot-form input[type="text"],
#ew-srp-inquiry-form-wrap dot-form input[type="email"],
#ew-srp-inquiry-form-wrap dot-form input[type="tel"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d5d7da;
    border-radius: 8px;
    font-size: 15px;
    color: #181d27;
    background: #fff;
    transition: border-color 0.15s;
    box-sizing: border-box;
}
#ew-srp-inquiry-form-wrap dot-form input:focus {
    outline: none;
    border-color: #006883;
    box-shadow: 0 0 0 3px rgba(0, 104, 131, 0.12);
}
#ew-srp-inquiry-form-wrap dot-form label {
    font-size: 13px;
    font-weight: 500;
    color: #414651;
}
#ew-srp-inquiry-form-wrap dot-form button[type="submit"] {
    width: 100%;
    padding: 0;
    background: #192B3B;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
    margin: 8px 0;
}
#ew-srp-inquiry-form-wrap dot-form button[type="submit"]:hover { opacity: 0.9; }
#ew-srp-inquiry-form-wrap dot-form button[type="submit"]:disabled { opacity: 0.6; cursor: not-allowed; }
#ew-srp-inquiry-form-wrap dot-form button[type="reset"] { display: none; }
.ew-srp-inquiry-success {
    text-align: center;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.ew-srp-inquiry-success h3 {
    font-size: 20px;
    font-weight: 700;
    color: #181d27;
    margin: 16px 0 8px;
}
.ew-srp-inquiry-success p {
    font-size: 14px;
    color: #717680;
    margin: 0;
    line-height: 1.5;
}
@media (max-width: 480px) {
    .ew-prequal-content { padding: 24px 20px; }
}

/* Site-level new-inventory-only mode: hide condition filter */
.ew-srp[data-new-only="true"] .ew-filter-section[data-filter="condition"] {
    display: none;
}
