/**
 * Dashboard Custom CSS
 * MBG Papua Dashboard
 */

/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: #f5f6fa;
    color: #2c3e50;
}

/* Wrapper Layout */
.wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: linear-gradient(135deg, #192a56 0%, #0097e6 100%);
    color: #fff;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    transition: all 0.3s;
    z-index: 1000;
}

.sidebar.collapsed {
    width: 70px;
}

.sidebar.collapsed .sidebar-header h4,
.sidebar.collapsed .nav-link span,
.sidebar.collapsed .user-details {
    display: none;
}

.sidebar.collapsed .sidebar-header {
    justify-content: center;
}

.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 12px 0;
}

.sidebar.collapsed .nav-link i {
    margin: 0;
}

.sidebar.collapsed .has-submenu .fa-chevron-down {
    display: none;
}

.sidebar.collapsed .submenu {
    display: none !important;
}

.sidebar-header {
    padding: 25px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 15px;
}

.sidebar-logo {
    width: 45px;
    height: 45px;
    object-fit: contain;
}

.sidebar-header h4 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
}

.sidebar-toggle {
    display: none;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    margin-left: auto;
    cursor: pointer;
}

.sidebar-nav {
    padding: 20px 0;
}

.sidebar-nav .nav-link {
    color: rgba(255,255,255,0.8);
    padding: 12px 25px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s;
    border-left: 3px solid transparent;
    text-decoration: none;
}

.sidebar-nav .nav-link:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border-left-color: #fff;
}

.sidebar-nav .nav-link.active {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border-left-color: #fff;
}

.sidebar-nav .nav-link i {
    font-size: 1.1rem;
    width: 20px;
}

.sidebar-nav .submenu {
    background: rgba(0,0,0,0.1);
    padding: 0;
}

.sidebar-nav .submenu li {
    list-style: none;
}

.sidebar-nav .submenu a {
    color: rgba(255,255,255,0.7);
    padding: 10px 25px 10px 65px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s;
    text-decoration: none;
}

.sidebar-nav .submenu a:hover {
    background: rgba(255,255,255,0.05);
    color: #fff;
}

.sidebar-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar i {
    font-size: 1.3rem;
    color: rgba(255,255,255,0.8);
}

.user-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.user-role {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.6);
}

/* Main Content */
.main-content {
    margin-left: 280px;
    width: calc(100% - 280px);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: all 0.3s;
}

.sidebar.collapsed ~ .main-content {
    margin-left: 70px;
    width: calc(100% - 70px);
}

