:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #e0e7ff;
    --secondary: #8b5cf6;
    --bg-main: #f8fafc;
    --card-bg: #ffffff;
    --text-dark: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.05), 0 2px 6px -1px rgba(0, 0, 0, 0.03);
}

* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
    font-family: 'Inter', system-ui, -apple-system, sans-serif; 
}

body { 
    background-color: var(--bg-main); 
    color: var(--text-dark); 
    min-height: 100vh; 
}

/* Text & Icon Accent Colors */
.text-indigo { color: #6366f1; }
.text-purple { color: #8b5cf6; }
.text-pink { color: #ec4899; }

/* Top Navigation Header */
.top-nav { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%); 
    padding: 14px 28px; 
    color: white;
    box-shadow: 0 4px 20px rgba(79, 70, 229, 0.25);
    flex-wrap: wrap;
    gap: 12px;
}
.logo { font-size: 1.25rem; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.quick-preset { display: flex; gap: 8px; flex-wrap: wrap; }
.quick-preset button { 
    background: rgba(255, 255, 255, 0.15); 
    border: 1px solid rgba(255, 255, 255, 0.3); 
    color: white;
    padding: 6px 14px; 
    border-radius: 8px; 
    font-size: 0.8rem; 
    font-weight: 500;
    cursor: pointer; 
    transition: all 0.2s ease; 
    backdrop-filter: blur(4px);
}
.quick-preset button:hover { background: white; color: var(--primary-dark); transform: translateY(-1px); }

/* Main Dashboard Container */
.dashboard-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Stat Cards */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
.stat-card {
    background: white;
    border-radius: 12px;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    transition: transform 0.2s ease;
}
.stat-card:hover { transform: translateY(-2px); }
.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}
.stat-blue .stat-icon { background: #dbeafe; color: #2563eb; }
.stat-emerald .stat-icon { background: #d1fae5; color: #059669; }
.stat-amber .stat-icon { background: #fef3c7; color: #d97706; }

.stat-info { display: flex; flex-direction: column; }
.stat-title { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); }
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--text-dark); margin: 2px 0; }
.stat-desc { font-size: 0.75rem; color: #94a3b8; }

/* Base Card Style */
.card {
    background: var(--card-bg);
    border-radius: 14px;
    border: 1px solid var(--border-color);
    padding: 20px;
    box-shadow: var(--shadow);
}
.card h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 14px;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Workspace Grid (Sidebar & Peta Utama) */
.workspace-grid {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 20px;
}

/* Control Panel */
.form-group { margin-bottom: 14px; }
.form-group label { 
    font-size: 0.8rem; 
    font-weight: 600; 
    color: #334155; 
    display: flex; 
    align-items: center; 
    gap: 6px; 
    margin-bottom: 6px; 
}
input, select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.85rem;
    background: #f8fafc;
    transition: all 0.2s;
}
input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px var(--primary-light);
}
.date-row { display: flex; gap: 8px; }
.search-box { display: flex; gap: 6px; }
.search-box button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}
.search-box button:hover { background: var(--primary-dark); }

.btn-primary {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    transition: all 0.2s;
    margin-top: 8px;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4); }

/* Map Card */
.map-card {
    display: flex;
    flex-direction: column;
    min-height: 520px;
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.hint { font-size: 0.75rem; color: var(--text-muted); }
#map {
    flex: 1;
    min-height: 450px;
    width: 100%;
    border-radius: 10px;
    z-index: 1;
}

/* Secondary Grid (Grafik & AI Briefing) */
.secondary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.chart-container { position: relative; height: 260px; width: 100%; }
.ai-content { font-size: 0.88rem; line-height: 1.6; color: #334155; min-height: 200px; }
.ai-content ul { margin-left: 20px; margin-top: 8px; }

/* Gallery Card */
.gallery-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.gallery-slider { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 10px; }
.gallery-item {
    min-width: 150px;
    text-align: center;
    border: 2px solid var(--border-color);
    padding: 8px;
    border-radius: 10px;
    background: #f8fafc;
    transition: all 0.2s;
}
.gallery-item.active { border-color: var(--primary); background: var(--primary-light); }
.gallery-item img { width: 100%; height: 110px; object-fit: cover; border-radius: 6px; }
.gallery-item p { font-size: 0.75rem; font-weight: 700; margin-top: 6px; }

.btn-secondary {
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    padding: 6px 14px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}

/* Empty State Placeholder */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 180px;
    color: #94a3b8;
    gap: 8px;
    text-align: center;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    color: white;
    text-align: center;
}
.spinner-box {
    background: #1e293b;
    padding: 36px 48px;
    border-radius: 16px;
    border: 1px solid #334155;
    position: relative;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}
.pulse-ring {
    width: 80px; height: 80px;
    border: 4px solid var(--primary);
    border-radius: 50%;
    position: absolute;
    top: 15px; left: calc(50% - 40px);
    animation: pulse 1.5s infinite;
}
@keyframes pulse { 0% { transform: scale(0.8); opacity: 1; } 100% { transform: scale(1.4); opacity: 0; } }

.hidden { display: none !important; }

/* Responsif Mobile & Tablet */
@media (max-width: 1024px) {
    .workspace-grid { grid-template-columns: 1fr; }
    .secondary-grid { grid-template-columns: 1fr; }
    .stat-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .dashboard-container { padding: 12px; gap: 12px; }
    .top-nav { padding: 12px 16px; flex-direction: column; align-items: flex-start; }
    .quick-preset { width: 100%; justify-content: space-between; }
    .quick-preset button { flex: 1; text-align: center; padding: 6px 4px; font-size: 0.75rem; }
    
    .map-card { min-height: 380px; }
    #map { min-height: 320px; width: 100% !important; }
}
