/* ========== Vehicle Search Widget ========== */

.vehicle-search-widget {
    padding: 0;
}

.vehicle-search-form {
    background: transparent;
    padding: 14px 20px;
}

.vehicle-search-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.vehicle-search-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: #fff;
    flex-shrink: 0;
    margin-right: 6px;
}

.vehicle-search-label .fa {
    font-size: 28px;
}

.vehicle-search-label span {
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.vehicle-select {
    flex: 1;
    min-width: 130px;
    padding: 9px 12px;
    border: none;
    border-radius: 3px;
    font-size: 13px;
    background: rgba(255,255,255,0.9);
    color: #333;
    appearance: auto;
    outline: none;
    transition: background 0.15s;
}

.vehicle-select:focus {
    background: #fff;
}

.vehicle-select:disabled {
    background: rgba(255,255,255,0.5);
    color: #999;
    cursor: not-allowed;
}

.vehicle-search-btn {
    padding: 9px 20px;
    background: #fff;
    color: #2fb5d2;
    border: none;
    border-radius: 3px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}

.vehicle-search-btn:hover:not(:disabled) {
    background: #f0f0f0;
}

.vehicle-search-btn:disabled {
    background: rgba(255,255,255,0.3);
    color: rgba(255,255,255,0.6);
    cursor: not-allowed;
}

/* ========== Vehicle Bar (selected vehicle) ========== */

.vehicle-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 20px;
    background: transparent;
    font-size: 13px;
    flex-wrap: wrap;
}

.vehicle-bar__icon {
    color: #fff;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    font-size: 28px;
}

.vehicle-bar__info {
    display: flex;
    align-items: baseline;
    gap: 6px;
    min-width: 0;
    flex: 1;
    flex-wrap: wrap;
}

.vehicle-bar__brand {
    font-weight: 700;
    font-size: 14px;
    color: #fff;
}

.vehicle-bar__model {
    font-size: 13px;
    color: rgba(255,255,255,0.85);
}

.vehicle-bar__engine {
    font-size: 12px;
    color: rgba(255,255,255,0.6);
}

.vehicle-bar__actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.vehicle-bar__btn {
    padding: 6px 14px;
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 3px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    background: transparent;
    color: #fff;
    transition: background 0.15s, border-color 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    line-height: 1.4;
}

.vehicle-bar__btn:hover {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.6);
    color: #fff;
}

.vehicle-bar__btn--search {
    background: #fff;
    color: #2fb5d2;
    border-color: #fff;
    font-weight: 600;
}

.vehicle-bar__btn--search:hover {
    background: #f0f0f0;
    border-color: #f0f0f0;
    color: #2fb5d2;
}

.vehicle-bar__btn--save {
    color: #fff;
}

.vehicle-bar__btn--save.saved {
    color: rgba(255,255,255,0.5);
    border-color: rgba(255,255,255,0.2);
    background: transparent;
    cursor: default;
}

.vehicle-bar__btn--change {
    color: #fff;
}

.vehicle-bar__btn--clear {
    background: none;
    border: none;
    font-size: 16px;
    color: rgba(255,255,255,0.6);
    padding: 4px 8px;
    line-height: 1;
}

.vehicle-bar__btn--clear:hover {
    color: #fff;
}

/* Legacy v1 styles kept for backward compat */
.vehicle-selected { display: none; }
.vehicle-selected-label,
.vehicle-clear-btn,
.vehicle-change-btn { display: none; }

/* ========== Garage Dropdown (widget) ========== */

.vehicle-garage-dropdown {
    position: relative;
    display: inline-block;
}

.vehicle-garage-dropdown__toggle {
    padding: 6px 14px;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 3px;
    font-size: 12px;
    font-weight: 500;
    color: #fff;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.vehicle-garage-dropdown__toggle:hover {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.6);
    color: #fff;
}

