/* Car Comparator Pro - Professional Styles */

/* Reset and Base Styles */
.car-comparator-pro * {
    box-sizing: border-box;
}

/* Comparison Button Styles */
.add-to-comparator {
    background: linear-gradient(135deg, #1E1E1E 0%, #2C2C2C 100%);
    color: #ffffff;
    border: 2px solid #3A3A3A;
    padding: 1px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.add-to-comparator:hover {
    background: linear-gradient(135deg, #2C2C2C 0%, #3A3A3A 100%);
    border-color: #4A4A4A;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.add-to-comparator:active {
    transform: translateY(0);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.add-to-comparator:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.add-to-comparator.added {
    background: linear-gradient(135deg, #20c997 0%, #0d0d0d 20%);
    border-color: #28a745;
}

.add-to-comparator.added:hover {
    background: linear-gradient(135deg, #20c997 0%, #0d0d0d 100%);
}

/* Comparison Bar Styles */
.car-comparator-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #2C2C2C;
    border-top: 1px solid #3A3A3A;
    z-index: 9999;
    padding: 12px 16px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    display: none; /* Hidden by default */
}

.car-comparator-bar.show {
    transform: translateY(0);
    display: block;
}

.comparator-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 100%;
    margin: 0;
    gap: 12px;
}

.comparator-label {
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    margin-right: 8px;
}

.selected-cars {
    display: flex;
    gap: 8px;
    flex: 1;
    
    padding: 0;
    min-height: 60px;
    align-items: center;
}

.selected-car-item {
    position: relative;
    background: #3A3A3A;
    border-radius: 6px;
    padding: 4px;
    min-width: 120px;
    width: 50px;
    height: 40px;
    flex-shrink: 0;
    border: 1px solid #4A4A4A;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.selected-car-item:hover {
    background: #4A4A4A;
}

.selected-car-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.selected-car-info {
    display: none;
}

.selected-car-name {
    font-size: 10px;
    font-weight: 500;
    color: #ffffff;
    margin: 0 0 1px 0;
    line-height: 1.1;
}

.selected-car-trim {
    font-size: 9px;
    color: #B0B0B0;
    margin: 0;
    line-height: 1.1;
}

.selected-car-price {
    font-size: 9px;
    color: #28a745;
    margin: 0;
    font-weight: 500;
}

.remove-car {
    position: absolute;
    top: -5px;
    right: -12px;
    background: rgba(220, 53, 69, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    font-size: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.remove-car:hover {
    background: #dc3545;
    transform: scale(1.1);
}

.remove-car:hover {
    background: #dc3545;
    transform: scale(1.1);
}

.comparator-placeholder {
    color: #888;
    font-size: 12px;
    font-style: italic;
    white-space: nowrap;
    margin-left: 8px;
    align-self: center;
}

.comparator-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-direction: row;
}

.clear-button {
    background: transparent;
    color: #888;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.clear-button:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.compare-button {
    background: #dc2626;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.compare-button:hover {
    background: #c82333;
}

.compare-button:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.compare-button:disabled:hover {
    background: #6c757d;
}


/* Comparison Modal Styles */
.car-comparison-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.car-comparison-modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.modal-content {
    position: relative;
    background: #2C2C2C;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 95vw;
    max-height: 95vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.car-comparison-modal.show .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 32px;
    border-bottom: 2px solid #3A3A3A;
    background: #1E1E1E;
    color: #ffffff;
    border-radius: 12px 12px 0 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: #ffffff;
}

.modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #ffffff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.modal-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #2C2C2C;
}

.comparison-table-container {
    flex: 1;
    overflow: auto;
    padding: 0;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    min-width: 800px;
    background: #2C2C2C;
    color: #ffffff;
}

.comparison-table th {
    background: #1E1E1E;
    color: #ffffff;
    font-weight: 700;
    padding: 16px 12px;
    text-align: left;
    border-bottom: 2px solid #3A3A3A;
    position: sticky;
    top: 0;
    z-index: 10;
}

.feature-header {
    position: sticky;
    left: 0;
    background: #1E1E1E;
    z-index: 11;
    min-width: 200px;
}

.comparison-table td {
    padding: 12px;
    border-bottom: 1px solid #3A3A3A;
    vertical-align: top;
    background: #2C2C2C;
    color: #ffffff;
}

.comparison-table tr:nth-child(even) td {
    background: #333333;
}

.comparison-table tr:hover td {
    background: #3A3A3A;
}

.feature-label {
    position: sticky;
    left: 0;
    background: inherit;
    font-weight: 600;
    color: #ffffff;
    z-index: 10;
    min-width: 200px;
}

.feature-value {
    align-items: center;
    gap: 8px;
}

.feature-check {
    color: #28a745;
    font-size: 16px;
    font-weight: bold;
}

.feature-cross {
    color: #dc3545;
    font-size: 16px;
    font-weight: bold;
}

.feature-note {
    color: #6c757d;
    font-size: 12px;
    font-style: italic;
    margin-left: 4px;
}

.car-header-cell {
    text-align: center;
    padding: 16px 12px;
    background: #1E1E1E;
    color: #ffffff;
    border-bottom: 2px solid #3A3A3A;
}

.car-image {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.car-trim {
    font-size: 14px;
    color: #B0B0B0;
    margin: 4px 0 0 0;
    font-weight: 500;
}

/* Hybrid Comparison Table Styles */
.hybrid-comparison-container {
    width: 100%;
    overflow: hidden;
    background: #0d0d0d;
    border-radius: 12px;
    border: 1px solid #333;
}

.hybrid-table-wrapper {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
}

.hybrid-comparison-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px; /* Ensure minimum width for proper layout */
}

/* Fixed Feature Column (30%) */
.fixed-feature-header,
.fixed-feature-cell {
    width: 30%;
    min-width: 180px;
    max-width: 180px;
    position: sticky;
    left: 0;
    z-index: 10;
    background: #1a1a1a;
    border-right: 2px solid #333;
}

.fixed-feature-header {
    background: #2a2a2a;
    color: #ffffff;
    font-weight: 600;
    font-size: 16px;
    padding: 20px 15px;
    text-align: left;
}

.fixed-feature-cell {
    color: #ffffff;
    font-size: 14px;
    padding: 12px 15px;
    border-bottom: 1px solid #2a2a2a;
    vertical-align: top;
}

/* Scrollable Cars Column (70%) */
.scrollable-cars-header,
.scrollable-cars-cell {
    width: 70%;
    min-width: 450px;
}

.scrollable-cars-header {
    background: #2a2a2a;
    padding: 0;
}

.scrollable-cars-cell {
    padding: 0;
    border-bottom: 1px solid #2a2a2a;
}

/* Cars Scroll Container */
.cars-scroll-container {
    display: flex;
    min-width: 100%;
}

.car-header-cell {
    min-width: 220px;
    width: 220px;
    padding: 20px 15px;
    text-align: center;
    background: #2a2a2a;
    border-right: 1px solid #333;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.car-header-cell:last-child {
    border-right: none;
}

.car-header-cell .car-image {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #444;
}

.car-header-cell .car-name {
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.car-header-cell .car-trim {
    color: #888;
    font-size: 12px;
    margin: 0;
}

.car-data-cell {
    min-width: 220px;
    width: 220px;
    padding: 12px 15px;
    color: #ffffff;
    font-size: 14px;
    border-right: 1px solid #2a2a2a;
    vertical-align: top;
    line-height: 1.4;
}

.car-data-cell:last-child {
    border-right: none;
}

.car-data-cell.price-value {
    font-weight: 600;
    color: #ff6b6b;
    text-align: center;
}

/* Style trim names in parentheses */
.trim-name {
    color: #888 !important;
    font-size: 12px !important;
    font-style: italic !important;
    font-weight: normal !important;
}

/* Style parentheses wrapper */
.trim-parentheses {
    color: #888 !important;
    font-size: 12px !important;
    font-weight: normal !important;
}

.car-data-cell.section-spacer {
    
    color: #666;
    font-weight: 600;
    text-align: center;
}

/* Section Headers */
.section-header .fixed-feature-cell {
    background: #1a1a1a;
    color: #ffffff;
    font-weight: 600;
    font-size: 16px;
    border-bottom: 2px solid #333;
}

.section-header .scrollable-cars-cell {
    background: #1a1a1a;
    border-bottom: 2px solid #333;
}

/* Price Row */
.price-row .fixed-feature-cell {
    background: #1a1a1a;
    color: #ffffff;
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hybrid-comparison-table {
        min-width: 100%;
        width: 100%;
    }
    
    .hybrid-table-wrapper {
        overflow-x: visible;
    }
    
    .fixed-feature-header,
    .fixed-feature-cell {
        width: 30%;
        min-width: 100px;
        max-width: 100px;
    }
    
    .scrollable-cars-header,
    .scrollable-cars-cell {
        width: 70%;
        min-width: auto;
    }
    
    .cars-scroll-container {
        display: flex;
        flex-wrap: nowrap;
        width: 100%;
    }
    
    .car-header-cell,
    .car-data-cell {
        min-width: 0;
        width: calc(70% / var(--car-count, 2));
        flex: 1;
        padding: 8px 4px;
        font-size: 11px;
    }
    
    .car-header-cell .car-image {
        width: 40px;
        height: 30px;
    }
    
    .car-header-cell .car-name {
        font-size: 12px;
        line-height: 1.2;
    }
    
    .car-header-cell .car-trim {
        font-size: 10px;
        line-height: 1.2;
    }
    
    .fixed-feature-cell,
    .car-data-cell {
        font-size: 11px;
        padding: 6px 4px;
        line-height: 1.3;
    }
    
    .car-data-cell.price-value {
        font-size: 10px;
    }
    
    /* Mobile trim name styling */
    .trim-name {
        font-size: 10px !important;
    }
    
    /* Mobile parentheses styling */
    .trim-parentheses {
        font-size: 10px !important;
    }
    
    /* Ensure text doesn't overflow */
    .car-header-cell .car-name,
    .car-header-cell .car-trim,
    .car-data-cell {
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }
    
    /* Make sure long feature values wrap properly */
    .car-data-cell {
        white-space: normal;
        word-break: break-word;
    }
}

/* Scrollbar Styling */
.hybrid-table-wrapper::-webkit-scrollbar {
    height: 8px;
}

.hybrid-table-wrapper::-webkit-scrollbar-track {
    background: #1a1a1a;
}

.hybrid-table-wrapper::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
}

.hybrid-table-wrapper::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Responsive Design */
@media (max-width: 768px) {
    .car-comparator-bar {
        padding: 8px 12px;
    }
    
    .comparator-content {
        gap: 8px;
    }
    
    .comparator-label {
        display: none;
    }
    
    .selected-cars {
        gap: 6px;
        min-height: 30px;
        align-items: center;
    }
    
    .selected-car-item {
        min-width: 40px;
        width: 50px;
        height: 40px;
        display: flex;
        flex-direction: column;
    }
    
    .selected-car-image {
        display: block;
    }
    
    .comparator-placeholder {
        display: none;
    }
    
    .comparator-actions {
        gap: 2px;
    }
    
    .clear-button {
        padding: 2px 5px;
        font-size: 8px;
    }
    
    .compare-button {
        padding: 3px 7px;
        font-size: 10px;
    }
    
    .modal-content {
        margin: 20px;
        max-height: calc(100vh - 40px);
    }
    
    .modal-header {
        padding: 20px 24px;
    }
    
    .modal-header h2 {
        font-size: 20px;
    }
    
    .comparison-table {
        font-size: 12px;
        min-width: 600px;
    }
    
    .comparison-table th,
    .comparison-table td {
        padding: 8px 6px;
    }
    
    .car-image {
        width: 60px;
        height: 45px;
    }
    
    .car-name {
        font-size: 14px;
    }
    
    .car-price {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .car-comparator-bar {
        padding: 12px 16px;
    }
    
    .selected-car-item {
        min-width: 60px;
        padding: 8px 2px;
    }
    
    .selected-car-image {
        width: 52px;
        height: 32px;
    }
    
    .selected-car-name {
        font-size: 12px;
    }
    
    .selected-car-trim {
        font-size: 10px;
    }
    
    .clear-btn, .compare-btn {
        padding: 8px 16px;
        font-size: 12px;
    }
    
    .modal-content {
        margin: 10px;
        max-height: calc(100vh - 20px);
    }
    
    .modal-header {
        padding: 16px 20px;
    }
    
    .modal-header h2 {
        font-size: 18px;
    }
    
    .comparison-table {
        font-size: 11px;
        min-width: 500px;
    }
    
    .comparison-table th,
    .comparison-table td {
        padding: 6px 4px;
    }
    
    .car-image {
        width: 50px;
        height: 38px;
    }
    
    .car-name {
        font-size: 12px;
    }
    
    .car-price {
        font-size: 10px;
    }
}

/* Loading Animation */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: spin 1s ease-in-out infinite;
}

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

/* Smooth Transitions */
* {
    transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

/* Focus States for Accessibility */
.add-to-comparator:focus,
.clear-btn:focus,
.compare-btn:focus,
.modal-close:focus,
.remove-car:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .car-comparator-bar {
        border-top: 4px solid #ffffff;
    }
    
    .add-to-comparator {
        border-width: 3px;
    }
    
    .comparison-table th {
        border-bottom: 3px solid #000000;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .car-comparator-bar {
        transition: none;
    }
    
    .modal-content {
        transition: none;
    }
}

/* Additional styles for new comparison table structure */
.price-row {
    background: #333333 !important;
}

.price-row td {
    background: #333333 !important;
}

.price-value {
    color: #dc3545;
    font-weight: 600;
    font-size: 16px;
}

.section-header td {
    background: #1E1E1E !important;
    color: #ffffff;
    font-weight: 700;
    font-size: 16px;
    padding: 16px 12px;
    border-bottom: 2px solid #3A3A3A;
}

.feature-value {
    color: #ffffff;
    font-size: 14px;
    line-height: 1.4;
    padding: 8px 12px;
}

.feature-check {
    color: #28a745;
    font-size: 16px;
    font-weight: bold;
}

.feature-cross {
    color: #dc3545;
    font-size: 16px;
    font-weight: bold;
}

.feature-note {
    color: #B0B0B0;
    font-size: 12px;
    font-style: italic;
}
