:root {
    --primary-color: #3498db;
    --secondary-color: #2ecc71;
    --background-color: #ecf0f1;
    --text-color: #34495e;
    --border-color: #bdc3c7;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--background-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
}

header {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem;
    text-align: center;
}

.main-container {
    flex: 1;
    display: flex;
    flex-direction: row;
    overflow: hidden;
}

.sidebar {
    flex: 0 0 250px;
    background-color: white;
    padding: 1rem;
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    overflow: hidden;
}

.chart-container, .map-container, .table-container, .scatter-container {
    flex: 1;
    background-color: white;
    padding: 1rem;
    display: none;
    height: calc(100vh - 2rem);
}

.map-container {
    height: 100%;
}

.table-container {
    overflow-y: auto;
}

select, input {
    width: 100%;
    padding: 0.5rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
}

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

th, td {
    border: 1px solid var(--border-color);
    padding: 0.75rem;
    text-align: left;
    word-wrap: break-word;
    white-space: normal;
    overflow-wrap: break-word;
}

th {
    background-color: var(--primary-color);
    color: white;
}

.filter-container {
    display: flex;
    flex-direction: column;
    margin-bottom: 1rem;
}

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

.autocomplete {
    position: relative;
    display: inline-block;
    width: 100%;
}

.autocomplete-items {
    position: absolute;
    border: 1px solid var(--border-color);
    border-top: none;
    z-index: 99;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background-color: white;
    border-radius: 0 0 4px 4px;
}

.autocomplete-items div {
    padding: 0.5rem;
    cursor: pointer;
}

.autocomplete-items div:hover {
    background-color: var(--background-color);
}

.autocomplete-active {
    background-color: var(--primary-color) !important;
    color: white;
}

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

.loading-spinner {
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

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

@media (max-width: 1200px) {
    .main-container {
        flex-direction: column;
    }
    .sidebar {
        flex: 0 0 auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
}
