/* ==========================================================================
   AutoBaza - Advanced Car Comparison (Dvoboj Modela) CSS
   ========================================================================== */

.compare-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 16px 64px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: #1f2937;
}

/* Breadcrumbs & Header Title */
.compare-header {
    text-align: center;
    margin-bottom: 32px;
}

.compare-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: linear-gradient(135deg, rgba(106, 20, 44, 0.08), rgba(220, 38, 38, 0.08));
    color: #6a142c;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.compare-title {
    font-size: 32px;
    font-weight: 800;
    color: #111827;
    margin: 0 0 8px;
    letter-spacing: -0.5px;
}

.compare-subtitle {
    font-size: 16px;
    color: #6b7280;
    margin: 0 auto;
    max-width: 600px;
}

/* Type Toggle (SUS vs EV) */
.compare-type-toggle {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.type-toggle-btn {
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    color: #4b5563;
}

.type-toggle-btn.active {
    background: #6a142c;
    color: #ffffff;
    border-color: #6a142c;
    box-shadow: 0 4px 12px rgba(106, 20, 44, 0.25);
}

.type-toggle-btn--ev.active {
    background: #0284c7;
    border-color: #0284c7;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
}

/* ==========================================================================
   Hero Battle Card (Sticky / Side-by-Side)
   ========================================================================== */

.battle-arena {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 20px;
    align-items: stretch;
    margin-bottom: 36px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.01);
    position: relative;
}

.car-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: #f9fafb;
    border: 1px solid #f3f4f6;
    border-radius: 16px;
    padding: 20px;
    transition: all 0.3s ease;
}

.car-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.06);
    border-color: #e5e7eb;
}

.car-card__image-wrap {
    width: 100%;
    aspect-ratio: 16/10;
    border-radius: 12px;
    overflow: hidden;
    background: #e5e7eb;
    margin-bottom: 16px;
    position: relative;
}

.car-card__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.car-card:hover .car-card__image {
    transform: scale(1.03);
}

.car-card__brand {
    font-size: 13px;
    font-weight: 700;
    color: #6a142c;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.car-card__model {
    font-size: 20px;
    font-weight: 800;
    color: #111827;
    margin: 0 0 6px;
    line-height: 1.2;
}

.car-card__trim {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 12px;
    min-height: 18px;
}

.car-card__price {
    font-size: 22px;
    font-weight: 800;
    color: #111827;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    padding: 6px 16px;
    border-radius: 999px;
    margin-bottom: 16px;
}

.car-card__select-btn {
    width: 100%;
    padding: 10px 16px;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.car-card__select-btn:hover {
    background: #6a142c;
    color: #ffffff;
    border-color: #6a142c;
}

/* VS Badge in Middle */
.battle-vs {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
}

.battle-vs__circle {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #6a142c, #dc2626);
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 16px;
    box-shadow: 0 6px 16px rgba(106, 20, 44, 0.35);
    border: 3px solid #ffffff;
}

/* ==========================================================================
   Battle Gauges (Key Metric Differentials)
   ========================================================================== */

.gauges-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    padding: 28px;
    margin-bottom: 36px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.03);
}

.gauges-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    border-bottom: 1px solid #f3f4f6;
    padding-bottom: 16px;
}

.gauges-card__title {
    font-size: 20px;
    font-weight: 800;
    color: #111827;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.gauge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
}

.gauge-item {
    background: #f9fafb;
    border: 1px solid #f3f4f6;
    border-radius: 14px;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.gauge-item__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.gauge-item__label {
    font-size: 14px;
    font-weight: 700;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 6px;
}

.gauge-item__diff-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    background: #dcfce7;
    color: #15803d;
}

.gauge-item__diff-badge--tie {
    background: #f3f4f6;
    color: #6b7280;
}

.gauge-item__values {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    font-size: 16px;
    font-weight: 800;
}

.gauge-val {
    padding: 8px 12px;
    border-radius: 8px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.gauge-val--winner {
    background: rgba(34, 197, 94, 0.08);
    border-color: #22c55e;
    color: #15803d;
}

.gauge-val__name {
    font-size: 11px;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
}

.gauge-val__num {
    font-size: 15px;
    font-weight: 800;
}

/* ==========================================================================
   AI Battle Judge & Assistant Card
   ========================================================================== */

.ai-judge-card {
    background: linear-gradient(135deg, #ffffff 0%, #fdf2f4 100%);
    border: 2px solid #fbcfe8;
    border-radius: 20px;
    padding: 26px;
    margin-bottom: 36px;
    box-shadow: 0 12px 28px -6px rgba(106, 20, 44, 0.08);
    position: relative;
    overflow: hidden;
}

.ai-judge-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #6a142c, #dc2626, #f59e0b, #6a142c);
    background-size: 300% 100%;
    animation: gradientFlow 4s ease infinite;
}

@keyframes gradientFlow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.ai-judge-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    flex-wrap: wrap;
    gap: 12px;
}

.ai-judge-card__title-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-judge-badge {
    background: #6a142c;
    color: #ffffff;
    font-size: 11px;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.ai-judge-card__title {
    font-size: 19px;
    font-weight: 800;
    color: #111827;
    margin: 0;
}

.ai-verdict-box {
    background: #ffffff;
    border: 1px solid #f3e8eb;
    border-radius: 14px;
    padding: 20px;
    color: #374151;
    font-size: 14.5px;
    line-height: 1.65;
    margin-bottom: 20px;
    min-height: 80px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.02);
}

.ai-verdict-box p {
    margin: 0 0 10px;
}