/* Header */
.header {
    background: #fff;
    padding: 20px 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.btn-toggle-sidebar {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: #2c3e50;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 8px;
    transition: all 0.3s;
}

.btn-toggle-sidebar:hover {
    background: #f5f6fa;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #192a56;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-icon {
    background: transparent;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #2c3e50;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.btn-icon:hover {
    background: #f5f6fa;
}

.btn-icon .badge {
    position: absolute;
    top: 0;
    right: 0;
    background: #e74c3c;
    color: #fff;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
}

/* Content */
.content {
    flex: 1;
    padding: 30px;
}

.page-header {
    margin-bottom: 30px;
}

.page-header h1 {
    font-size: 2rem;
    font-weight: 800;
    color: #192a56;
    margin-bottom: 5px;
}

.page-header .page-subtitle {
    color: #7f8c8d;
    font-size: 1rem;
}

/* Footer */
.footer {
    background: #fff;
    padding: 20px 30px;
    border-top: 1px solid #e9ecef;
    margin-top: auto;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-left,
.footer-right {
    font-size: 0.9rem;
    color: #7f8c8d;
}

/* Responsive */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .sidebar-toggle {
        display: block;
    }
    
    .main-content {
        margin-left: 0;
    }
}

/* KPI Cards */
.kpi-card {
    background: #fff;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 20px;
    border-left: 4px solid;
}

.kpi-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.kpi-card.kpi-primary { border-left-color: #0097e6; }
.kpi-card.kpi-success { border-left-color: #44bd32; }
.kpi-card.kpi-info { border-left-color: #00d2d3; }
.kpi-card.kpi-warning { border-left-color: #fbc531; }
.kpi-card.kpi-danger { border-left-color: #e84118; }
.kpi-card.kpi-purple { border-left-color: #8c7ae6; }
.kpi-card.kpi-orange { border-left-color: #e1b12c; }

.kpi-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: #fff;
}

.kpi-primary .kpi-icon { background: linear-gradient(135deg, #0097e6 0%, #487eb0 100%); }
.kpi-success .kpi-icon { background: linear-gradient(135deg, #44bd32 0%, #4cd137 100%); }
.kpi-info .kpi-icon { background: linear-gradient(135deg, #00d2d3 0%, #0097e6 100%); }
.kpi-warning .kpi-icon { background: linear-gradient(135deg, #fbc531 0%, #e1b12c 100%); }
.kpi-danger .kpi-icon { background: linear-gradient(135deg, #e84118 0%, #c23616 100%); }
.kpi-purple .kpi-icon { background: linear-gradient(135deg, #8c7ae6 0%, #9c88ff 100%); }
.kpi-orange .kpi-icon { background: linear-gradient(135deg, #e1b12c 0%, #fbc531 100%); }

.kpi-content {
    flex: 1;
}

.kpi-value {
    font-size: 2rem;
    font-weight: 700;
    color: #192a56;
    margin-bottom: 5px;
}

.kpi-label {
    font-size: 0.9rem;
    color: #718093;
    font-weight: 500;
}

/* Cards */
.card {
    border: none;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    margin-bottom: 20px;
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #e9ecef;
    border-radius: 15px 15px 0 0 !important;
    padding: 20px;
}

.card-title {
    font-weight: 700;
    color: #192a56;
    font-size: 1.1rem;
}

.card-body {
    padding: 25px;
}

/* Map Styles */
#map {
    border-radius: 0 0 15px 15px;
}

.leaflet-popup-content-wrapper {
    border-radius: 10px;
    box-shadow: 0 3px 14px rgba(0,0,0,0.2);
}

.marker-popup h6 {
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e9ecef;
}

.marker-popup p {
    margin-bottom: 5px;
    font-size: 0.9rem;
}

/* Custom Markers */
.custom-marker {
    background: transparent;
    border: none;
}

.marker-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.marker-sekolah { background: #3498db; }
.marker-sppg { background: #2ecc71; }
.marker-supplier { background: #f39c12; }
.marker-klb { background: #e74c3c; }

/* Marker Clusters */
.marker-cluster-custom {
    background: transparent;
}

.marker-cluster {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.marker-cluster-sekolah { background: #3498db; }
.marker-cluster-sppg { background: #2ecc71; }
.marker-cluster-supplier { background: #f39c12; }
.marker-cluster-klb { background: #e74c3c; }

/* Alert Styles */
.alert {
    border-radius: 10px;
    border: none;
}

.alert i {
    font-size: 1.2rem;
}

/* Timeline */
.timeline {
    position: relative;
    padding-left: 50px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 20px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e9ecef;
}

.timeline-item {
    position: relative;
    margin-bottom: 30px;
}

.timeline-marker {
    position: absolute;
    left: -38px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #7f8c8d;
    font-size: 1rem;
}

.timeline-success .timeline-marker {
    border-color: #2ecc71;
    color: #2ecc71;
    background: #d5f4e6;
}

.timeline-primary .timeline-marker {
    border-color: #3498db;
    color: #3498db;
    background: #d6eaf8;
}

.timeline-warning .timeline-marker {
    border-color: #f39c12;
    color: #f39c12;
    background: #fef5e7;
}

.timeline-content {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
}

.timeline-time {
    font-size: 0.85rem;
    color: #7f8c8d;
    font-weight: 600;
    margin-bottom: 5px;
}

.timeline-title {
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 5px;
    font-size: 1rem;
}

.timeline-description {
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-bottom: 0;
}

/* Chart Container */
canvas {
    max-height: 300px;
}

/* Loading State */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0,0,0,0.1);
    border-radius: 50%;
    border-top-color: #0097e6;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Toast Container */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
}

.toast {
    min-width: 300px;
}

/* Responsive */
@media (max-width: 768px) {
    .kpi-card {
        padding: 20px;
    }
    
    .kpi-icon {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
    
    .kpi-value {
        font-size: 1.5rem;
    }
    
    .kpi-label {
        font-size: 0.85rem;
    }
    
    #map {
        height: 400px !important;
    }
}

/* Utilities */
.text-gradient {
    background: linear-gradient(135deg, #0097e6 0%, #487eb0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.bg-gradient-primary {
    background: linear-gradient(135deg, #0097e6 0%, #487eb0 100%);
}

.bg-gradient-success {
    background: linear-gradient(135deg, #44bd32 0%, #4cd137 100%);
}

.bg-gradient-info {
    background: linear-gradient(135deg, #00d2d3 0%, #0097e6 100%);
}

.bg-gradient-warning {
    background: linear-gradient(135deg, #fbc531 0%, #e1b12c 100%);
}

.bg-gradient-danger {
    background: linear-gradient(135deg, #e84118 0%, #c23616 100%);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #0097e6;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #487eb0;
}