.vehicle-garage-dropdown__arrow {
    font-size: 10px;
    margin-left: 4px;
    transition: transform 0.2s;
}

.vehicle-garage-dropdown.open .vehicle-garage-dropdown__arrow {
    transform: rotate(180deg);
}

.vehicle-garage-dropdown__menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 100;
    min-width: 260px;
    margin-top: 2px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 3px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.vehicle-garage-dropdown.open .vehicle-garage-dropdown__menu {
    display: block;
}

.vehicle-garage-dropdown__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.1s;
}

.vehicle-garage-dropdown__item:last-child {
    border-bottom: none;
}

.vehicle-garage-dropdown__item:hover {
    background: #f5f5f5;
}

.vehicle-garage-dropdown__item--active {
    background: #f5f5f5;
    border-left: 3px solid #2fb5d2;
}

.vehicle-garage-dropdown__item--active:hover {
    background: #eee;
}

.vehicle-garage-dropdown__item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.vehicle-garage-dropdown__item-brand {
    font-weight: 600;
    font-size: 13px;
    color: #222;
}

.vehicle-garage-dropdown__item-model {
    font-size: 12px;
    color: #555;
}

.vehicle-garage-dropdown__item-nick {
    font-size: 11px;
    color: #999;
    font-style: italic;
}

.vehicle-garage-dropdown__badge {
    display: inline-block;
    padding: 1px 6px;
    background: #2fb5d2;
    color: #fff;
    font-size: 10px;
    font-weight: 500;
    border-radius: 2px;
    margin-top: 2px;
    width: fit-content;
}

.vehicle-garage-dropdown__item-remove {
    background: none;
    border: none;
    font-size: 15px;
    color: #bbb;
    cursor: pointer;
    padding: 2px 4px;
    line-height: 1;
    flex-shrink: 0;
}

.vehicle-garage-dropdown__item-remove:hover {
    color: #c00;
}

/* ========== Garage Form Dropdown (in search widget) ========== */

.vehicle-garage-dropdown--form {
    position: relative;
    display: inline-block;
}

.vehicle-garage-form__toggle {
    padding: 9px 14px;
    font-size: 16px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.vehicle-garage-dropdown--form .vehicle-garage-dropdown__menu {
    right: 0;
    left: auto;
}

/* ========== Compatibility Section ========== */

.vehicle-compatibility-section {
    margin: 15px 0;
}

/* ========== Badge (product page) ========== */

.vehicle-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 3px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 12px;
}

.vehicle-badge--ok {
    background: #f0f7f0;
    border: 1px solid #c8dcc8;
    color: #2d6a2d;
}

.vehicle-badge--no {
    background: #fdf5f0;
    border: 1px solid #e0ccc0;
    color: #8a4a00;
}

.vehicle-badge--universal {
    background: #eef8fb;
    border: 1px solid #b8dfe8;
    color: #1a7f96;
}

.vehicle-badge--universal .vehicle-badge__icon {
    color: #1a7f96;
}

.vehicle-badge__icon {
    font-size: 16px;
    font-weight: bold;
    flex-shrink: 0;
}

/* ========== Accordion wrap ========== */

.vehicle-compat-wrap {
    border: 1px solid #ddd;
    border-radius: 3px;
    overflow: hidden;
}

.vehicle-compat-title {
    margin: 0;
    padding: 10px 14px;
    background: #f7f7f7;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    border-bottom: 1px solid #ddd;
}

/* ========== Accordion items ========== */

.vehicle-accord-item {
    border-bottom: 1px solid #eee;
}

.vehicle-accord-item:last-child {
    border-bottom: none;
}

.vehicle-accord-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    cursor: pointer;
    user-select: none;
    background: #fff;
    transition: background 0.1s;
}

.vehicle-accord-head:hover {
    background: #fafafa;
}