.ai-verdict-box p:last-child {
    margin-bottom: 0;
}

.ai-verdict-box strong {
    color: #111827;
    font-weight: 700;
}

/* Loading shimmer */
.ai-loading-shimmer {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px 0;
}

.ai-shimmer-line {
    height: 14px;
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 6px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Quick Questions Chips */
.ai-quick-questions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.ai-quick-btn {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    padding: 7px 14px;
    font-size: 12.5px;
    font-weight: 600;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.ai-quick-btn:hover {
    background: #fdf2f4;
    border-color: #fbcfe8;
    color: #6a142c;
    transform: translateY(-1px);
}

/* Custom Question Box */
.ai-question-form {
    display: flex;
    gap: 10px;
}

.ai-question-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    font-size: 13.5px;
    outline: none;
    background: #ffffff;
    transition: border-color 0.2s ease;
}

.ai-question-input:focus {
    border-color: #6a142c;
    box-shadow: 0 0 0 3px rgba(106, 20, 44, 0.12);
}

.ai-ask-btn {
    padding: 0 20px;
    background: #6a142c;
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.ai-ask-btn:hover {
    background: #500e20;
    box-shadow: 0 4px 12px rgba(106, 20, 44, 0.25);
}

.ai-ask-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ==========================================================================
   Categorized Detailed Specifications Table
   ========================================================================== */

.specs-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.spec-category-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.02);
}

.spec-category-card__header {
    background: #f9fafb;
    padding: 16px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}

.spec-category-card__title {
    font-size: 17px;
    font-weight: 800;
    color: #111827;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.spec-category-card__toggle-icon {
    font-size: 14px;
    color: #6b7280;
    transition: transform 0.2s ease;
}

.spec-category-card.collapsed .spec-category-card__toggle-icon {
    transform: rotate(-90deg);
}

.spec-category-card.collapsed .spec-table {
    display: none;
}

.spec-table {
    width: 100%;
    border-collapse: collapse;
}

.spec-table tr {
    border-bottom: 1px solid #f3f4f6;
    transition: background 0.15s ease;
}

.spec-table tr:last-child {
    border-bottom: none;
}

.spec-table tr:hover {
    background: #f9fafb;
}

.spec-table td {
    padding: 14px 20px;
    font-size: 14px;
    vertical-align: middle;
}

.spec-cell--name {
    width: 34%;
    font-weight: 600;
    color: #4b5563;
}

.spec-cell--val1, .spec-cell--val2 {
    width: 33%;
    font-weight: 700;
    color: #111827;
    text-align: center;
}

.spec-cell--winner {
    color: #15803d;
    background: rgba(34, 197, 94, 0.05);
    font-weight: 800;
}

.winner-icon {
    display: inline-block;
    margin-left: 4px;
    color: #16a34a;
    font-size: 12px;
}

/* ==========================================================================
   Car Picker Modal
   ========================================================================== */

.picker-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 16px;
}

.picker-modal.open {
    display: flex;
}

.picker-modal__content {
    background: #ffffff;
    border-radius: 20px;
    width: 100%;
    max-width: 580px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: modalSlideUp 0.25s ease-out;
}

@keyframes modalSlideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.picker-modal__header {
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.picker-modal__title {
    font-size: 18px;
    font-weight: 800;
    color: #111827;
    margin: 0;
}

.picker-modal__close {
    background: #f3f4f6;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #4b5563;
    transition: background 0.2s ease;
}

.picker-modal__close:hover {
    background: #e5e7eb;
    color: #111827;
}

.picker-modal__search-box {
    padding: 16px 24px 8px;
}

.picker-modal__search-input {
    width: 100%;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid #d1d5db;
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
}

.picker-modal__search-input:focus {
    border-color: #6a142c;
    box-shadow: 0 0 0 3px rgba(106, 20, 44, 0.15);
}

.picker-modal__list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.picker-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid #f3f4f6;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.picker-item:hover {
    background: #f9fafb;
    border-color: #e5e7eb;
    transform: translateX(4px);
}

.picker-item__thumb {
    width: 65px;
    height: 45px;
    border-radius: 8px;
    object-fit: cover;
    background: #e5e7eb;
}

.picker-item__info {
    flex: 1;
}

.picker-item__name {
    font-size: 14px;
    font-weight: 700;
    color: #111827;
    margin: 0;
}

.picker-item__meta {
    font-size: 12px;
    color: #6b7280;
    margin: 2px 0 0;
}

.picker-item__price {
    font-size: 13px;
    font-weight: 800;
    color: #6a142c;
}

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

@media (max-width: 768px) {
    .compare-page {
        padding: 16px 12px 48px;
    }

    .compare-title {
        font-size: 24px;
    }

    .battle-arena {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
        padding: 14px;
        position: relative;
    }

    .battle-vs {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        z-index: 2;
    }

    .battle-vs__circle {
        width: 36px;
        height: 36px;
        font-size: 13px;
    }

    .car-card {
        padding: 12px;
    }

    .car-card__model {
        font-size: 16px;
    }

    .car-card__price {
        font-size: 16px;
        padding: 4px 10px;
    }

    .car-card__select-btn {
        padding: 8px 10px;
        font-size: 12px;
    }

    .gauge-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .gauges-card {
        padding: 18px 14px;
    }

    .spec-table td {
        padding: 10px 8px;
        font-size: 12px;
    }

    .spec-cell--name {
        width: 38%;
        font-size: 11px;
    }

    .spec-cell--val1, .spec-cell--val2 {
        width: 31%;
        font-size: 12px;
    }
}
