/* --- 1. VARIABEL WARNA & FONTS --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&family=Playfair+Display:wght@700&display=swap');

:root {
    --primary-color: #5e493e;    /* Cokelat Tua khas Bustanussalatin */
    --accent-color: #a68b7c;     /* Cokelat Muda */
    --text-dark: #2c2c2c;        /* Teks Utama */
    --text-muted: #666666;       /* Teks sekunder/deskripsi */
    --bg-light: #ffffff;         /* Background utama */
    --bg-soft: #fcfaf8;          /* Background krem lembut */
    --white: #ffffff;
    --danger: #e74c3c;           /* Merah untuk tombol hapus/logout */
    --success: #27ae60;          /* Hijau untuk tombol simpan/edit */
    --shadow: 0 10px 30px rgba(0,0,0,0.05);
}

/* --- 2. RESET & DASAR --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    color: var(--text-dark);
    line-height: 1.6;
    background: var(--bg-light);
}

h1, h2, h3 {
    font-family: 'Playfair Display', serif;
    color: var(--primary-color);
}

a {
    text-decoration: none;
    transition: 0.3s ease;
}

/* --- 3. KOMPONEN NAVIGASI (UNIVERSAL) --- */
nav {
    background: rgba(255, 255, 255, 0.98);
    padding: 15px 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.logo {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: 1px;
}

.nav-links {
    display: flex;
    gap: 25px;
    align-items: center;
}

.nav-links a {
    color: var(--text-dark);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
}

.nav-links a:hover {
    color: var(--accent-color);
}

/* --- 4. KOMPONEN HERO & UTAMA --- */
.hero {
    height: 60vh;
    background: linear-gradient(rgba(0,0,0,0.6), rgba(0,0,0,0.6)), 
                url('../images/background.jpg');
    background-size: cover;
    background-position: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: var(--white);
    padding: 0 20px;
}

.hero h1 { font-size: clamp(2.5rem, 5vw, 4rem); color: var(--white); margin-bottom: 15px; }
.hero p { font-size: 1.1rem; max-width: 600px; font-weight: 300; opacity: 0.9; }

.container {
    max-width: 1200px;
    margin: 60px auto;
    padding: 0 25px;
}

.section-title {
    text-align: center;
    margin-bottom: 50px;
}

/* --- 5. GRID KATALOG & CARD --- */
.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 40px;
}

.book-card {
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid #f0f0f0;
    transition: transform 0.4s ease;
}

.book-card:hover { transform: translateY(-10px); }

.book-img {
    width: 100%;
    height: 450px;
    object-fit: cover;
}

.book-info { padding: 30px; }
.book-info h3 { margin-bottom: 12px; min-height: 3.5rem; }

/* --- 6. FORM & TABEL ADMIN --- */
.admin-card {
    background: var(--white);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    border: 1px solid #f0f0f0;
    margin-top: 20px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th {
    background: var(--bg-soft);
    color: var(--primary-color);
    padding: 15px;
    text-align: left;
    border-bottom: 2px solid var(--accent-color);
    font-size: 0.85rem;
    text-transform: uppercase;
}

.admin-table td {
    padding: 15px;
    border-bottom: 1px solid #eee;
}

/* Form Styling */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 600; color: var(--primary-color); }
.form-control {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: 'Inter', sans-serif;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(94, 73, 62, 0.1);
}

/* --- 7. TOMBOL-TOMBOL --- */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-align: center;
}

.btn-primary { background: var(--primary-color); color: var(--white); }
.btn-primary:hover { background: var(--accent-color); }

.btn-danger { background: var(--danger); color: var(--white); }
.btn-success { background: var(--success); color: var(--white); }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }

/* --- 8. FOOTER --- */
footer {
    background: #232323;
    color: #b0b0b0;
    padding: 60px 5% 30px;
}

.footer-bottom {
    text-align: center;
    border-top: 1px solid #333;
    padding-top: 30px;
    margin-top: 40px;
    font-size: 0.8rem;
}

/* --- 9. RESPONSIVE --- */
@media (max-width: 768px) {
    .nav-links { display: none; }
    .book-img { height: 350px; }
}

/* --- 10. TOMBOL WHATSAPP UNIVERSAL --- */
.wa-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #25d366;
    color: white !important;
    padding: 12px 25px;
    border-radius: 50px; /* Membuat bulat lonjong elegan */
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 10px 20px rgba(37, 211, 102, 0.2);
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.wa-action-btn:hover {
    background-color: #1ebe57;
    transform: translateY(-3px);
    box-shadow: 0 15px 25px rgba(37, 211, 102, 0.3);
    color: white !important;
}

.wa-action-btn img {
    margin-right: 10px;
}

/* Ukuran kecil khusus untuk kartu di Index */
.wa-small {
    padding: 10px 18px;
    font-size: 0.85rem;
    width: 100%; /* Agar memenuhi lebar kartu */
    box-sizing: border-box;
}

/* ==========================================================================
   11. POPUP PROMO (MODAL LENGKAP)
   ========================================================================== */

/* Wadah utama yang menutupi seluruh layar */
.popup-overlay {
    display: none; /* Muncul lewat JavaScript */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85); /* Latar gelap */
    z-index: 99999; /* Pastikan di atas segalanya */
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px); /* Efek blur di belakang popup */
}

/* Kotak konten (transparan agar tidak ada kanvas putih) */
.popup-content {
    position: relative;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    background: transparent; 
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: visible; /* Penting agar tombol silang bisa muncul di luar */
    animation: popupZoomIn 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

/* Gambar iklan */
.popup-content img {
    width: 100%;
    height: auto;
    max-height: 85vh;
    object-fit: contain;
    display: block;
    border-radius: 8px; /* Sudut gambar sedikit halus */
    box-shadow: 0 25px 50px rgba(0,0,0,0.6); /* Shadow nempel ke gambar */
}

/* Tombol Tutup (Silang) */
.btn-close-popup {
    position: absolute;
    top: -15px; /* Sedikit di luar pojok atas gambar */
    right: -15px; /* Sedikit di luar pojok kanan gambar */
    background: #ffffff;
    color: #333333;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    font-size: 1.4rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100001;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: transform 0.2s ease;
}

.btn-close-popup:hover {
    transform: scale(1.1) rotate(90deg);
}

/* Animasi Masuk */
@keyframes popupZoomIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Penyesuaian untuk HP: Tombol masuk ke dalam agar tidak kepotong layar */
@media (max-width: 600px) {
    .btn-close-popup {
        top: 10px;
        right: 10px;
        width: 32px;
        height: 32px;
    }
}

/* ==========================================================================
   12. LOGIN PAGE OVERRIDE (Mencegah Bentrok dengan Katalog)
   ========================================================================== */

/* Membuat background login bersih dan kotak di tengah */
.login-page {
    background: var(--bg-soft);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

/* Memperbaiki kotak form login */
.login-page .admin-card {
    max-width: 400px;
    width: 100%;
    margin-top: 0;
    padding: 40px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
}

/* Merapikan judul di halaman login */
.login-page h2 {
    text-align: center;
    margin-bottom: 30px;
    font-size: 1.8rem;
    color: var(--primary-color);
}

/* Memastikan tombol login penuh */
.login-page .btn-primary {
    width: 100%;
    padding: 14px;
    margin-top: 10px;
}

/* Sembunyikan Navigasi jika terbawa ke login */
.login-page nav {
    display: none;
}