/* So sánh xe — VinFast layout */

.vf-compare {
    --vf-blue: #1464f4;
    --vf-text: #151515;
    --vf-muted: #6b7280;
    --vf-border: #e5e7eb;
    --vf-row: #f5f6f8;
    --vf-slot: #eef4ff;
    --vf-label-col: minmax(200px, 1.15fr);
    --vf-car-cols: 3;
    font-family: 'Mulish', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--vf-text);
    background: #fff;
    padding: 32px 0 72px;
    -webkit-font-smoothing: antialiased;
}
.vf-compare *,
.vf-compare *::before,
.vf-compare *::after {
    box-sizing: border-box;
}

.vf-compare__container {
    width: 100%;
    max-width: var(--width-container, 1440px);
    margin: 0 auto;
    padding: 0 15px;
    align-items: stretch;
}

.vf-compare__header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 28px;
}
.vf-compare__title {
    margin: 0 0 8px;
    font-size: clamp(28px, 4vw, 40px);
    font-weight: 700;
    line-height: 1.2;
}
.vf-compare__desc {
    margin: 0;
    font-size: 15px;
    color: var(--vf-muted);
    max-width: 520px;
}
.vf-compare__filter {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--vf-muted);
}
.vf-compare__select {
    min-width: 160px;
    height: 40px;
    padding: 0 36px 0 14px;
    border: 1px solid var(--vf-border);
    border-radius: 4px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 12px center;
    appearance: none;
    font: inherit;
    color: var(--vf-text);
    cursor: pointer;
}
.vf-compare__results[hidden],
.vf-compare__filter[hidden] {
    display: none !important;
}
.vf-compare__results {
    margin-top: 8px;
    animation: vfCompareFade 0.35s ease;
}
@keyframes vfCompareFade {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Picker slots — mặc định 3 cột; khi so sánh: cột nhãn + N cột xe */
.vf-compare__pickers {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px 16px;
    margin-bottom: 28px;
    align-items: stretch;
}
.vf-compare__label-col {
    display: none;
}
.vf-compare.is-comparing {
    --vf-car-cols: 3;
}
.vf-compare.is-comparing[data-cars="2"] {
    --vf-car-cols: 2;
}
.vf-compare.is-comparing .vf-compare__label-col {
    display: block;
}
.vf-compare.is-comparing[data-picker-cols="2"] .vf-compare__pickers {
    grid-template-columns: var(--vf-label-col) repeat(2, minmax(0, 1fr));
}
.vf-compare.is-comparing[data-picker-cols="3"] .vf-compare__pickers {
    grid-template-columns: var(--vf-label-col) repeat(3, minmax(0, 1fr));
}
/* Ẩn cột xe thừa trên BẢNG theo số xe đã chọn */
.vf-compare.is-comparing[data-cars="2"] .vf-compare__cell[data-slot="2"] {
    display: none !important;
}
/* Ẩn ô picker thừa */
.vf-compare.is-comparing[data-picker-cols="2"] .vf-compare__slot[data-slot="2"] {
    display: none !important;
}

.vf-compare__slot {
    position: relative;
    min-height: 220px;
    border: 1px solid #c5d8ff;
    border-radius: 4px;
    background: var(--vf-slot);
    overflow: hidden;
}
.vf-compare__slot.is-filled {
    background: #fff;
    border-color: var(--vf-border);
}
.vf-compare__picker {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    width: 100%;
    height: 100%;
    min-height: 220px;
    padding: 24px;
    border: 0;
    background: transparent;
    cursor: pointer;
    color: var(--vf-blue);
    font: inherit;
    position: relative;
    z-index: 1;
}
.vf-compare__picker-text {
    font-size: 16px;
    font-weight: 600;
}
.vf-compare__info {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 28px 16px 20px;
    height: 100%;
}
.vf-compare__info[hidden],
.vf-compare__picker[hidden] {
    display: none !important;
}
.vf-compare__remove {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: #f3f4f6;
    color: #374151;
    cursor: pointer;
}
.vf-compare__remove:hover {
    background: #e5e7eb;
}
.vf-compare__car-img {
    width: auto;
    max-width: 88%;
    height: 100px;
    object-fit: contain;
    margin-bottom: 10px;
}
.vf-compare__car-name {
    margin: 0 0 6px;
    font-size: 16px;
    font-weight: 700;
    white-space: pre-line;
}
.vf-compare__car-price {
    margin: 0 0 10px;
    font-size: 13px;
    color: var(--vf-muted);
}
.vf-compare__car-price[hidden] {
    display: none !important;
}
.vf-compare__detail {
    font-size: 14px;
    font-weight: 600;
    color: var(--vf-blue);
    text-decoration: none;
}
.vf-compare__detail:hover {
    text-decoration: underline;
}
.vf-compare__detail[hidden] {
    display: none !important;
}

/* Tabs */
.vf-compare__tabs {
    margin-bottom: 8px;
    border-bottom: 1px solid var(--vf-border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.vf-compare__tab-list {
    display: flex;
    flex-wrap: nowrap;
    gap: 0;
    list-style: none;
    margin: 0;
    padding: 0;
    min-width: max-content;
}
.vf-compare__tab a {
    display: block;
    padding: 14px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--vf-muted);
    text-decoration: none;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
}
.vf-compare__tab.is-active a,
.vf-compare__tab a:hover {
    color: var(--vf-blue);
    border-bottom-color: var(--vf-blue);
}

/* Accordion specs — cột 1: tên thông số, cột còn lại: từng xe */
.vf-compare__accordion {
    border-bottom: 1px solid var(--vf-border);
}
.vf-compare__acc-btn {
    display: grid;
    grid-template-columns: var(--vf-label-col) repeat(var(--vf-car-cols), minmax(0, 1fr));
    align-items: center;
    column-gap: 16px;
    width: 100%;
    padding: 16px 18px;
    border: 0;
    background: #eef0f3;
    font: inherit;
    font-size: 16px;
    font-weight: 700;
    color: var(--vf-text);
    cursor: pointer;
    text-align: left;
    position: relative;
}
.vf-compare__acc-label {
    grid-column: 1;
}
.vf-compare__acc-cars {
    grid-column: 2 / -1;
}
.vf-compare__chevron {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    transition: transform 0.25s ease;
    flex-shrink: 0;
}
.vf-compare__accordion.is-open .vf-compare__chevron {
    transform: translateY(-50%) rotate(180deg);
}
.vf-compare__acc-body {
    background: #fff;
}
.vf-compare__row {
    display: grid;
    grid-template-columns: var(--vf-label-col) repeat(var(--vf-car-cols), minmax(0, 1fr));
    column-gap: 16px;
    align-items: start;
    padding: 14px 18px;
    background: var(--vf-row);
}
.vf-compare__row:nth-child(even) {
    background: #fafbfc;
}
.vf-compare__row.is-hidden {
    display: none;
}
.vf-compare__row-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    line-height: 1.45;
}
.vf-compare__cell {
    font-size: 14px;
    line-height: 1.45;
    color: var(--vf-text);
    min-height: 1.45em;
    word-break: break-word;
}
.vf-compare__cell.is-empty {
    color: #9ca3af;
}

.vf-compare__notice {
    margin: 28px 0 0;
    font-size: 13px;
    color: var(--vf-muted);
    text-align: center;
}

/* Tools */
.vf-compare__tools {
    margin-top: 48px;
}
.vf-compare__tools-title {
    margin: 0 0 20px;
    font-size: 22px;
    font-weight: 700;
    text-align: center;
}
.vf-compare__tools-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}
.vf-compare__tool {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 120px;
    padding: 24px 16px;
    background: #f3f4f6;
    border-radius: 4px;
    text-decoration: none;
    color: var(--vf-text);
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    transition: background 0.2s ease, color 0.2s ease;
}
.vf-compare__tool:hover {
    background: #e8eefc;
    color: var(--vf-blue);
}
.vf-compare__tool-icon {
    color: var(--vf-blue);
}

