* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #ffffff;
    min-height: 100vh;
    color: #333;
    margin: 0;
    display: flex;
    flex-direction: column;
}


/* Hero Section */
.hero-section {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px 0;
}

.hero-section h1 {
    font-size: 2.5rem;
    font-weight: 900;
    color: #000;
    margin-bottom: 16px;
    letter-spacing: -0.02em;
}

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

.header {
    text-align: center;
    margin-bottom: 60px;
    padding: 40px 0;
    border-bottom: 1px solid #f0f0f0;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 900;
    color: #000;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.subtitle {
    font-size: 1rem;
    color: #666;
    font-weight: 400;
}

.vehicle-count {
    background: #000;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
    font-size: 0.9rem;
}

.main-content {
    display: flex;
    gap: 30px;
}

.content-wrapper {
    display: flex;
    gap: 30px;
    width: 100%;
}

/* Filters Sidebar */
.filters-sidebar {
    background: #fafafa;
    border-radius: 8px;
    padding: 24px;
    border: 1px solid #e0e0e0;
    height: fit-content;
    min-width: 280px;
    max-width: 280px;
    display: none; /* Hidden by default */
    transition: all 0.3s ease;
}

.filters-sidebar.active {
    display: block;
    animation: slideInLeft 0.3s ease;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.filters-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    color: #333;
}

.filters-header i {
    font-size: 1rem;
}

.filters-header h2 {
    font-size: 1.1rem;
    font-weight: 500;
}

.filter-group {
    margin-bottom: 20px;
}

.filter-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #2c3e50;
}

.filter-group select,
.filter-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    transition: border-color 0.2s ease;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: #666;
}

/* Visual feedback when filters are auto-updated from AI search */
.filters-updated {
    animation: filterPulse 2s ease-in-out;
    border: 2px solid #333;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.05) 0%, rgba(0, 0, 0, 0.02) 100%);
}

@keyframes filterPulse {
    0% { 
        box-shadow: 0 0 0 0 rgba(0, 0, 0, 0.3); 
    }
    50% { 
        box-shadow: 0 0 0 10px rgba(0, 0, 0, 0.1); 
    }
    100% { 
        box-shadow: 0 0 0 0 rgba(0, 0, 0, 0); 
    }
}

.price-inputs {
    display: flex;
    gap: 10px;
}

/* AI Reasoning Display */
.ai-reasoning {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #333;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.reasoning-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 1.1rem;
    color: #000;
    margin-bottom: 12px;
}

.reasoning-header i {
    color: #333;
    font-size: 1.3rem;
}

.reasoning-content {
    line-height: 1.6;
    color: #495057;
    font-size: 0.95rem;
    background: white;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #333;
}

.apply-filters-btn {
    width: 100%;
    background: #000;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.apply-filters-btn:hover {
    background: #333;
}

/* Search Section */
.search-section {
    flex: 1;
}

.search-card {
    background: white;
    border-radius: 8px;
    padding: 32px;
    border: 1px solid #e0e0e0;
    margin-bottom: 32px;
}

.search-card h2 {
    font-size: 1.5rem;
    color: #000;
    margin-bottom: 24px;
    text-align: center;
    font-weight: 500;
}

.ai-search {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

.ai-search textarea {
    padding: 16px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    font-size: 15px;
    font-family: inherit;
    resize: vertical;
    min-height: 120px;
    transition: border-color 0.2s ease;
    background: #f9f9f9;
}

.ai-search textarea:focus {
    outline: none;
    border-color: #666;
}

.textarea-wrapper {
    position: relative;
}

.ai-search textarea {
    width: 100%;
    box-sizing: border-box;
}

.typing-animation {
    position: absolute;
    top: 16px;
    left: 16px;
    font-size: 15px;
    color: #999;
    pointer-events: none;
    font-family: inherit;
    line-height: 1.5;
}

.typing-animation.hidden {
    display: none;
}

.cursor {
    animation: blink 1s infinite;
    color: #666;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.find-cars-btn {
    background: #000;
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: 4px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    align-self: center;
}

.find-cars-btn:hover {
    background: #333;
}

/* How it works section */
.how-it-works {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.how-it-works h3 {
    color: #333;
    font-size: 1.2rem;
    margin: 0 0 18px 0;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.how-it-works h3::before {
    content: "✨";
    font-size: 1.3rem;
}

.how-it-works ol {
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: step-counter;
}

.how-it-works li {
    margin-bottom: 12px;
    line-height: 1.6;
    color: #555;
    position: relative;
    padding-left: 40px;
    counter-increment: step-counter;
}

.how-it-works li::before {
    content: counter(step-counter);
    position: absolute;
    left: 0;
    top: 0;
    background: #333;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
}

.how-it-works li:last-child {
    margin-bottom: 0;
}

/* Search buttons container */
.search-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.search-buttons .find-cars-btn {
    flex: 1;
}

.toggle-filters-btn {
    background: #333;
    color: white;
    border: none;
    padding: 14px 20px;
    border-radius: 4px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
}

.toggle-filters-btn:hover {
    background: #222;
}

.toggle-filters-btn.active {
    background: #666;
}

.popular-searches p {
    text-align: center;
    color: #7f8c8d;
    margin-bottom: 15px;
}

.search-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.search-tag {
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    padding: 8px 14px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #666;
}

.search-tag:hover {
    background: #000;
    color: white;
    border-color: #000;
}

/* Results Section */
.results-section {
    background: white;
    border-radius: 8px;
    padding: 24px;
    border: 1px solid #e0e0e0;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f1f2f6;
}

.results-header h3 {
    color: #2c3e50;
    font-size: 1.5rem;
}

.view-controls {
    display: flex;
    gap: 5px;
}

.view-btn {
    background: #f8f9fa;
    border: 2px solid #e1e5e9;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.view-btn.active,
.view-btn:hover {
    background: #333;
    color: white;
    border-color: #333;
}

/* Cars Grid */
.cars-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 25px;
}

.car-card {
    background: white;
    border: 2px solid #f1f2f6;
    border-radius: 15px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
}

.car-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    border-color: #333;
}

.car-image {
    width: 100%;
    height: 200px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #7f8c8d;
    font-size: 3rem;
}

.car-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.car-details {
    padding: 20px;
}

.car-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 10px;
    line-height: 1.4;
}

.car-specs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
    font-size: 14px;
    color: #7f8c8d;
}

