:root {
    --bg:           #0d1a12;
    --bg-2:         #111f17;
    --bg-card:      #162212;
    --bg-card-2:    #1c2e1c;
    --hijau:        #2e9958;
    --hijau-terang: #3ab86a;
    --hijau-gelap:  #1a6b3c;
    --hijau-muda:   rgba(46,153,88,0.12);
    --emas:         #c8a020;
    --emas-terang:  #f0c83a;
    --emas-muda:    rgba(200,160,32,0.12);
    --krem:         #f5f0e8;
    --border:       rgba(200,160,32,0.15);
    --border-hijau: rgba(46,153,88,0.2);
    --text:         #dde8d8;
    --text-muted:   #7a9e80;
    --white:        #ffffff;
    --font-serif:   'Playfair Display', Georgia, serif;
    --font-body:    'Tajawal', sans-serif;
    --font-arabic:  'Amiri', serif;
    --radius:       16px;
    --radius-sm:    8px;
    --transition:   0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow:       0 12px 40px rgba(0,0,0,0.45);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
    line-height: 1.7;
}
a { text-decoration: none; color: inherit; }
ul { list-style: none; }

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--emas); border-radius: 2px; }

.bg-ornament { position: fixed; pointer-events: none; z-index: 0; opacity: 0.03; border-radius: 50%; }
.bg-orn-1 { width: 700px; height: 700px; background: radial-gradient(circle, var(--emas) 0%, transparent 70%); top: -200px; right: -200px; }
.bg-orn-2 { width: 600px; height: 600px; background: radial-gradient(circle, var(--hijau) 0%, transparent 70%); bottom: 0; left: -200px; }

.container { max-width: 1180px; margin: 0 auto; padding: 0 24px; position: relative; z-index: 1; }

/* ---- HEADER ---- */
.header {
    position: fixed; top: 0; left: 0; right: 0;
    z-index: 1000; padding: 0 24px;
    background: rgba(13,26,18,0.97);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}
.header-inner {
    max-width: 1180px; margin: 0 auto;
    display: flex; align-items: center; justify-content: space-between;
    height: 70px;
}

