/* Reset dasar & Font */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    background-color: #f0f2f5; /* Warna latar sedikit berbeda */
    color: #333;
    overscroll-behavior-y: contain; /* Mencegah scroll body saat lightbox terbuka */
}

/* Header */
header {
    background: linear-gradient(to right, #6a11cb, #2575fc); /* Gradasi biru-ungu */
    color: #fff;
    /* padding: 1.5rem 1rem; */
    text-align: center;
    margin-bottom: 25px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
}
header h1 { font-size: 2.2rem; font-weight: 400; }

/* Main Content */
main { max-width: 1200px; margin: 0 auto; padding: 0 15px; }

/* Gallery Container */
.gallery-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 18px;
    padding-bottom: 25px;
}

/* Gallery Item (Placeholder dan Gambar) */
.gallery-item {
    background-color: #e0e0e0; /* Warna placeholder */
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    aspect-ratio: 1 / 1;
    cursor: pointer; /* Menunjukkan bisa diklik */
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative; /* Untuk potensi overlay */
}
.gallery-item:hover {
    transform: translateY(-6px) scale(1.04);
    box-shadow: 0 7px 18px rgba(0,0,0,0.2);
}
.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0; /* Awalnya transparan untuk lazy load */
    transition: opacity 0.6s ease-in-out;
    /* Mencegah drag gambar (tidak selalu efektif) */
    -webkit-user-drag: none;
    user-drag: none;
}
.gallery-item img.loaded { opacity: 1; }

/* Pesan jika tidak ada gambar */
.no-images-message {
    text-align: center;
    font-size: 1.2em;
    color: #777;
    margin-top: 50px;
}

/* Lightbox Styles */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85); /* Overlay lebih gelap */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px; /* Memberi ruang jika gambar sangat besar */
    backdrop-filter: blur(5px); /* Efek blur di belakang (jika didukung) */
}
.lightbox-content {
    position: relative;
    background-color: #1c1c1c; /* Kontras dengan overlay */
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    max-width: 90vw;
    max-height: 90vh;
    display: flex; /* Untuk alignment gambar */
    align-items: center;
    justify-content: center;
}
.lightbox-content img {
    display: block;
    max-width: 100%;
    max-height: calc(90vh - 30px); /* Sesuaikan dengan padding konten */
    object-fit: contain; /* Pastikan seluruh gambar terlihat */
    border-radius: 4px;
     /* Mencegah seleksi teks pada gambar */
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
     /* Mencegah drag */
    -webkit-user-drag: none;
    user-drag: none;
}
.lightbox-close {
    position: absolute;
    top: -15px; /* Posisikan sedikit di luar kotak konten */
    right: -15px;
    background: #fff;
    color: #333;
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    font-size: 24px;
    font-weight: bold;
    line-height: 33px; /* Vertically center X */
    text-align: center;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    transition: background-color 0.2s, color 0.2s;
}
.lightbox-close:hover {
    background-color: #ff4d4d; /* Merah saat hover */
    color: #fff;
}

/* Lapisan Anti-Download (opsional, bisa mengganggu) */
.lightbox-anti-download-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1001;
    background-color: transparent;
}

/* Footer */
footer {
    text-align: center;
    padding: 1.5rem 1rem;
    background-color: #343a40; /* Footer gelap */
    color: #f8f9fa;
    margin-top: 30px;
}


/* Responsif */
@media (max-width: 768px) {
    header h1 { font-size: 1.8rem; }
    .gallery-container { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
    .lightbox-content { padding: 10px; }
    .lightbox-content img { max-height: calc(90vh - 20px); }
    .lightbox-close { width: 30px; height: 30px; font-size: 20px; line-height: 28px; top: -10px; right: -10px; }
}
@media (max-width: 480px) {
    header h1 { font-size: 1.6rem; }
    .gallery-container { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
}

.loading-indicator {
    text-align: center;
    padding: 20px;
    font-style: italic;
    color: #777;
    /* display: none; // Awalnya disembunyikan oleh JS atau HTML jika perlu */
    /* Beberapa browser mungkin menampilkan 'block' secara default, jadi kontrol via JS lebih baik */
    min-height: 40px; /* Beri ruang agar observer bisa bekerja */
}

/* Gaya tambahan jika diperlukan untuk item galeri saat loading */
.gallery-item img:not(.loaded) {
    /* background-color: #eee; // Placeholder color jika src belum di-set */
}

/* server.ts -> <style> block atau static/style.css */
.load-more-container {
    text-align: center;
    padding: 20px 0;
}
#load-more-btn {
    padding: 10px 20px;
    font-size: 1em;
    cursor: pointer;
    background-color: #007bff; /* Warna primer Bootstrap */
    color: white;
    border: none;
    border-radius: 5px;
    transition: background-color 0.2s ease-in-out, opacity 0.2s ease-in-out;
}
#load-more-btn:hover:not(:disabled) {
    background-color: #0056b3; /* Warna lebih gelap saat hover */
}
#load-more-btn:disabled {
    background-color: #cccccc;
    color: #666666;
    cursor: not-allowed;
}
#load-more-btn.hidden {
    display: none; /* Atau opacity: 0; pointer-events: none; untuk transisi */
}