/* Modal */
.vf-compare-modal[hidden] {
    display: none !important;
}
.vf-compare-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.vf-compare-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(21, 21, 21, 0.45);
}
.vf-compare-modal__dialog {
    position: relative;
    z-index: 1;
    width: min(560px, 100%);
    max-height: min(80vh, 720px);
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18);
    overflow: hidden;
}
.vf-compare-modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--vf-border);
}
.vf-compare-modal__title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
}
.vf-compare-modal__close {
    width: 36px;
    height: 36px;
    border: 0;
    background: transparent;
    font-size: 28px;
    line-height: 1;
    color: #6b7280;
    cursor: pointer;
}
.vf-compare-modal__body {
    padding: 16px 20px 8px;
    overflow-y: auto;
    flex: 1;
}
.vf-compare-modal__group + .vf-compare-modal__group {
    margin-top: 22px;
}
.vf-compare-modal__group-title {
    margin: 0 0 12px;
    font-size: 15px;
    font-weight: 700;
}
.vf-compare-modal__list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.vf-compare-modal__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 4px;
    cursor: pointer;
    font-size: 15px;
}
.vf-compare-modal__item input {
    width: 18px;
    height: 18px;
    accent-color: var(--vf-blue);
    flex-shrink: 0;
}
.vf-compare-modal__item.is-disabled {
    opacity: 0.4;
    pointer-events: none;
}
.vf-compare-modal__foot {
    padding: 14px 20px 18px;
    border-top: 1px solid var(--vf-border);
}
.vf-compare-modal__submit {
    display: block;
    width: 100%;
    height: 48px;
    border: 0;
    border-radius: 4px;
    background: var(--vf-blue);
    color: #fff;
    font: inherit;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.04em;
    cursor: pointer;
}
.vf-compare-modal__submit:hover {
    background: #0f54d4;
}

