:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --success-color: #28a745;
    --info-color: #17a2b8;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --border-radius: 0.5rem;
    --box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

body {
    background-color: #f5f7fa;
    color: var(--dark-color);
    line-height: 1.6;
}

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

header {
    text-align: center;
    margin-bottom: 2.5rem;
    padding: 2rem 1rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 70%);
    transform: rotate(30deg);
}

header h1 {
    color: white;
    margin-bottom: 0.75rem;
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: relative;
    z-index: 1;
}

header h1 i {
    margin-right: 0.75rem;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

header p {
    color: rgba(255,255,255,0.9);
    font-size: 1.1rem;
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.6;
    position: relative;
    z-index: 1;
}


header:hover::before {
    animation: shine 3s infinite linear;
}

@keyframes shine {
    0% { transform: rotate(30deg) translateX(-50%); }
    100% { transform: rotate(30deg) translateX(50%); }
}

.dashboard {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

#map-container {
    width: 100%;
    height: 550px;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

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

#data-panel {
    background: white;
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--box-shadow);
    display: none;
    border: 1px solid rgba(0, 0, 0, 0.1);
    transition: var(--transition);
    position: relative;
}

#data-panel.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.panel-header h2 {
    color: var(--primary-color);
    font-size: 1.75rem;
    font-weight: 600;
}

.panel-header h2 i {
    margin-right: 0.75rem;
    color: var(--accent-color);
}

.no-data {
    color: #6c757d;
    font-size: 0.9em;
    font-weight: normal;
}

#close-panel {
    background: none;
    border: none;
    font-size: 1.75rem;
    cursor: pointer;
    color: #6c757d;
    transition: var(--transition);
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

#close-panel:hover {
    color: var(--danger-color);
    background-color: rgba(220, 53, 69, 0.1);
}

.tabs {
    display: flex;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    gap: 0.5rem;
}

.tab-button {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
    color: #6c757d;
    font-weight: 600;
    position: relative;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tab-button:hover {
    color: var(--secondary-color);
    background-color: rgba(52, 152, 219, 0.1);
}

.tab-button.active {
    color: var(--secondary-color);
    background-color: rgba(52, 152, 219, 0.1);
}

.tab-button.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--secondary-color);
    border-radius: 3px 3px 0 0;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

.summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.05);
    text-align: center;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
}

.stat-card h3 {
    color: #6c757d;
    font-size: 1rem;
    margin-bottom: 0.75rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.stat-card p {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-card:nth-child(1) p {
    color: var(--success-color);
}

.stat-card:nth-child(2) p {
    color: var(--info-color);
}

.stat-card:nth-child(3) p {
    color: var(--warning-color);
}

.stat-card:nth-child(4) p {
    color: var(--danger-color);
}

.chart-container {
    width: 100%;
    height: 350px;
    margin-bottom: 1.5rem;
    background: white;
    padding: 1rem;
    border-radius: var(--border-radius);
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.table-container {
    width: 100%;
    overflow-x: auto;
    background: white;
    padding: 1rem;
    border-radius: var(--border-radius);
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

th {
    background-color: rgba(0, 0, 0, 0.02);
    font-weight: 600;
    color: var(--primary-color);
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
}

th i {
    margin-right: 0.5rem;
}

tr:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.positive {
    color: var(--success-color);
    font-weight: bold;
}

.negative {
    color: var(--danger-color);
    font-weight: bold;
}

#sales .chart-container {
    height: 300px;
    margin-bottom: 1.5rem;
}

#sales .table-container {
    max-height: 400px;
    overflow-y: auto;
}

#sales-table th:nth-child(3),
#sales-table td:nth-child(3) {
    text-align: right;
}

#sales-table th:nth-child(2),
#sales-table td:nth-child(2) {
    text-align: center;
}

/* Loading spinner */
.loading-spinner {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    width: 3rem;
    height: 3rem;
    border: 0.5rem solid rgba(52, 152, 219, 0.3);
    border-radius: 50%;
    border-top-color: var(--secondary-color);
    animation: spin 1s ease-in-out infinite;
}

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

/* Map tooltip */
.map-tooltip {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border-radius: 4px;
    padding: 5px 10px;
    font-size: 14px;
    font-weight: 500;
    border: none;
}

/* Loading state for panel */
#data-panel.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.7);
    z-index: 10;
    border-radius: var(--border-radius);
}

/* Map legend */
.info.legend {
    background: white;
    padding: 1rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    line-height: 1.5;
    font-size: 0.9rem;
}

.info.legend h4 {
    margin-bottom: 0.5rem;
    color: var(--primary-color);
    font-size: 1rem;
}

.info.legend i {
    width: 1rem;
    height: 1rem;
    float: left;
    margin-right: 0.5rem;
    opacity: 0.7;
    border-radius: 2px;
}

/* Chart tooltip styles */
.chartjs-tooltip {
    opacity: 1 !important;
    background: rgba(0, 0, 0, 0.8) !important;
    border-radius: var(--border-radius) !important;
    padding: 0.5rem 1rem !important;
    box-shadow: var(--box-shadow) !important;
}

@media (max-width: 992px) {
    .container {
        padding: 1.5rem;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    #map-container {
        height: 450px;
    }
}

@media (max-width: 768px) {
    .dashboard {
        flex-direction: column;
    }
    
    #map-container {
        height: 400px;
    }
    
    .summary-stats {
        grid-template-columns: 1fr 1fr;
    }
    
    .stat-card p {
        font-size: 1.5rem;
    }
}

@media (max-width: 576px) {
    .container {
        padding: 1rem;
    }
    
    header h1 {
        font-size: 1.75rem;
    }
    
    .summary-stats {
        grid-template-columns: 1fr;
    }
    
    .tabs {
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 0.5rem;
    }
    
    .tab-button {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    .panel-header h2 {
        font-size: 1.5rem;
    }
    
    .chart-container {
        height: 300px;
    }
}

@media (max-width: 768px) {
    header {
        padding: 1.5rem 1rem;
    }
    header h1 {
        font-size: 2rem;
    }
    header p {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.75rem;
    }
    header h1 i {
        margin-right: 0.5rem;
    }
}