/* ===== CSS VARIABLES ===== */
:root {
    --primary: #5a8a6a;
    --primary-dark: #3d6b4d;   /* Hijau Lumut Gelap */
    --primary-light: #7aab8a;
    --primary-bg: #e8f0eb;
    --primary-bg-light: #f4f8f5;
    --white: #ffffff;
    --text-dark: #000000;       
    --text-muted: #333333;      
    --border: #d4e0d8;
    --danger: #d9534f;
    --danger-dark: #c9302c;
    --warning: #f0ad4e;
    --success: #5a8a6a;
    --info: #5bc0de;
    --shadow: 0 2px 12px rgba(61,107,77,0.08);
    --shadow-lg: 0 8px 30px rgba(61,107,77,0.12);
    --radius: 10px;
    --radius-sm: 6px;
}

/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--white);
    color: var(--text-dark);
    line-height: 1.6;
    font-size: 15px;
}
a { color: var(--primary-dark); text-decoration: none; }
a:hover { color: var(--text-dark); }
img { max-width: 100%; display: block; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

h1, h2, h3, h4, h5, h6 { color: var(--text-dark); }

/* ===== NAVBAR ===== */
.navbar {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 100;
    box-shadow: 0 1px 8px rgba(61,107,77,0.06);
}
.nav-container {
    max-width: 1200px; margin: 0 auto; padding: 0 20px;
    display: flex; align-items: center; justify-content: space-between; height: 64px;
}
.nav-brand {
    font-size: 1.2rem; font-weight: 700; 
    color: var(--primary-dark); /* DIUBAH: Hijau Lumut Gelap */
    display: flex; align-items: center; gap: 10px;
}
.nav-brand img { height: 38px; width: auto; }
.nav-menu { display: flex; align-items: center; gap: 4px; }
.nav-link {
    padding: 8px 14px; border-radius: var(--radius-sm); font-size: 0.9rem;
    color: var(--primary-dark); /* DIUBAH: Hijau Lumut Gelap */
    transition: all 0.2s; font-weight: 500;
}
.nav-link:hover { background: var(--primary-bg); color: var(--text-dark); }
.nav-btn-login { background: var(--primary); color: var(--white) !important; font-weight: 600; }
.nav-btn-login:hover { background: var(--primary-dark); color: var(--white) !important; }
.nav-btn-admin { background: var(--primary-bg); color: var(--primary-dark) !important; font-weight: 600; }
.nav-toggle { display: none; background: none; border: none; font-size: 1.3rem; color: var(--primary-dark); cursor: pointer; /* DIUBAH: Hijau Lumut Gelap */ }

/* ===== MAIN CONTENT ===== */
.main-content { min-height: calc(100vh - 64px - 180px); padding: 30px 0 60px 0; }

/* ===== HERO / BANNER ===== */
.hero {
    background: linear-gradient(135deg, var(--primary-bg-light) 0%, var(--primary-bg) 50%, #dce8df 100%);
    padding: 30px 20px; text-align: center; border-radius: var(--radius);
    margin-bottom: 30px;
}
.hero img { margin: 0 auto 12px; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1)); }
.hero h1 { font-size: 1.8rem; color: var(--text-dark); margin-bottom: 8px; }
.hero p { color: var(--text-muted); font-size: 1rem; max-width: 600px; margin: 0 auto 16px; }
.hero-stats { display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }

/* ===== CARDS ===== */
.stat-card {
    background: var(--white); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 20px 28px; text-align: center; min-width: 140px; box-shadow: var(--shadow);
}
.stat-card .stat-num { font-size: 2rem; font-weight: 800; color: var(--text-dark); }
.stat-card .stat-label { font-size: 0.85rem; color: var(--text-muted); margin-top: 4px; }

