:root {
    /* Ubuntu Yaru Dark Palette */
    --bg-color: #3E3E3E;
    /* Yaru Dark Grey / Inkstone */
    --card-bg: #2C2C2C;
    /* Slightly lighter dark for cards */
    --text-primary: #F7F7F7;
    --text-secondary: #AEA79F;
    /* Warm Grey */
    --accent: #E95420;
    /* Ubuntu Orange */
    --accent-hover: #C74212;
    --glass-bg: rgba(62, 62, 62, 0.9);
    --border-color: rgba(255, 255, 255, 0.1);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);

    --font-family: 'Ubuntu', sans-serif;
}

[data-theme="light"] {
    /* Ubuntu Yaru Light Palette */
    --bg-color: #FFFFFF;
    --card-bg: #F2F2F2;
    --text-primary: #3E3E3E;
    /* Inkstone */
    --text-secondary: #5D5D5D;
    --accent: #E95420;
    /* Ubuntu Orange */
    --accent-hover: #C74212;
    --glass-bg: rgba(255, 255, 255, 0.9);
    --border-color: rgba(0, 0, 0, 0.1);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.theme-toggle {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.theme-toggle:hover {
    background: var(--card-bg);
    color: var(--accent);
    border-color: var(--accent);
}

* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-primary);
    margin: 0;
    min-height: 100vh;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
/* Header */
header {
    padding: 2rem 0;
    /* border-bottom: 1px solid var(--border-color); Removed as per request */
    margin-bottom: 3rem;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 2.5rem;
    /* Increased size */
    font-weight: 700;
    color: var(--accent);
    cursor: pointer;
    text-decoration: none;
    letter-spacing: 1px;
}

.search-bar {
    display: inline-flex;
    gap: 0.5rem;
    background: var(--card-bg);
    padding: 0.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin: 0 auto 1.5rem;
    max-width: 100%;
}

.search-bar input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 0.5rem;
    outline: none;
    font-family: var(--font-family);
    width: 300px;
}

.search-bar button {
    background: var(--accent);
    border: none;
    color: white;
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.search-bar button:hover {
    background: var(--accent-hover);
}

/* Hero Section */
.herobox {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 3rem;
    width: 100%;
}

.herobox h2 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.herobox p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Grid */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    padding-bottom: 4rem;
}

.car-card {
    background: var(--glass-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.car-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent);
}

.card-image {
    width: 100%;
    height: 180px;
    background-color: #2d3748;
    object-fit: cover;
}

.card-content {
    padding: 1.5rem;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
}

.card-meta {
    color: var(--text-secondary);
    font-size: 0.9rem;
    display: flex;
    gap: 1rem;
}

.tag {
    background: rgba(56, 189, 248, 0.1);
    color: var(--accent);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--card-bg);
    width: 90%;
    max-width: 800px;
    border-radius: 16px;
    padding: 2rem;
    position: relative;
    border: 1px solid var(--border-color);
    transform: scale(0.95);
    transition: transform 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-overlay:not(.hidden) .modal-content {
    transform: scale(1);
}

.close-button {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
}

.close-button:hover {
    color: var(--text-primary);
}

/* Details Layout */
.details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.details-image {
    width: 100%;
    border-radius: 8px;
}

.details-info h2 {
    margin-top: 0;
    color: var(--accent);
}

.spec-list {
    list-style: none;
    padding: 0;
    margin-top: 1.5rem;
}

.spec-list li {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.spec-label {
    color: var(--text-secondary);
}

.spec-value {
    font-weight: 600;
}

/* Loading */
.loading-spinner {
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--accent);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@media (max-width: 768px) {
    .details-grid {
        grid-template-columns: 1fr;
    }

    .header-content {
        flex-direction: column;
        align-items: stretch;
    }

    .search-bar {
        width: 100%;
    }

    .search-bar input {
        width: 100%;
    }
}

/* Comparison Feature Styles */
.compare-checkbox-container {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
    display: flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.8);
    padding: 0.4rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.compare-checkbox-container input {
    cursor: pointer;
    width: 18px;
    height: 18px;
}

.compare-checkbox-container label {
    font-size: 0.8rem;
    color: var(--text-primary);
    cursor: pointer;
    user-select: none;
}

.compare-badge {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--accent);
    color: white;
    padding: 1rem 2rem;
    border-radius: 50px;
    box-shadow: 0 10px 25px rgba(56, 189, 248, 0.4);
    cursor: pointer;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    transition: transform 0.3s, background 0.3s;
}

.compare-badge:hover {
    transform: translateY(-5px) scale(1.05);
    background: var(--accent-hover);
}

.compare-badge.hidden {
    display: none;
}

/* Comparison Table */
.compare-table-wrapper {
    overflow-x: auto;
    background: var(--glass-bg);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    margin-top: 2rem;
}

.compare-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}

.compare-table th,
.compare-table td {
    padding: 1.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

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

.compare-table th {
    background: rgba(30, 41, 59, 0.5);
    color: var(--text-secondary);
    font-weight: 400;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    width: 200px;
}

.compare-col-header {
    text-align: center !important;
}

.compare-car-img {
    width: 100%;
    max-width: 200px;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    display: block;
    margin: 0 auto 1rem;
}

.compare-car-name {
    font-size: 1.2rem;
    font-weight: 600;
    text-align: center;
}

.compare-remove {
    display: block;
    margin: 0.5rem auto 0;
    color: #ef4444;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    text-decoration: underline;
}

.spec-highlight {
    color: var(--accent);
    font-weight: 600;
}