.vehicle-accord-brand {
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

.vehicle-accord-count {
    font-weight: 400;
    color: #999;
    margin-left: 3px;
}

.vehicle-accord-arrow {
    font-size: 10px;
    color: #aaa;
    transition: transform 0.2s;
}

.vehicle-accord-head.open .vehicle-accord-arrow {
    transform: rotate(180deg);
}

.vehicle-accord-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.vehicle-accord-body.open {
    max-height: 3000px;
}

/* Client's brand */
.vehicle-accord-item--mine > .vehicle-accord-head {
    background: #f5f5f5;
}

.vehicle-accord-item--mine > .vehicle-accord-head:hover {
    background: #eee;
}

.vehicle-accord-item--mine > .vehicle-accord-head .vehicle-accord-brand {
    color: #222;
}

/* ========== Vehicle Table (inside accordion) ========== */

.vehicle-table-wrap {
    border: 1px solid #ddd;
    border-radius: 3px;
    overflow: hidden;
}

.vehicle-table-title {
    margin: 0;
    padding: 10px 14px;
    background: #f7f7f7;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    border-bottom: 1px solid #ddd;
}

.vehicle-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.vehicle-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.vehicle-table th {
    background: #f7f7f7;
    padding: 8px 10px;
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    color: #777;
    letter-spacing: 0.3px;
    border-bottom: 1px solid #ddd;
    white-space: nowrap;
}

.vehicle-table td {
    padding: 7px 10px;
    border-bottom: 1px solid #f0f0f0;
    color: #444;
}

.vehicle-table tbody tr:hover td {
    background: #fafafa;
}

/* Row highlight — client's vehicle */
.vehicle-table tr.vehicle-row--mine td {
    background: #f5f5f5;
    font-weight: 500;
    color: #222;
}

.vehicle-table tr.vehicle-row--mine:hover td {
    background: #eee;
}

.vehicle-tag-mine {
    display: inline-block;
    margin-left: 4px;
    padding: 1px 6px;
    background: #2fb5d2;
    color: #fff;
    font-size: 10px;
    font-weight: 500;
    border-radius: 2px;
    vertical-align: middle;
    white-space: nowrap;
}

/* ========== Results Page ========== */

.vehicle-results-page {
    padding: 20px 0;
}

.vehicle-results-header {
    margin-bottom: 20px;
    padding: 12px 14px;
    background: #f7f7f7;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.vehicle-results-count {
    font-weight: 600;
    margin-bottom: 16px;
    color: #333;
}

.vehicle-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

.vehicle-product-card {
    border: 1px solid #eee;
    border-radius: 3px;
    overflow: hidden;
    transition: box-shadow 0.15s;
}

.vehicle-product-card:hover {
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
}

.vehicle-product-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.vehicle-product-image {
    width: 100%;
    height: 200px;
    object-fit: contain;
    background: #fafafa;
}

.vehicle-product-info {
    padding: 10px;
}

.vehicle-product-name {
    font-size: 13px;
    font-weight: 600;
    margin: 0 0 4px;
    color: #333;
    line-height: 1.3;
}

.vehicle-product-ref {
    display: block;
    font-size: 11px;
    color: #999;
    margin-bottom: 4px;
}

.vehicle-product-price {
    display: block;
    font-size: 15px;
    font-weight: 700;
    color: #222;
}

.vehicle-results-empty {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.vehicle-results-empty .btn {
    margin-top: 16px;
}

/* ========== Category Info Box (Feature 4) ========== */

.vehicle-category-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 3px;
    margin-bottom: 14px;
    font-size: 13px;
    color: #333;
    background: #f7f7f7;
    border: 1px solid #ddd;
    transition: background 0.2s, border-color 0.2s;
}

.vehicle-category-info__icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    color: #555;
}

.vehicle-category-info__text {
    flex: 1;
    min-width: 0;
    line-height: 1.4;
}

.vehicle-category-info__text strong {
    color: #222;
}

/* Variant: compatible products found */
.vehicle-category-info--found {
    background: #f0f7f0;
    border-color: #c8dcc8;
}

