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

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f5f5;
    color: #333;
}

/* Container */
.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* Header */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.logo {
    font-size: 1.75rem;
    font-weight: bold;
}

.tagline {
    font-size: 0.9rem;
    opacity: 0.85;
}

/* Main Content */
.main-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

/* Navigation Tabs */
.nav-tabs {
    display: flex;
    gap: 0;
    background: white;
    border-bottom: 2px solid #e0e0e0;
    padding: 0;
    margin: 0;
}

.nav-tab {
    flex: 1;
    padding: 1rem;
    border: none;
    background: white;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    color: #666;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    text-align: center;
}

.nav-tab:hover {
    background: #f9f9f9;
    color: #333;
}

.nav-tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

/* Section Content */
.section-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.section-content.hidden {
    display: none;
}

.section-content h2 {
    margin-bottom: 1.5rem;
    color: #333;
}

.section-content h3 {
    margin-bottom: 1rem;
    color: #333;
}

/* Search Section */
.search-section {
    background: white;
    border-bottom: 1px solid #e0e0e0;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.search-mode-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #f0f0f0;
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: #666;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    color: #667eea;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.mode-content {
    display: none;
}

.mode-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Search Controls */
.search-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
}

.search-group {
    display: flex;
    flex-direction: column;
}

.search-group label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: #333;
}

.search-input,
.search-select {
    padding: 0.75rem 1rem;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.search-input:focus,
.search-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-input-group {
    display: flex;
    gap: 0.5rem;
}

.search-input-group .search-input {
    flex: 1;
}

.search-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, #667eea, #764ba2);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.search-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.search-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#radius-value,
#route-radius-value {
    font-weight: 600;
    color: #667eea;
    font-size: 0.9rem;
}

/* Buttons */
.btn-primary,
.btn-secondary {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    grid-column: span 2;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

/* Content Wrapper */
.content-wrapper {
    display: flex;
    flex: 1;
    gap: 0;
    overflow: hidden;
}

/* Map Container */
.map-container {
    flex: 1;
    background: #f0f0f0;
    position: relative;
}

#map {
    width: 100%;
    height: 100%;
}

/* Results Sidebar */
.results-sidebar {
    width: 400px;
    background: white;
    border-left: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.results-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.results-header h2 {
    font-size: 1.2rem;
    margin: 0;
}

.sort-select {
    padding: 0.5rem 0.75rem;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.9rem;
}

/* Results List */
.results-list {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.results-list::-webkit-scrollbar {
    width: 8px;
}

.results-list::-webkit-scrollbar-track {
    background: transparent;
}

.results-list::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.results-list::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.result-item {
    padding: 1rem;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.result-item:hover {
    background: #f9f9f9;
    padding-left: 1.5rem;
}

.result-item.active {
    background: #f0f0ff;
    border-left: 4px solid #667eea;
    padding-left: 0.75rem;
}

.result-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.result-info {
    font-size: 0.9rem;
    color: #666;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.result-price {
    font-size: 1.1rem;
    font-weight: bold;
    color: #667eea;
    margin-top: 0.5rem;
}

.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
    font-size: 1rem;
    text-align: center;
    padding: 2rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    position: relative;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #999;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

.modal-body {
    padding-top: 1rem;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 1rem;
    color: #333;
}

.modal-info {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.modal-info-row {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.modal-info-label {
    font-weight: 600;
    color: #666;
    font-size: 0.9rem;
}

.modal-info-value {
    color: #333;
    font-size: 1.1rem;
}

.modal-map-preview {
    width: 100%;
    height: 300px;
    border-radius: 8px;
    margin: 1rem 0;
    background: #f0f0f0;
}

.modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1.5rem;
}

.btn-modal {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-modal-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-modal-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-modal-secondary {
    background: #f0f0f0;
    color: #333;
}

.btn-modal-secondary:hover {
    background: #e0e0e0;
}

/* Loading Indicator */
.loading-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.loading-indicator:not(.hidden) {
    display: flex;
}

.loading-indicator.hidden {
    display: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(102, 126, 234, 0.2);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-indicator p {
    color: #667eea;
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .results-sidebar {
        width: 350px;
    }
}

@media (max-width: 768px) {
    .content-wrapper {
        flex-direction: column;
    }

    .map-container {
        min-height: 300px;
    }

    .results-sidebar {
        width: 100%;
        height: 300px;
        border-left: none;
        border-top: 1px solid #e0e0e0;
    }

    .search-controls {
        grid-template-columns: 1fr;
    }

    .btn-primary {
        grid-column: span 1;
    }

    .modal-content {
        width: 95%;
    }
}

/* Garage Styles */
.garage-container {
    max-width: 1000px;
    margin: 0 auto;
}

.garage-form,
.garage-list {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.form-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-input,
.form-select {
    padding: 0.75rem 1rem;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.vehicles-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.vehicle-card {
    background: #f9f9f9;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.vehicle-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
}

.vehicle-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
}

.vehicle-card-title {
    font-weight: 600;
    color: #333;
    font-size: 1.1rem;
}

.vehicle-card-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.25rem;
}

.btn-icon:hover {
    color: #667eea;
}

.vehicle-card-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #666;
}

.vehicle-card-fuel {
    display: inline-block;
    background: #e0e8ff;
    color: #667eea;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-weight: 600;
    width: fit-content;
    margin-top: 0.5rem;
}

/* Favorites Styles */
.favorites-container {
    max-width: 1000px;
    margin: 0 auto;
}

.favorites-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

.favorite-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.favorite-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.favorite-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
}

.favorite-card-title {
    font-weight: 600;
    color: #333;
    font-size: 1.1rem;
    margin: 0;
}

.favorite-card-info {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.favorite-card-note {
    background: #f9f9f9;
    padding: 0.75rem;
    border-radius: 4px;
    font-size: 0.9rem;
    color: #666;
    margin-top: 1rem;
    font-style: italic;
}

.favorite-card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.favorite-card-actions button {
    flex: 1;
    padding: 0.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

/* History Styles */
.history-container {
    max-width: 1000px;
    margin: 0 auto;
}

.history-filters {
    margin-bottom: 2rem;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.history-item {
    background: white;
    border-left: 4px solid #667eea;
    padding: 1rem;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.history-item-type {
    font-weight: 600;
    color: #667eea;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.history-item-details {
    color: #666;
    font-size: 0.9rem;
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.history-item-date {
    color: #999;
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

/* Search Map Container - Hidden when not in search */
#search-section {
    display: block;
}

#search-section.hidden {
    display: none;
}

#search-map-container {
    display: flex;
}

#search-map-container.hidden {
    display: none;
}

/* Error Messages */
.error-message {
    background: #fee;
    color: #c00;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border-left: 4px solid #c00;
}

.success-message {
    background: #efe;
    color: #060;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border-left: 4px solid #060;
}
