/* =============================================================
   Vehicle Search — Button + Modal + Select2 theme + Criteria bar
   ============================================================= */

/* ── Nav button ─────────────────────────────────────────────── */
.vehicle-search-trigger {
    background: none;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    color: var(--color-text-on-brand, #fff);
    font-size: 16px;
    font-weight: 700;
    white-space: nowrap;
    text-decoration: none;
    font-family: inherit;
    transition: opacity 0.15s;
}
.vehicle-search-trigger:hover,
.vehicle-search-trigger:focus {
    opacity: 0.85;
    outline: none;
}
.vehicle-search-trigger--mobile {
    width: 100%;
    text-align: left;
    padding: 12px 20px;
    font-size: 15px;
    color: inherit;
}

/* ── Modal overlay ──────────────────────────────────────────── */
.vsm-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}
.vsm-overlay[hidden] { display: none; }

.vsm-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.45);
    cursor: pointer;
}

/* ── Dialog ─────────────────────────────────────────────────── */
.vsm-dialog {
    position: relative;
    z-index: 1;
    background: #fff;
    width: 100%;
    max-width: 700px;
    margin: 170px 16px 0;
    border-radius: 0;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    overflow: visible;
}
@media (max-width: 768px) {
    .vsm-dialog {
        max-width: 100%;
        margin: 0;
        border-radius: 0;
    }
}

/* ── Header ─────────────────────────────────────────────────── */
.vsm-header {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background-color: var(--color-brand-primary, #7ab52a);
    color: #000;
    padding: 12px 16px;
    border-radius: 0;
    font-size: 15px;
    font-weight: 700;
    text-align: center;
}

#vsm-title {
    flex: 1;
    text-align: center;
}

.vsm-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #000;
    padding: 4px;
    display: flex;
    align-items: center;
    opacity: 0.85;
    transition: opacity 0.15s;
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
}
.vsm-close:hover { opacity: 1; }

/* ── Body ───────────────────────────────────────────────────── */
.vsm-body {
    padding: 16px 16px 8px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.vsm-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.vsm-label {
    font-size: 13px;
    font-weight: 600;
    color: #777;
}
.vsm-required { color: #c0392b; margin-left: 2px; }

/* Base select height so native <select> (fallback) and Select2 tengan misma altura */
.vsm-select {
    height: 30px;
}

@media (min-width: 768px) {
    .vsm-body {
        padding: 24px 48px 12px;
    }
    .vsm-field {
        flex-direction: row;
        align-items: center;
        gap: 24px;
    }
    .vsm-label {
        width: 160px;
        text-align: left;
        white-space: nowrap;
    }
    .vsm-select {
        width: 100%;
    }
}

/* ── Footer ─────────────────────────────────────────────────── */
.vsm-footer {
    padding: 12px 16px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}
.vsm-btn-clear {
    background-color: transparent;
    color: #000;
    border: 1px solid #ccc;
    border-radius: 0;
    padding: 8px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}
.vsm-btn-clear:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.vsm-btn-search {
    background-color: var(--color-brand-primary, #7ab52a);
    color: #000;
    border: none;
    border-radius: 0;
    padding: 10px 28px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
    font-family: inherit;
}
.vsm-btn-search:disabled { opacity: 0.5; cursor: not-allowed; }
.vsm-btn-search:not(:disabled):hover { background-color: #6aa020; }


/* =============================================================
   Select2 — theme "vsm"
   Overrides Select2 default styles to match the Figma design
   ============================================================= */

/* Container */
.select2-container--vsm .select2-selection--single {
    height: 30px;
    border: 1px solid #ccc;
    border-radius: 0;
    background: #fff;
    display: flex;
    align-items: center;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.select2-container--vsm.select2-container--open .select2-selection--single,
.select2-container--vsm .select2-selection--single:focus {
    border-color: var(--color-brand-primary, #7ab52a);
    box-shadow: 0 0 0 2px rgba(122,181,42,0.2);
    outline: none;
}
.select2-container--vsm .select2-selection--single .select2-selection__rendered {
    padding: 0 32px 0 12px;
    font-size: 14px;
    color: #333;
    line-height: 30px;
}
.select2-container--vsm .select2-selection--single .select2-selection__placeholder {
    color: #aaa;
}
.select2-container--vsm .select2-selection--single .select2-selection__arrow {
    height: 28px;
    right: 8px;
    width: 20px;
}
.select2-container--vsm .select2-selection--single .select2-selection__arrow b {
    border-color: #888 transparent transparent transparent;
    border-width: 5px 4px 0 4px;
    margin-top: -2px;
}
.select2-container--vsm.select2-container--open .select2-selection--single .select2-selection__arrow b {
    border-color: transparent transparent #888 transparent;
    border-width: 0 4px 5px 4px;
}

/* Clear button */
.select2-container--vsm .select2-selection__clear {
    font-size: 18px;
    line-height: 1;
    color: #aaa;
    margin-right: 6px;
    font-weight: 400;
}
.select2-container--vsm .select2-selection__clear:hover { color: #888; }

/* Disabled state */
.select2-container--vsm.select2-container--disabled .select2-selection--single {
    background: #f5f5f5;
    border-color: #ddd;
    cursor: not-allowed;
}
.select2-container--vsm.select2-container--disabled .select2-selection--single .select2-selection__rendered {
    color: #aaa;
}

/* Dropdown */
.select2-container--vsm .select2-dropdown {
    border: 1px solid #ccc;
    border-radius: 0;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    font-size: 14px;
    z-index: 10001;
}
.select2-container--vsm .select2-search--dropdown {
    padding: 6px 8px;
    border-bottom: 1px solid #eee;
}
.select2-container--vsm .select2-search--dropdown .select2-search__field {
    border: 1px solid #ccc;
    border-radius: 0;
    padding: 5px 8px;
    font-size: 13px;
    width: 100%;
    box-sizing: border-box;
    outline: none;
}
.select2-container--vsm .select2-search--dropdown .select2-search__field:focus {
    border-color: var(--color-brand-primary, #7ab52a);
}

/* Options */
.select2-container--vsm .select2-results__option {
    padding: 9px 14px;
    font-size: 14px;
    color: #333;
    transition: background 0.1s;
}
.select2-container--vsm .select2-results__option--highlighted[aria-selected] {
    background-color: #f0f7e6;
    color: var(--color-brand-primary, #7ab52a);
}
.select2-container--vsm .select2-results__option[aria-selected="true"] {
    background-color: #e8f4d4;
    font-weight: 700;
    color: var(--color-brand-primary, #7ab52a);
}
.select2-container--vsm .select2-results__message {
    color: #888;
    font-size: 13px;
    padding: 10px 14px;
    text-align: center;
}

/* Keep dropdown inside modal on mobile */
#vehicle-search-modal .select2-container {
    width: 100% !important;
}

/* ── Toolbar vehicle label ───────────────────────────────── */
.toolbar-amount {
    display: block;
}
.toolbar-amount .toolbar-amount-count {
    display: block;
}
.vsm-toolbar-vehicle {
    display: block;
    font-size: inherit;
    color: var(--color-text-secondary, inherit);
    line-height: 1.4;
    margin-top: 4px;
}
