/* Peta Jabatan Styles */
:root {
    --primary-color: #2196F3;
    --secondary-color: #4CAF50;
    --accent-color: #FF9800;
    --danger-color: #f44336;
    --text-dark: #333;
    --text-light: #666;
    --bg-light: #f8f9fa;
    --border-color: #ddd;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --transition: all 0.3s ease;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

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

.main-content {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    text-align: center;
    padding: 30px 20px;
}

.header h1 {
    margin: 0 0 10px 0;
    font-size: 2.5rem;
    font-weight: 300;
}

.header p {
    margin: 0;
    font-size: 1.1rem;
    opacity: 0.9;
}

.content-section {
    padding: 20px;
}

.stats-summary {
    background: var(--bg-light);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
    border-left: 4px solid var(--primary-color);
}

.stats-summary h3 {
    margin: 0 0 15px 0;
    color: var(--text-dark);
    font-size: 1.3rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.stat-item {
    background: white;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
    transition: var(--transition);
}

.stat-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.stat-item.negative {
    border-left-color: var(--danger-color);
}

.stat-item.positive {
    border-left-color: var(--secondary-color);
}

.stat-item .label {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 8px;
    font-weight: 500;
}

.stat-item .value {
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--text-dark);
}

.legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: white;
    border-radius: 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: var(--transition);
}

.legend-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.1);
}

.level-1 { background-color: #4CAF50; }
.level-2 { background-color: #2196F3; }
.level-3 { background-color: #FF9800; }
.level-4 { background-color: #9C27B0; }

.controls {
    text-align: center;
    margin-bottom: 25px;
    padding: 15px;
    background: var(--bg-light);
    border-radius: 8px;
}

.controls button {
    margin: 5px;
    padding: 10px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    min-width: 120px;
}

.controls button:hover {
    background: #1976D2;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

.controls button:active {
    transform: translateY(0);
}

.controls button.secondary {
    background: var(--secondary-color);
}

.controls button.secondary:hover {
    background: #388E3C;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.controls button.accent {
    background: var(--accent-color);
}

.controls button.accent:hover {
    background: #F57C00;
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.3);
}

#tree {
    width: 100%;
    height: 800px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: #fafafa;
    overflow: hidden;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .header p {
        font-size: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .legend {
        flex-direction: column;
        align-items: center;
    }
    
    .controls {
        padding: 10px;
    }
    
    .controls button {
        margin: 3px;
        padding: 8px 16px;
        font-size: 13px;
        min-width: 100px;
    }
    
    #tree {
        height: 600px;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 20px 15px;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .content-section {
        padding: 15px;
    }
    
    .controls button {
        display: block;
        width: 100%;
        margin: 5px 0;
    }
}

/* Loading Animation */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
}

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

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

/* Print Styles */
@media print {
    body {
        background: white;
    }
    
    .controls {
        display: none;
    }
    
    .container {
        max-width: none;
        padding: 0;
    }
    
    .main-content {
        box-shadow: none;
        border-radius: 0;
    }
    
    #tree {
        border: 1px solid #000;
        height: auto;
        min-height: 600px;
    }
}