.vehicle-category-info--found .vehicle-category-info__icon {
    color: #2d6a2d;
}

.vehicle-category-info--found .vehicle-category-info__text strong {
    color: #2d6a2d;
}

/* Variant: no compatible products — hide entirely */
.vehicle-category-info--empty {
    display: none;
}

/* ========== Category Toggle (Feature 4) ========== */

.vehicle-category-toggle {
    display: none; /* hidden until JS adds --found */
    align-items: center;
    gap: 6px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: auto;
    user-select: none;
}

.vehicle-category-info--found .vehicle-category-toggle {
    display: flex;
}

.vehicle-category-toggle input[type="checkbox"] {
    position: relative;
    width: 32px;
    height: 18px;
    -webkit-appearance: none;
    appearance: none;
    background: #ccc;
    border-radius: 9px;
    outline: none;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
    margin: 0;
}

.vehicle-category-toggle input[type="checkbox"]::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}

.vehicle-category-toggle input[type="checkbox"]:checked {
    background: #2fb5d2;
}

.vehicle-category-toggle input[type="checkbox"]:checked::before {
    transform: translateX(14px);
}

.vehicle-category-toggle__label {
    font-size: 12px;
    font-weight: 500;
    color: #555;
}

.vehicle-category-info--found .vehicle-category-toggle__label {
    color: #2d6a2d;
}

/* ========== Listing Badge (Feature 5) ========== */

.vehicle-listing-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    padding: 2px 8px;
    background: #2fb5d2;
    color: #fff;
    border-radius: 2px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.4;
    z-index: 2;
    white-space: nowrap;
    letter-spacing: 0.2px;
    text-transform: uppercase;
}

.vehicle-listing-badge--universal {
    background: #2fb5d2;
    color: #fff;
}

/* Inline badge variant (inside info box text) */
.vehicle-listing-badge-inline {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 6px;
    background: #2fb5d2;
    color: #fff;
    border-radius: 2px;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
    vertical-align: middle;
    text-transform: uppercase;
}

/* Ensure thumbnail/image container is positioned for absolute badge */
.js-product-miniature .thumbnail-container,
.js-product-miniature .product-thumbnail,
.js-product-miniature .thumbnail,
.elementor-product-miniature .elementor-image,
.product-miniature .thumbnail-container,
.product-miniature .product-thumbnail,
[data-id-product] .elementor-image,
[data-id-product] .thumbnail-container {
    position: relative;
}

/* ========== Compatible product highlight ========== */

.js-product-miniature.vehicle-compatible,
.elementor-product-miniature.vehicle-compatible,
.product-miniature.vehicle-compatible,
[data-id-product].vehicle-compatible {
    outline: 2px solid #2fb5d2;
    outline-offset: -2px;
    border-radius: 3px;
    transition: outline-color 0.2s;
}

/* ========== Garage Page (Feature 3) ========== */

.vehicle-garage-page {
    max-width: 700px;
    margin: 0 auto;
}

.vehicle-garage-page h1 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #222;
}

.vehicle-garage-cards {
    display: grid;
    gap: 0;
    margin-bottom: 24px;
    border: 1px solid #ddd;
    border-radius: 3px;
    overflow: hidden;
}

.vehicle-garage-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: #fff;
    border-bottom: 1px solid #eee;
    flex-wrap: wrap;
    gap: 10px;
}

.vehicle-garage-card:last-child {
    border-bottom: none;
}

.vehicle-garage-card:hover {
    background: #fafafa;
}

.vehicle-garage-card--active {
    background: #f5f5f5;
    border-left: 3px solid #2fb5d2;
}

.vehicle-garage-card__info {
    flex: 1;
    min-width: 0;
}

.vehicle-garage-card__brand {
    font-weight: 600;
    font-size: 14px;
    color: #222;
    display: inline;
}

