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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 30px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 3px solid #667eea;
}

header h1 {
    font-size: 2.5rem;
    color: #667eea;
    margin-bottom: 10px;
}

header p {
    color: #666;
    font-size: 1.1rem;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.control-group {
    display: flex;
    flex-direction: column;
    min-width: 150px;
}

.control-group label {
    font-weight: 600;
    margin-bottom: 5px;
    color: #555;
    font-size: 0.9rem;
}

.control-group input,
.control-group select {
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.control-group input:focus,
.control-group select:focus {
    outline: none;
    border-color: #667eea;
}

.control-group select {
    min-height: 42px;
}

button {
    padding: 10px 25px;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    align-self: flex-end;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #48bb78;
    color: white;
}

.btn-secondary:hover {
    background: #38a169;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(72, 187, 120, 0.4);
}

.stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.stat-item {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
    border-radius: 10px;
    color: white;
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
}

.chart-container,
.table-container {
    margin-bottom: 30px;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
}

.chart-container h2,
.table-container h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.chart-wrapper {
    background: white;
    padding: 20px;
    border-radius: 10px;
    position: relative;
    height: 500px;
}

.table-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.table-controls input {
    flex: 1;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
}

.table-wrapper {
    overflow-x: auto;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

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

thead {
    background: #667eea;
    color: white;
}

th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}

th:hover {
    background: #5568d3;
}

tbody tr {
    border-bottom: 1px solid #eee;
    transition: background 0.2s;
}

tbody tr:hover {
    background: #f8f9fa;
}

td {
    padding: 12px 15px;
}

.no-data {
    text-align: center;
    color: #999;
    padding: 40px !important;
    font-style: italic;
}

footer {
    text-align: center;
    padding-top: 20px;
    margin-top: 30px;
    border-top: 2px solid #eee;
    color: #666;
}

footer a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

footer a:hover {
    text-decoration: underline;
}

.loading {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 9999;
}

.loading.active {
    display: flex;
}

.spinner {
    border: 5px solid #f3f3f3;
    border-top: 5px solid #667eea;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
}

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

.loading p {
    color: white;
    margin-top: 20px;
    font-size: 1.2rem;
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    .controls {
        flex-direction: column;
    }
    
    .control-group {
        width: 100%;
    }
    
    .chart-wrapper {
        height: 300px;
    }
}

/* Area checkboxes */
.areas-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.area-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.area-checkbox:hover {
    background: #e9ecef;
    border-color: #007bff;
}

.area-checkbox input[type="checkbox"] {
    cursor: pointer;
}

.area-checkbox input[type="checkbox"]:checked + span {
    font-weight: 600;
    color: #007bff;
}

.area-buttons {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 13px;
    border: 1px solid #dee2e6;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-small:hover {
    background: #e9ecef;
    border-color: #007bff;
}

.info-row {
    background: #fff3cd !important;
    color: #856404;
    font-style: italic;
    text-align: center;
    padding: 10px !important;
}