body.vf-compare-modal-open {
    overflow: hidden;
}

@media (max-width: 900px) {
    .vf-compare,
    .vf-compare.is-comparing,
    .vf-compare.is-comparing[data-cars="2"],
    .vf-compare.is-comparing[data-cars="3"] {
        --vf-label-col: minmax(140px, 0.9fr);
        --vf-car-cols: 2;
    }
    .vf-compare__pickers,
    .vf-compare.is-comparing .vf-compare__pickers {
        grid-template-columns: var(--vf-label-col) repeat(2, minmax(0, 1fr));
    }
    .vf-compare:not(.is-comparing) .vf-compare__pickers {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .vf-compare:not(.is-comparing) .vf-compare__label-col {
        display: none;
    }
    .vf-compare.is-comparing .vf-compare__label-col {
        display: block;
    }
    .vf-compare__slot[data-slot="2"],
    .vf-compare__cell[data-slot="2"] {
        display: none !important;
    }
    .vf-compare__tools-grid {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 640px) {
    .vf-compare__header {
        flex-direction: column;
        align-items: flex-start;
    }
    .vf-compare__pickers,
    .vf-compare.is-comparing .vf-compare__pickers,
    .vf-compare__row,
    .vf-compare__acc-btn {
        grid-template-columns: 1fr;
        row-gap: 10px;
    }
    .vf-compare__label-col {
        display: none !important;
    }
    .vf-compare__slot[data-slot="2"],
    .vf-compare__cell[data-slot="2"] {
        display: block !important;
    }
    .vf-compare.is-comparing[data-cars="2"] .vf-compare__slot[data-slot="2"],
    .vf-compare.is-comparing[data-cars="2"] .vf-compare__cell[data-slot="2"] {
        display: none !important;
    }
    .vf-compare__row-title {
        padding-bottom: 4px;
        border-bottom: 1px solid var(--vf-border);
    }
    .vf-compare__chevron {
        right: 12px;
    }
}