/* ---- LOGO (SUDAH DISATUKAN & DIOPTIMALKAN) ---- */
.logo { 
    display: flex; 
    align-items: center; 
    gap: 12px; 
    cursor: pointer;
}
.logo-img {
    height: 40px;
    width: auto;
    object-fit: contain;
    display: block;
}
.logo-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.logo-arabic { font-family: var(--font-arabic); font-size: 18px; color: var(--emas); }
.logo-name { 
    font-family: var(--font-serif); 
    font-size: 18px; 
    font-weight: 700; 
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, #1a6b3c 0%, #2e9958 40%, #c8a020 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
    transition: var(--transition);
    /* Menggunakan filter drop-shadow agar tidak merusak efek background-clip text */
    filter: drop-shadow(0px 2px 4px rgba(0, 0, 0, 0.3)); 
}
.logo:hover .logo-name {
    background: linear-gradient(135deg, #2e9958 0%, #c8a020 60%, #f0c83a 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    transform: scale(1.02);
}

.nav-back {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 13px; color: var(--text-muted);
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 8px 16px; border-radius: 50px;
    transition: var(--transition);
}
.nav-back:hover { color: var(--emas); border-color: var(--emas); }

/* ---- HERO GALERI ---- */
.galeri-hero {
    padding: 110px 0 60px;
    background:
        radial-gradient(ellipse 70% 60% at 0% 100%, rgba(26,107,60,0.12) 0%, transparent 60%),
        radial-gradient(ellipse 50% 40% at 100% 0%, rgba(200,160,32,0.05) 0%, transparent 50%),
        var(--bg);
    border-bottom: 1px solid var(--border);
}
.hero-inner { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.section-label {
    display: inline-block;
    font-size: 11px; font-weight: 500; letter-spacing: 2.5px; text-transform: uppercase;
    color: var(--emas);
    background: var(--emas-muda);
    border: 1px solid rgba(200,160,32,0.3);
    padding: 5px 16px; border-radius: 50px;
    margin-bottom: 14px;
}
.hero-title {
    font-family: var(--font-serif);
    font-size: clamp(32px, 4vw, 52px);
    font-weight: 700; line-height: 1.15;
    color: var(--white); margin-bottom: 14px;
}
.hero-title em { color: var(--emas); font-style: italic; }
.hero-subtitle { font-size: 16px; color: var(--text-muted); max-width: 540px; margin-bottom: 32px; }

.hero-stats { display: flex; gap: 32px; flex-wrap: wrap; }
.hstat { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-muted); }
.hstat-num { font-family: var(--font-serif); font-size: 24px; font-weight: 700; color: var(--emas); }

/* ---- UPLOAD AREA ---- */
.upload-section {
    background: var(--bg-2);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 28px 0;
}
.upload-inner {
    max-width: 1180px; margin: 0 auto; padding: 0 24px;
    display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
}
.upload-zone {
    flex: 1; min-width: 260px;
    border: 1.5px dashed rgba(200,160,32,0.35);
    border-radius: var(--radius);
    padding: 20px 28px;
    display: flex; align-items: center; gap: 16px;
    cursor: pointer; transition: var(--transition);
    background: var(--bg-card);
    position: relative; overflow: hidden;
}
.upload-zone:hover, .upload-zone.dragging { border-color: var(--emas); background: var(--emas-muda); }
.upload-zone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload-icon {
    width: 48px; height: 48px; flex-shrink: 0;
    background: var(--emas-muda);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; color: var(--emas);
}
.upload-text strong { display: block; font-size: 15px; color: var(--white); margin-bottom: 3px; }
.upload-text span { font-size: 12px; color: var(--text-muted); }

.upload-meta { display: flex; flex-direction: column; gap: 10px; min-width: 220px; }
.upload-meta select, .upload-meta input {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 9px 14px;
    font-size: 13px; color: var(--text);
    font-family: var(--font-body);
    outline: none; transition: var(--transition);
}
.upload-meta select:focus, .upload-meta input:focus { border-color: var(--emas); }
.upload-meta select option { background: var(--bg-2); }

.btn-upload {
    display: inline-flex; align-items: center; gap: 8px;
    background: linear-gradient(135deg, var(--hijau-gelap), var(--hijau));
    color: #fff; font-family: var(--font-body);
    font-size: 14px; font-weight: 500;
    padding: 11px 22px; border-radius: 50px;
    border: none; cursor: pointer; transition: var(--transition);
    white-space: nowrap;
}
.btn-upload:hover { background: var(--hijau-terang); transform: translateY(-1px); }

/* ---- FILTER & SEARCH BAR ---- */
.filter-bar {
    padding: 28px 0;
    background: var(--bg);
    position: sticky; top: 70px; z-index: 100;
    border-bottom: 1px solid var(--border);
}
.filter-inner {
    max-width: 1180px; margin: 0 auto; padding: 0 24px;
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.search-box {
    display: flex; align-items: center; gap: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50px;
    padding: 9px 18px;
    flex: 1; min-width: 200px;
    transition: var(--transition);
}
.search-box:focus-within { border-color: var(--emas); }
.search-box i { color: var(--text-muted); font-size: 14px; }
.search-box input {
    background: none; border: none; outline: none;
    font-size: 14px; color: var(--text);
    font-family: var(--font-body); width: 100%;
}
.search-box input::placeholder { color: var(--text-muted); }

.filter-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
    font-size: 13px; font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 7px 16px; border-radius: 50px;
    cursor: pointer; transition: var(--transition);
    white-space: nowrap;
}
.chip:hover { border-color: var(--emas); color: var(--emas); }
.chip.active { background: linear-gradient(135deg, var(--hijau-gelap), var(--hijau)); color: #fff; border-color: transparent; }

.view-toggle { display: flex; gap: 4px; margin-left: auto; }
.view-btn {
    width: 36px; height: 36px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px; color: var(--text-muted);
    cursor: pointer; transition: var(--transition);
}
.view-btn.active, .view-btn:hover { border-color: var(--emas); color: var(--emas); }

/* ---- GALERI GRID ---- */
.galeri-main { padding: 40px 0 80px; background: var(--bg); }
.galeri-grid { columns: 4 240px; column-gap: 14px; }
.galeri-grid.view-list { columns: 1; }

.photo-card {
    break-inside: avoid;
    display: inline-block; /* Mencegah card terpotong di tengah layout masonry */
    width: 100%;
    margin-bottom: 14px;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border-hijau);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}
.photo-card:hover { border-color: var(--emas); transform: translateY(-3px); box-shadow: 0 12px 32px rgba(0,0,0,0.4); }

.photo-thumb { position: relative; overflow: hidden; }
.photo-thumb-img { width: 100%; display: block; aspect-ratio: 4/3; object-fit: cover; transition: transform 0.4s ease; }
.photo-card:hover .photo-thumb-img { transform: scale(1.04); }
.photo-placeholder { width: 100%; display: block; }

.photo-overlay {
    position: absolute; inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, transparent 55%);
    opacity: 0; transition: var(--transition);
    display: flex; align-items: flex-end; padding: 16px;
}
.photo-card:hover .photo-overlay { opacity: 1; }
.photo-overlay-actions { display: flex; gap: 8px; }
.ov-btn {
    width: 34px; height: 34px;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(8px);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; color: #fff;
    border: 1px solid rgba(255,255,255,0.2);
    transition: var(--transition);
}
.ov-btn:hover { background: var(--emas); border-color: var(--emas); color: #000; }

.photo-cat-badge { position: absolute; top: 10px; left: 10px; font-size: 10px; font-weight: 600; padding: 3px 10px; border-radius: 50px; letter-spacing: 0.5px; }
.cat-reuni    { background: rgba(46,153,88,0.85);   color: #fff; }
.cat-kegiatan { background: rgba(200,160,32,0.85);  color: #1a1000; }
.cat-wisuda   { background: rgba(44,62,122,0.85);   color: #fff; }
.cat-masjid   { background: rgba(92,61,46,0.85);    color: #fff; }
.cat-santri   { background: rgba(13,21,48,0.85);    color: rgba(200,160,32,0.9); border: 1px solid rgba(200,160,32,0.4); }

.photo-info { padding: 14px 16px; }
.photo-info h4 { font-family: var(--font-serif); font-size: 14px; font-weight: 600; color: var(--white); margin-bottom: 5px; line-height: 1.3; }
.photo-meta { display: flex; align-items: center; gap: 12px; font-size: 11px; color: var(--text-muted); }
.photo-meta i { font-size: 10px; color: var(--emas); }

/* List view */
.galeri-grid.view-list .photo-card { display: grid; grid-template-columns: 140px 1fr; break-inside: auto; }
.galeri-grid.view-list .photo-thumb { min-height: 100px; }
.galeri-grid.view-list .photo-placeholder { aspect-ratio: auto; height: 100%; }
.galeri-grid.view-list .photo-thumb-img { height: 100%; }

/* No results */
.no-results { text-align: center; padding: 80px 20px; display: none; }
.no-results.show { display: block; }
.no-results i { font-size: 48px; color: var(--text-muted); margin-bottom: 16px; display: block; }
.no-results p { color: var(--text-muted); font-size: 15px; }

/* ---- LIGHTBOX ---- */
.lightbox {
    position: fixed; inset: 0; z-index: 2000;
    background: rgba(5, 10, 7, 0.97);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none;
    transition: opacity 0.3s ease;
}
.lightbox.open { opacity: 1; pointer-events: all; }
.lb-backdrop { position: absolute; inset: 0; cursor: zoom-out; }
.lb-content { position: relative; z-index: 1; max-width: 90vw; max-height: 90vh; display: flex; flex-direction: column; align-items: center; }
.lb-img-wrap { border-radius: var(--radius); overflow: hidden; max-height: 75vh; max-width: 85vw; box-shadow: 0 24px 80px rgba(0,0,0,0.6); }
.lb-img { display: block; max-width: 100%; max-height: 75vh; object-fit: contain; }
.lb-placeholder { width: min(700px, 85vw); height: min(480px, 70vh); border-radius: var(--radius); }
.lb-info { margin-top: 20px; text-align: center; padding: 0 20px; }
.lb-info h3 { font-family: var(--font-serif); font-size: 20px; font-weight: 700; color: var(--white); margin-bottom: 6px; }
.lb-info p { font-size: 13px; color: var(--text-muted); }
.lb-controls { position: absolute; top: 50%; transform: translateY(-50%); width: calc(85vw + 80px); left: 50%; margin-left: calc(-42.5vw - 40px); display: flex; justify-content: space-between; pointer-events: none; }
.lb-arrow { width: 48px; height: 48px; background: rgba(200,160,32,0.15); border: 1px solid rgba(200,160,32,0.3); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 18px; color: var(--emas); cursor: pointer; transition: var(--transition); pointer-events: all; }
.lb-arrow:hover { background: var(--emas); color: #000; }
.lb-close { position: absolute; top: -48px; right: 0; width: 40px; height: 40px; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 16px; color: #fff; cursor: pointer; transition: var(--transition); }
.lb-close:hover { background: rgba(255,255,255,0.18); }
.lb-counter { position: absolute; top: -44px; left: 0; font-size: 13px; color: var(--text-muted); }

/* ---- UPLOAD PREVIEW ---- */
.preview-section { background: var(--bg-2); border-top: 1px solid var(--border); padding: 28px 0; display: none; }
.preview-section.visible { display: block; }
.preview-inner { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.preview-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.preview-header h3 { font-family: var(--font-serif); font-size: 18px; font-weight: 700; color: var(--white); }
.btn-confirm { display: inline-flex; align-items: center; gap: 8px; background: linear-gradient(135deg, var(--hijau-gelap), var(--hijau)); color: #fff; font-family: var(--font-body); font-size: 13px; font-weight: 500; padding: 9px 20px; border-radius: 50px; border: none; cursor: pointer; transition: var(--transition); }
.btn-confirm:hover { background: var(--hijau-terang); }
.preview-grid { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.preview-item { flex-shrink: 0; width: 120px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; position: relative; }
.preview-item img { width: 100%; height: 80px; object-fit: cover; display: block; }
.preview-item-remove { position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; background: rgba(0,0,0,0.7); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 10px; color: #fff; cursor: pointer; border: none; transition: var(--transition); }
.preview-item-remove:hover { background: #c0392b; }
.preview-name { font-size: 10px; color: var(--text-muted); padding: 6px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- PAGINATION ---- */
.pagination { display: flex; justify-content: center; gap: 8px; padding: 40px 0; }
.page-btn { width: 40px; height: 40px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 14px; color: var(--text-muted); cursor: pointer; transition: var(--transition); }
.page-btn:hover, .page-btn.active { border-color: var(--emas); color: var(--emas); }
.page-btn.active { background: var(--emas-muda); }

/* ---- FOOTER MINI ---- */
.footer-mini { background: var(--bg-2); border-top: 1px solid var(--border); padding: 24px; text-align: center; font-size: 12px; color: var(--text-muted); }
.footer-mini a { color: var(--emas); }

/* ---- TOAST ---- */
.toast { position: fixed; bottom: 32px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--bg-card); border: 1px solid var(--emas); border-radius: var(--radius-sm); padding: 12px 24px; font-size: 14px; color: var(--white); display: flex; align-items: center; gap: 10px; z-index: 3000; opacity: 0; transition: opacity 0.3s, transform 0.3s; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast i { color: var(--hijau-terang); }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
    .galeri-grid { columns: 2 160px; }
    .upload-inner { flex-direction: column; }
    .upload-meta { min-width: 100%; }
    .lb-controls { display: none; }
    .hero-stats { gap: 16px; }
}
@media (max-width: 480px) {
    .galeri-grid { columns: 1; }
    .filter-inner { gap: 10px; }
    .view-toggle { display: none; }
}