.car-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
    text-align: center;
}

/* Loading Spinner */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-spinner {
    background: white;
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    color: #2c3e50;
}

.loading-spinner i {
    font-size: 3rem;
    color: #333;
    margin-bottom: 20px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: white;
    border-radius: 15px;
    max-width: 800px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px;
    border-bottom: 2px solid #f1f2f6;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #7f8c8d;
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: #666;
}

.modal-content {
    padding: 25px;
}

/* List View */
.cars-grid.list-view {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.cars-grid.list-view .car-card {
    display: flex;
    height: 150px;
}

.cars-grid.list-view .car-image {
    width: 200px;
    height: 100%;
    flex-shrink: 0;
}

.cars-grid.list-view .car-details {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cars-grid.list-view .car-specs {
    display: flex;
    gap: 20px;
    margin: 0;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .content-wrapper {
        flex-direction: column;
    }
    
    .filters-sidebar {
        max-width: none;
        min-width: none;
        margin-bottom: 24px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header {
        padding: 20px 0;
        margin-bottom: 30px;
    }
    
    .header h1 {
        font-size: 1.8rem;
    }
    
    .search-card {
        padding: 20px;
        margin-bottom: 20px;
    }
    
    .search-card h2 {
        font-size: 1.2rem;
        margin-bottom: 16px;
    }
    
    .ai-search {
        gap: 12px;
        margin-bottom: 20px;
    }
    
    .ai-search textarea {
        min-height: 140px;
        padding: 18px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .find-cars-btn {
        padding: 14px 20px;
        width: 100%;
    }
    
    .cars-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .search-tags {
        justify-content: flex-start;
        gap: 8px;
    }
    
    .search-tag {
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .results-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .results-section {
        padding: 16px;
    }
    
    .modal {
        width: 95%;
        margin: 10px;
        max-height: 90vh;
    }
    
    .modal-content {
        padding: 16px;
    }
    
    .filters-sidebar {
        padding: 16px;
    }
    
    .filter-group {
        margin-bottom: 16px;
    }
    
    .filter-group select,
    .filter-group input {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 12px;
    }
    
    .apply-filters-btn {
        padding: 14px;
        font-size: 16px;
    }
}

/* Pagination Controls */
.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin: 30px 0;
    padding: 20px 0;
    border-top: 2px solid #f1f2f6;
}

.pagination-btn {
    background: #333;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.pagination-btn:hover:not(.disabled) {
    background: #222;
    transform: translateY(-2px);
}

.pagination-btn.disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
}

.page-numbers {
    display: flex;
    gap: 5px;
    align-items: center;
}

.page-btn {
    background: #f8f9fa;
    border: 2px solid #e1e5e9;
    color: #2c3e50;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    min-width: 45px;
}

.page-btn:hover {
    background: #333;
    color: white;
    border-color: #333;
    transform: translateY(-2px);
}

.page-btn.active {
    background: #2c3e50;
    color: white;
    border-color: #2c3e50;
}

.pagination-ellipsis {
    color: #7f8c8d;
    padding: 0 10px;
    font-weight: 500;
}

@media (max-width: 480px) {
    .price-inputs {
        flex-direction: column;
    }
    
    .search-card {
        padding: 20px;
    }
    
    .filters-sidebar {
        padding: 20px;
    }
    
    .pagination-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .page-numbers {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .pagination-btn {
        padding: 10px 15px;
        font-size: 14px;
    }
    
    .page-btn {
        min-width: 40px;
        padding: 8px 12px;
    }
}

/* Footer Styles */
.footer {
    background: #f8f9fa;
    color: #888;
    margin-top: auto;
    padding: 20px 0;
    border-top: 1px solid #e0e0e0;
}

.footer-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    text-align: center;
}

.footer-container p {
    margin: 0;
    font-size: 0.85rem;
}

.footer-container a {
    color: #666;
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-container a:hover {
    color: #333;
}

/* Mobile responsiveness for footer */
@media (max-width: 768px) {
    .footer {
        padding: 15px 0;
    }
}