.vehicle-garage-card__model {
    font-size: 13px;
    color: #444;
    display: inline;
    margin-left: 4px;
}

.vehicle-garage-card__engine {
    font-size: 12px;
    color: #888;
    margin-top: 2px;
}

.vehicle-garage-card__nickname {
    font-size: 12px;
    color: #888;
    font-style: italic;
    margin-top: 2px;
}

.vehicle-garage-card__badge {
    display: inline-block;
    padding: 1px 6px;
    background: #2fb5d2;
    color: #fff;
    font-size: 10px;
    font-weight: 500;
    border-radius: 2px;
    margin-left: 6px;
    vertical-align: middle;
}

.vehicle-garage-card__actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.vehicle-garage-card__btn {
    padding: 4px 10px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 400;
    cursor: pointer;
    background: #fff;
    color: #555;
    transition: background 0.15s;
    white-space: nowrap;
}

.vehicle-garage-card__btn:hover {
    background: #f0f0f0;
}

.vehicle-garage-card__btn--activate {
    background: #2fb5d2;
    color: #fff;
    border-color: #2fb5d2;
}

.vehicle-garage-card__btn--activate:hover {
    background: #249aab;
}

.vehicle-garage-card__btn--rename {
    color: #555;
}

.vehicle-garage-card__btn--remove {
    color: #999;
    border-color: #ddd;
}

.vehicle-garage-card__btn--remove:hover {
    color: #c00;
    border-color: #c00;
}

/* Garage page: Add vehicle section */
.vehicle-garage-add {
    padding: 16px;
    border: 1px solid #ddd;
    border-radius: 3px;
    background: #fafafa;
}

.vehicle-garage-add h3 {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 12px;
    color: #333;
}

.vehicle-garage-add .vehicle-search-row {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.vehicle-garage-max {
    text-align: center;
    padding: 14px;
    color: #999;
    font-size: 12px;
}

/* ========== Customer Account Link ========== */

.vehicle-account-link {
    display: flex;
    align-items: center;
    gap: 8px;
}

.vehicle-account-link i,
.vehicle-account-link .material-icons {
    font-size: 20px;
    color: #555;
}

/* ========== Responsive ========== */

@media (max-width: 768px) {
    .vehicle-search-form {
        padding: 12px;
    }

    .vehicle-search-row {
        flex-direction: column;
    }

    .vehicle-search-label {
        flex-direction: row;
        gap: 8px;
        margin-right: 0;
        margin-bottom: 4px;
        width: 100%;
    }

    .vehicle-search-label .fa {
        font-size: 22px;
    }

    .vehicle-select,
    .vehicle-search-btn {
        width: 100%;
        min-width: auto;
    }

    .vehicle-bar {
        flex-direction: column;
        align-items: flex-start;
        padding: 12px;
    }

    .vehicle-bar__icon {
        font-size: 22px;
    }

    .vehicle-bar__info {
        flex-direction: column;
        gap: 1px;
        width: 100%;
    }

    .vehicle-bar__actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .vehicle-bar__btn--search {
        flex: 1;
    }

    .vehicle-results-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 12px;
    }

    .vehicle-table {
        font-size: 11px;
    }

    .vehicle-table th,
    .vehicle-table td {
        padding: 6px 8px;
    }

    .vehicle-tag-mine {
        display: block;
        margin-left: 0;
        margin-top: 3px;
        width: fit-content;
    }

    .vehicle-badge {
        font-size: 12px;
        padding: 6px 10px;
    }

    .vehicle-garage-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .vehicle-garage-card__actions {
        width: 100%;
    }

    .vehicle-garage-dropdown__menu {
        min-width: 220px;
        right: 0;
        left: auto;
    }

    .vehicle-category-info {
        flex-wrap: wrap;
    }

    .vehicle-category-toggle {
        margin-left: 0;
        width: 100%;
        justify-content: flex-start;
        margin-top: 4px;
    }
}