.card {
    background: var(--white); border: 1px solid var(--border); border-radius: var(--radius);
    overflow: hidden; box-shadow: var(--shadow); transition: transform 0.25s, box-shadow 0.25s; display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.card-img {
    width: 100%; height: 200px; object-fit: cover; cursor: pointer; transition: transform 0.3s;
}
.card-img:hover { transform: scale(1.03); }
.card-body { padding: 16px; flex: 1; display: flex; flex-direction: column; }
.card-body h3 { font-size: 1rem; font-weight: 700; margin-bottom: 6px; color: var(--text-dark); }
.card-body p { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 8px; }

.card-badge {
    display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600;
}
.badge-hibah { background: #e3f2e8; color: var(--text-dark); }
.badge-pinjam { background: #fff3e0; color: var(--text-dark); }
.badge-tersedia { background: #e3f2e8; color: var(--text-dark); }
.badge-diverifikasi { background: #e3f0ff; color: var(--text-dark); }
.badge-dipinjam { background: #fff3e0; color: var(--text-dark); }
.badge-dihibahkan { background: #f3e5f5; color: var(--text-dark); }
.badge-nonaktif { background: #fce4ec; color: var(--text-dark); }
.badge-menunggu { background: #fff8e1; color: var(--text-dark); }
.badge-diterima { background: #e3f2e8; color: var(--text-dark); }
.badge-ditolak { background: #fce4ec; color: var(--text-dark); }

/* ===== GALERI GRID (Default 4 Kolom) ===== */
.galeri-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.section-title {
    font-size: 1.4rem; font-weight: 700; color: var(--text-dark); margin-bottom: 20px;
    display: flex; align-items: center; gap: 10px;
}
.section-title i { color: var(--primary); }
.see-all {
    display: inline-block; margin-top: 16px; color: var(--primary-dark); font-weight: 600; font-size: 0.95rem;
}
.see-all:hover { color: var(--text-dark); }

/* ===== KATALOG GRID 5 KOLOM ===== */
.katalog-grid-5 {
    display: grid; 
    grid-template-columns: repeat(5, 1fr); 
    gap: 16px;
}
.katalog-grid-5 .card-img {
    height: 160px; 
}
.katalog-grid-5 .card-body h3 {
    font-size: 0.9rem; 
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; 
}
.katalog-grid-5 .card-body p {
    font-size: 0.78rem;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex; align-items: center; gap: 6px; padding: 10px 20px;
    border-radius: var(--radius-sm); border: none; cursor: pointer; font-size: 0.9rem;
    font-weight: 600; transition: all 0.2s; text-decoration: none;
}
.btn-sm { padding: 6px 14px; font-size: 0.82rem; }
.btn-xs { padding: 4px 10px; font-size: 0.78rem; }
.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-dark); color: var(--white); }
.btn-success { background: var(--success); color: var(--white); }
.btn-success:hover { background: var(--primary-dark); color: var(--white); }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: var(--danger-dark); color: var(--white); }
.btn-warning { background: var(--warning); color: var(--text-dark); }
.btn-warning:hover { background: #e09b3f; color: var(--text-dark); }
.btn-outline { background: transparent; border: 1.5px solid var(--primary); color: var(--primary-dark); }
.btn-outline:hover { background: var(--primary); color: var(--white); }
.btn-ajukan { background: var(--primary); color: var(--white); width: 100%; justify-content: center; margin-top: auto; padding-top: 8px; }
.btn-ajukan:hover { background: var(--primary-dark); }

/* ===== FORMS ===== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.9rem; color: var(--text-dark); }
.form-control {
    width: 100%; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
    font-size: 0.9rem; transition: border-color 0.2s; background: var(--white); color: var(--text-dark);
    font-family: inherit;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(90,138,106,0.15); }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%23333333'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
textarea.form-control { resize: vertical; min-height: 80px; }

/* ===== TABLES ===== */
.table-responsive { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
table th, table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); font-size: 0.88rem; color: var(--text-dark); }
table th { background: var(--primary-bg-light); font-weight: 700; color: var(--text-dark); white-space: nowrap; }
table tr:hover td { background: var(--primary-bg-light); }

/* ===== LIGHTBOX ===== */
.lightbox-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.85);
    z-index: 9999; align-items: center; justify-content: center;
}
.lightbox-overlay.active { display: flex; }
.lightbox-content { position: relative; max-width: 90vw; max-height: 90vh; }
.lightbox-content img { 
    max-width: 95vw; max-height: 90vh; object-fit: contain; border-radius: var(--radius-sm); background: #000;
}
.lightbox-close { position: absolute; top: -40px; right: 0; background: none; border: none; color: white; font-size: 2rem; cursor: pointer; }

/* ===== TOAST ===== */
.toast {
    position: fixed; top: 80px; right: 20px; z-index: 10000; padding: 14px 22px;
    border-radius: var(--radius-sm); font-weight: 600; font-size: 0.9rem;
    display: flex; align-items: center; gap: 8px; color: var(--text-dark);
    animation: slideIn 0.3s ease-out; box-shadow: var(--shadow-lg);
}
.toast-success { background: #e3f2e8; border-left: 4px solid var(--primary); }
.toast-error { background: #fce4ec; border-left: 4px solid var(--danger); }
.toast-info { background: #e3f0ff; border-left: 4px solid var(--info); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ===== ADMIN LAYOUT ===== */
.admin-body { background: var(--primary-bg-light); }
.admin-layout { display: flex; min-height: 100vh; }
.sidebar {
    width: 260px; background: var(--white); border-right: 1px solid var(--border);
    position: fixed; top: 0; left: 0; height: 100vh; overflow-y: auto; z-index: 200;
    transition: transform 0.3s;
}
.sidebar-header {
    padding: 16px 20px; font-weight: 800; font-size: 1.1rem; color: var(--primary-dark);
    display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--border); min-height: 64px;
}
.sidebar-header img { height: 38px; width: auto; }
.sidebar-nav { padding: 12px 0; }
.sidebar-link {
    display: flex; align-items: center; gap: 10px; padding: 11px 20px;
    color: var(--text-muted); font-size: 0.9rem; transition: all 0.2s; position: relative;
}
.sidebar-link:hover { background: var(--primary-bg); color: var(--text-dark); }
.sidebar-link.active { background: var(--primary-bg); color: var(--primary-dark); font-weight: 700; border-right: 3px solid var(--primary); }
.sidebar-link .badge {
    position: absolute; right: 16px; background: var(--danger); color: var(--white);
    font-size: 0.7rem; padding: 2px 7px; border-radius: 10px; font-weight: 700;
}
.sidebar-divider { height: 1px; background: var(--border); margin: 10px 20px; }

.admin-main { margin-left: 260px; flex: 1; min-height: 100vh; display: flex; flex-direction: column; }
.admin-topbar {
    background: var(--white); padding: 12px 24px; display: flex; align-items: center;
    border-bottom: 1px solid var(--border); gap: 16px; height: 60px;
}
.sidebar-toggle { display: none; background: none; border: none; font-size: 1.2rem; color: var(--text-dark); cursor: pointer; }
.breadcrumb { flex: 1; font-size: 0.85rem; color: var(--text-muted); }
.breadcrumb a { color: var(--primary-dark); }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.notif-icon { position: relative; cursor: pointer; font-size: 1.1rem; color: var(--text-muted); }
.topbar-user { font-size: 0.88rem; font-weight: 600; color: var(--text-dark); }

.admin-content { padding: 24px; flex: 1; }

/* ===== ADMIN STAT GRID ===== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.admin-stat {
    background: var(--white); border-radius: var(--radius); padding: 20px; border: 1px solid var(--border);
    display: flex; align-items: center; gap: 16px;
}
.admin-stat .icon-box {
    width: 50px; height: 50px; border-radius: var(--radius-sm); display: flex;
    align-items: center; justify-content: center; font-size: 1.3rem;
}
.icon-green { background: #e3f2e8; color: var(--primary-dark); }
.icon-blue { background: #e3f0ff; color: #1565c0; }
.icon-orange { background: #fff3e0; color: #e65100; }
.icon-red { background: #fce4ec; color: var(--danger); }
.icon-purple { background: #f3e5f5; color: #7b1fa2; }
.admin-stat .num { font-size: 1.8rem; font-weight: 800; color: var(--text-dark); }
.admin-stat .lbl { font-size: 0.82rem; color: var(--text-muted); }

/* ===== CARD SECTION (ADMIN) ===== */
.admin-card {
    background: var(--white); border-radius: var(--radius); border: 1px solid var(--border);
    padding: 20px; margin-bottom: 20px;
}
.admin-card h3 { font-size: 1.1rem; font-weight: 700; color: var(--text-dark); margin-bottom: 16px; }
.admin-card-header {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 10px;
}

/* ===== PAGINATION ===== */
.pagination { display: flex; gap: 4px; margin-top: 16px; justify-content: center; }
.pagination a, .pagination span {
    padding: 8px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-size: 0.85rem; color: var(--text-dark);
}
.pagination a:hover { background: var(--primary-bg); }
.pagination .active { background: var(--primary); color: var(--white); border-color: var(--primary); }

/* ===== FILTER / SEARCH BAR ===== */
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; align-items: center; }
.filter-bar .form-control { width: auto; min-width: 180px; }

/* ===== MODAL DIALOG ===== */
.modal-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    z-index: 5000; align-items: center; justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal-box {
    background: var(--white); border-radius: var(--radius); padding: 24px;
    max-width: 500px; width: 90%; max-height: 90vh; overflow-y: auto;
    animation: modalIn 0.25s ease-out;
}
@keyframes modalIn { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ===== FOOTER ===== */
.site-footer { background: var(--primary-dark); color: #d4e0d8; padding: 25px 20px 15px; }
.footer-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 15px; position: relative; }
.footer-grid h4 { color: var(--white); margin-bottom: 8px; font-size: 0.95rem; }
.footer-grid p { color: #d4e0d8; }
.footer-grid a { display: block; color: #b0c9b6; margin-bottom: 6px; font-size: 0.88rem; }
.footer-grid a:hover { color: var(--white); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.15); padding-top: 10px; text-align: center; font-size: 0.82rem; color: #8aaa93; }

/* ===== CEK STATUS ===== */
.status-timeline { position: relative; padding-left: 30px; }
.status-timeline::before {
    content: ''; position: absolute; left: 10px; top: 0; bottom: 0; width: 2px; background: var(--border);
}
.timeline-item { position: relative; margin-bottom: 24px; }
.timeline-item::before {
    content: ''; position: absolute; left: -24px; top: 4px; width: 12px; height: 12px;
    border-radius: 50%; background: var(--border); border: 2px solid var(--white);
}
.timeline-item.active::before { background: var(--primary); }
.timeline-item h4 { font-size: 0.95rem; font-weight: 700; color: var(--text-dark); }
.timeline-item p { font-size: 0.85rem; color: var(--text-muted); }

/* ===== LOGIN ===== */
.login-wrapper {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--primary-bg-light) 0%, var(--primary-bg) 100%);
}
.login-box {
    background: var(--white); border-radius: var(--radius); padding: 40px;
    width: 400px; max-width: 95%; box-shadow: var(--shadow-lg);
}
.login-box h2 { text-align: center; color: var(--text-dark); margin-bottom: 8px; }
.login-box .subtitle { text-align: center; color: var(--text-muted); margin-bottom: 24px; font-size: 0.9rem; }
.login-logo { text-align: center; font-size: 3rem; color: var(--primary); margin-bottom: 16px; }

/* ===== SKELETON LOADING ===== */
.skeleton { background: linear-gradient(90deg, var(--primary-bg) 25%, var(--primary-bg-light) 50%, var(--primary-bg) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: var(--radius-sm); }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }

/* ===== DOKUMENTASI GRID ===== */
.dokumentasi-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.dokumentasi-item { border-radius: var(--radius); overflow: hidden; position: relative; cursor: pointer; }
.dokumentasi-item img { width: 100%; height: 220px; object-fit: cover; transition: transform 0.3s; }
.dokumentasi-item:hover img { transform: scale(1.05); }
.dokumentasi-item .caption {
    position: absolute; bottom: 0; left: 0; right: 0; padding: 10px;
    background: linear-gradient(transparent, rgba(0,0,0,0.7)); color: white; font-size: 0.85rem;
}

/* ===== CONFIRM DIALOG ===== */
.confirm-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    z-index: 6000; align-items: center; justify-content: center;
}
.confirm-overlay.active { display: flex; }
.confirm-box {
    background: var(--white); border-radius: var(--radius); padding: 28px; text-align: center;
    max-width: 380px; width: 90%;
}
.confirm-box p { margin-bottom: 20px; font-size: 1rem; color: var(--text-dark); }
.confirm-box .btn-group { display: flex; gap: 10px; justify-content: center; }

/* ===== CHART PLACEHOLDER ===== */
.chart-container { position: relative; height: 250px; }
canvas.chart { width: 100% !important; height: 100% !important; }

/* ===== PRINT STYLES ===== */
@media print {
    .no-print, .sidebar, .admin-topbar, .site-footer, .nav-toggle, .btn { display: none !important; }
    .admin-main { margin-left: 0 !important; }
    .admin-content { padding: 0 !important; }
    .print-only { display: block !important; }
    body { background: white; color: black; }
    table th, table td { border: 1px solid #ccc !important; color: black !important; }
}
.print-only { display: none; }

/* ===== RESPONSIVE ===== */
@media (max-width: 992px) {
    .galeri-grid { grid-template-columns: repeat(3, 1fr); }
    .katalog-grid-5 { grid-template-columns: repeat(3, 1fr); }
    .footer-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .galeri-grid { grid-template-columns: repeat(2, 1fr); }
    .dokumentasi-grid { grid-template-columns: repeat(2, 1fr); }
    .katalog-grid-5 { grid-template-columns: repeat(2, 1fr); }
    .nav-menu {
        display: none; position: absolute; top: 64px; left: 0; right: 0;
        background: var(--white); flex-direction: column; padding: 10px;
        border-bottom: 1px solid var(--border); box-shadow: var(--shadow); z-index: 99;
    }
    .nav-menu.active { display: flex; }
    .nav-toggle { display: block; }
    .hero h1 { font-size: 1.6rem; }
    .hero-stats { flex-direction: column; align-items: center; }
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
    .admin-main { margin-left: 0; }
    .sidebar-toggle { display: block; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .footer-grid { grid-template-columns: 1fr; }
    .filter-bar { flex-direction: column; }
    .filter-bar .form-control { width: 100%; min-width: auto; }
    .admin-card-header { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 480px) {
    .galeri-grid { grid-template-columns: 1fr; }
    .dokumentasi-grid { grid-template-columns: 1fr; }
    .katalog-grid-5 { grid-template-columns: repeat(2, 1fr); }
    .katalog-grid-5 .card-img { height: 120px; }
    .stat-grid { grid-template-columns: 1fr; }
    .hero img { height: 80px; }
    .nav-brand span { display: none; }
}