:root {
    --primary: #1B5E20; --primary-light: #4CAF50; --primary-soft: #E8F5E9;
    --admin-bg: #1e293b; --admin-hover: #334155;
    --bg-color: #F8F9FA; --surface: #FFFFFF;
    --text-main: #1f2937; --text-muted: #6b7280;
    --border: #e5e7eb; --radius: 16px;
    --shadow-soft: 0 4px 20px rgba(0,0,0,0.03); --shadow-hover: 0 10px 25px rgba(0,0,0,0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Poppins', sans-serif; }
body { background-color: var(--bg-color); color: var(--text-main); font-size: 14px; overflow-x: hidden;}

/* Utility & Animations */
.w-100 { width: 100%; } .text-muted { color: var(--text-muted); }
.link-sm { color: var(--primary-light); text-decoration: none; font-size: 0.85rem; font-weight: 500;} .link-sm:hover { color: var(--primary); text-decoration: underline; }
.float-right { float: right; }
.d-mobile { display: none; }

@keyframes fadeInUp { from{opacity:0; transform:translateY(20px);} to{opacity:1; transform:translateY(0);} }
@keyframes slideDown { from{opacity:0; transform:translateY(-20px);} to{opacity:1; transform:translateY(0);} }
@keyframes fadeIn { from{opacity:0;} to{opacity:1;} }
@keyframes bounceSlow { 0%,100%{transform:translateY(0);} 50%{transform:translateY(-5px);} }

.animate-fade-in { animation: fadeIn 0.8s ease forwards; }
.animate-slide-up { animation: fadeInUp 0.6s cubic-bezier(0.16,1,0.3,1) forwards; opacity: 0; }
.animate-slide-down { animation: slideDown 0.6s ease forwards; }
.animate-bounce-slow { animation: bounceSlow 3s infinite ease-in-out; }
.animate-card { animation: fadeInUp 0.6s forwards; opacity: 0; }
.stagger-1{animation-delay:0.1s;}.stagger-2{animation-delay:0.2s;}.stagger-3{animation-delay:0.3s;}
.stagger-4{animation-delay:0.4s;}.stagger-5{animation-delay:0.5s;}.stagger-6{animation-delay:0.6s;}
.stagger-7{animation-delay:0.7s;}.stagger-8{animation-delay:0.8s;}.stagger-9{animation-delay:0.9s;}

/* Buttons */
.btn-primary { background: var(--primary); color: white; border: none; padding: 12px 20px; border-radius: 8px; cursor: pointer; font-weight: 600; transition: 0.3s;}
.btn-primary:hover { background: #144d18; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(27,94,32,0.3); }
.btn-sm { padding: 6px 12px; border-radius: 6px; font-size: 0.8rem; }
.btn-icon { background: none; border: none; font-size: 1.2rem; color: #ef4444; cursor: pointer; padding: 5px; border-radius: 50%; transition: 0.3s;} .btn-icon:hover { background: #fee2e2; transform: scale(1.1); }
.hamburger { background:none; border:none; font-size: 1.5rem; color: var(--text-main); cursor:pointer;}

/* Split Login */
.split-screen { display: flex; height: 100vh; }
.left-illustration { flex: 1.2; background: linear-gradient(135deg, var(--primary), var(--primary-light)); display: flex; align-items: center; justify-content: center; padding: 2rem; }
.glass-box { background: rgba(255,255,255,0.1); backdrop-filter: blur(12px); padding: 3rem; border-radius: 24px; color: white; border: 1px solid rgba(255,255,255,0.2); text-align: center;}
.right-form { flex: 1; display: flex; align-items: center; justify-content: center; background: var(--surface); }
.auth-form { width: 100%; max-width: 380px; }
.input-group { position: relative; margin: 20px 0; }
.input-group i { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.input-group input { width: 100%; padding: 14px 15px 14px 45px; border: 1px solid var(--border); border-radius: 12px; outline: none; background: #f9fafb;}

/* App Layout & Sidebar */
.app-layout { display: flex; height: 100vh; overflow: hidden; width: 100%; position: relative;}
.sidebar { width: 260px; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; z-index: 1000; transition: left 0.3s ease; height:100%;}
.close-sidebar { position: absolute; right: 15px; top: 15px; font-size: 1.5rem; cursor:pointer; color: var(--text-muted); }
.brand { padding: 25px 20px; font-size: 1.3rem; font-weight: 700; color: var(--primary); display:flex; flex-direction: column; border-bottom: 1px solid var(--border);}
.brand span { font-size: 0.7rem; color: var(--text-muted); font-weight: 400;}
.menu { flex: 1; overflow-y: auto; padding: 20px 0; }
.menu a { display: flex; align-items: center; padding: 12px 20px; color: var(--text-muted); text-decoration: none; font-weight: 500; margin: 4px 15px; border-radius: 10px; transition: 0.3s;}
.menu a i { width: 30px; font-size: 1.1rem; }
.menu a:hover, .menu a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; transform: translateX(5px);}
.promo-box { margin: 15px; padding: 20px; background: var(--primary-soft); border-radius: 16px; text-align: center; }

/* Main Content */
.main-content { flex: 1; display: flex; flex-direction: column; overflow-y: auto; overflow-x:hidden; padding: 25px; background: var(--bg-color); width: 100%;}
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; }
.greeting h2 { font-size: 1.5rem; color: var(--text-main); }
.user-profile { display: flex; align-items: center; gap: 15px; }
.notif-badge { position: relative; font-size: 1.2rem; cursor: pointer; transition: 0.3s;}
.notif-badge .badge { position: absolute; top:-5px; right:-5px; background:#ef4444; color:white; font-size:0.6rem; padding:2px 5px; border-radius:10px; font-weight:bold;}
.avatar-img { width: 42px; height: 42px; border-radius: 50%; border: 2px solid white; box-shadow: var(--shadow-soft);}
.user-info { text-align: right; }

/* Grid Dashboard */
.dashboard-complex-grid { display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start; }
.center-column, .right-column { display: flex; flex-direction: column; gap: 20px; }
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.charts-row, .info-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

/* Cards & Components */
/* min-width: 0 is important for CSS Grid so elements don't overflow the grid boundaries */
.card { background: var(--surface); padding: 20px; border-radius: var(--radius); box-shadow: var(--shadow-soft); transition: 0.3s; min-width: 0; }
.card:hover { box-shadow: var(--shadow-hover); }
.card-header-flex { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.stat-card { background: var(--surface); padding: 20px; border-radius: var(--radius); box-shadow: var(--shadow-soft); display: flex; align-items: center; gap: 15px; transition: 0.3s; min-width: 0; }
.stat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.icon-bg { width: 55px; height: 55px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 1.6rem; flex-shrink:0;}
.icon-bg.green { background: #e0f2f1; color: #00897b; } .icon-bg.gold { background: #fff8e1; color: #ffb300; } .icon-bg.blue { background: #e3f2fd; color: #1e88e5; }
.chart-container { position: relative; height: 180px; width: 100%; }

/* Lists */
.list-group { list-style: none; }
.list-group li { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 0.85rem; }
.list-group li:last-child { border: none; padding-bottom: 0;}
.rank-list li { padding: 10px; border-radius: 8px; border:none; margin-bottom: 5px; background: #f9fafb; transition: 0.3s;} .rank-list li:hover { transform: translateX(5px); }
.rank-badge { width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 0.7rem; font-weight: bold; margin-right: 10px;}
.rank-1{background:#fff3e0; color:#e65100;} .rank-2{background:#f5f5f5; color:#616161;} .rank-3{background:#efebe9; color:#5d4037;}

.event-banner { background: #e8f5e9; border: 1px dashed #81c784; text-align: center; }
.event-banner span { background: var(--primary); color: white; padding: 3px 10px; border-radius: 10px; font-size: 0.7rem; font-weight: bold; margin-bottom: 10px; display: inline-block;}

/* Tables Responsiveness */
.table-responsive { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch;}
.table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 0.9rem;}
.table th, .table td { padding: 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap;}
.table th { background: var(--bg-color); font-weight: 600; color:var(--text-muted);}

/* NEW BEAUTIFUL VIEWS */
.view-section, .admin-section { display: none; }
.view-section.active, .admin-section.active { display: block; }

.profile-card { text-align: center; padding: 40px; }
.profile-header img { width: 100px; height: 100px; border-radius: 50%; margin-bottom: 15px; border:4px solid var(--primary-soft);}
.profile-stats { display: flex; justify-content: center; gap: 30px; margin-top: 30px; border-top: 1px solid var(--border); padding-top: 20px;}

.reward-full-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; margin-top: 20px;}
.reward-card { background: var(--surface); border-radius: 16px; padding: 20px; text-align: center; box-shadow: var(--shadow-soft); transition: 0.3s;}
.reward-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-hover); border:1px solid var(--primary-light);}
.reward-card i { font-size: 3rem; color: var(--primary); margin-bottom: 15px;}

.articles-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; margin-top: 20px;}
.article-card { background: var(--surface); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow-soft); cursor: pointer; transition: 0.3s;}
.article-card:hover { transform: translateY(-5px);}
.article-card img { width: 100%; height: 120px; object-fit: cover; }
.article-card h5 { padding: 15px 15px 5px; font-size: 0.9rem;} .article-card p { padding: 0 15px 15px; font-size: 0.8rem; color: var(--text-muted);}

.leaderboard-podium { display: flex; justify-content: center; align-items: flex-end; gap: 15px; margin-top: 20px; padding: 20px; background:var(--surface); border-radius:var(--radius);}
.podium-item { display: flex; flex-direction: column; align-items: center; width: 100px;}
.podium-item img { width: 60px; height: 60px; border-radius: 50%; margin-bottom: 10px; border: 3px solid #fff; box-shadow: var(--shadow-soft);}
.podium-bar { width: 100%; border-radius: 8px 8px 0 0; display:flex; justify-content:center; align-items:flex-start; padding-top:10px; color:white; font-weight:bold; font-size:1.5rem;}
.podium-2 .podium-bar { height: 100px; background: #94a3b8; }
.podium-1 .podium-bar { height: 140px; background: #fbbf24; }
.podium-1 img { width: 80px; height: 80px; border-color: #fbbf24;}
.podium-3 .podium-bar { height: 80px; background: #b45309; }

/* Modals */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); display: none; align-items: center; justify-content: center; z-index: 2000; opacity: 0; transition: 0.3s;}
.modal-overlay.show { display: flex; opacity: 1; }
.modal-content.glass { background: #fff; padding: 30px; border-radius: 20px; width: 90%; max-width: 400px; position: relative; animation: zoomInModal 0.3s; }
.close-btn { position: absolute; top: 15px; right: 20px; font-size: 1.5rem; cursor: pointer;}
.form-group { margin-bottom: 15px; } .form-group label { display: block; margin-bottom: 5px; font-size: 0.85rem;}
/* Font size 16px is required on inputs to prevent iOS automatic zoom on focus */
.form-group input, .form-group select { width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: 10px; outline: none; background: #f9fafb; font-size: 16px;}

/* Mobile & Overlay */
#sidebar-overlay { position: fixed; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.5); z-index:900; display:none;}

/* =========================================================
   RESPONSIVE DESIGN (The Magic for All Devices)
   ========================================================= */

/* LAPTOP / SMALL DESKTOP (Max 1100px) */
@media (max-width: 1100px) {
    .dashboard-complex-grid { grid-template-columns: 1fr; } /* Stack kanan pindah ke bawah */
    .right-column { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; } /* Bagian bawah jadi 2 kolom */
    .stats-row, .charts-row, .info-row { grid-template-columns: repeat(2, 1fr); } /* Baris tengah jadi 2 kolom biar ga sesak */
}

/* TABLET PORTRAIT / LARGE PHONES (Max 992px) */
@media (max-width: 992px) {
    .right-column { grid-template-columns: 1fr; }
}

/* MOBILE PHONES (Max 768px) */
@media (max-width: 768px) {
    .d-mobile { display: block; }
    .hide-mobile { display: none; }
    
    /* Sidebar masuk ke Drawer (Geser kiri) */
    .sidebar { position: fixed; left: -280px; width: 260px; height: 100%; z-index: 1001; transition: left 0.3s ease; }
    .sidebar.open { left: 0; box-shadow: 4px 0 15px rgba(0,0,0,0.1); }
    #sidebar-overlay { z-index: 1000; }
    #sidebar-overlay.show { display: block; }
    
    /* Padding disesuaikan */
    .main-content { padding: 15px; width: 100vw; }
    
    /* Grid semua jadi 1 kolom menyusun vertikal */
    .stats-row, .charts-row, .info-row { grid-template-columns: 1fr; }
    
    /* Login Page jadi 1 kolom (Gambar Hilang) */
    .split-screen { flex-direction: column; }
    .left-illustration { display: none; }
    .right-form { padding: 20px; }
    
    .profile-stats { flex-direction: column; gap: 15px; }
    .greeting h2 { font-size: 1.3rem; }
    
    /* Perbaikan Chart Container untuk Mobile agar lebih tinggi */
    .chart-container { height: 250px; }
    
    /* Penyesuaian Podium Leaderboard di Mobile */
    .podium-item { width: 80px; }
    .podium-item img { width: 50px; height: 50px; }
    .podium-1 img { width: 70px; height: 70px; }
}

/* SMALL MOBILE (Max 480px) */
@media (max-width: 480px) {
    .card { padding: 15px; }
    .stat-card { padding: 15px; flex-direction: column; text-align: center; } /* Stat Card atas bawah */
    .icon-bg { margin-bottom: 10px; }
    
    .impact-content { flex-direction: column; text-align: center; }
    .impact-globe { font-size: 3rem; margin-bottom: 15px;}
    .impact-details { align-items: center;}
    
    .articles-row, .reward-full-grid { grid-template-columns: 1fr; }
}