/* style.css - Apple Style Clean Design */
:root {
    --primary-color: #483D8B; /* DarkSlateBlue */
    --primary-hover: #372e6b;
    --bg-color: #f5f5f7; /* Apple Light Grey Background */
    --card-bg: #ffffff;
    --text-main: #000000; /* Apple Black */
    --text-sec: #86868b;  /* Apple Grey */
    --shadow-sm: 0 2px 5px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 15px rgba(0,0,0,0.08);
    --radius: 18px; /* Rounded corners khas modern UI */
    --nav-height: 60px;
}

/* --- TYPOGRAPHY & RESET --- */
* { box-sizing: border-box; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Apple Color Emoji", "SF Pro", "SF Pro Icons", "Helvetica Neue", Helvetica, Arial, sans-serif;
    margin: 0;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: normal;
    padding-top: var(--nav-height); /* Prevent content hidden behind sticky header */
}

a { text-decoration: none; color: inherit; transition: 0.3s; }
h1, h2, h3, h4, p { margin: 0; }

.container {
    width: 90%;
    max-width: 1100px; /* Sedikit lebih sempit agar fokus */
    margin: auto;
}

/* --- HEADER GLASSMORPHISM --- */
header {
    background-color: rgba(255, 255, 255, 0.8); /* Transparan */
    backdrop-filter: saturate(180%) blur(20px); /* Efek Blur Kaca */
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: var(--nav-height);
    display: flex;
    align-items: center;
}

.nav-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

/* Logo */
.logo-area { display: flex; align-items: center; gap: 12px; }
.site-logo { height: 32px; width: auto; }
.logo-text { font-size: 1.3rem; font-weight: 600; color: var(--text-main); letter-spacing: -0.5px; }

/* Navigation Desktop */
nav ul { display: flex; list-style: none; padding: 0; margin: 0; gap: 25px; }
nav ul li a { font-size: 0.85rem; color: var(--text-main); font-weight: 700; opacity: 0.8; }
nav ul li a:hover { opacity: 1; color: var(--primary-color); }

/* --- MAIN CONTENT --- */
main { padding: 40px 0; min-height: 80vh; }

.page-header {
    text-align: center;
    margin-bottom: 40px;
}
.section-title {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 10px;
    color: var(--text-main);
}

/* --- SEARCH BOX (Minimalist) --- */
.search-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}
.search-box {
    width: 100%;
    max-width: 500px;
    padding: 12px 20px;
    font-size: 1rem;
    border: none;
    background: #fff;
    border-radius: 50px; /* Pill shape */
    box-shadow: var(--shadow-sm);
    outline: none;
    transition: box-shadow 0.3s;
    text-align: center;
}
.search-box:focus { box-shadow: 0 0 0 4px rgba(72, 61, 139, 0.1); }

/* --- GRID BUKU (Responsive & Beautiful) --- */
.grid-buku {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); /* Otomatis menyesuaikan */
    gap: 25px;
}

.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0,0,0.5,1); /* Smooth easing */
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-md);
}

.thumb {
    height: 260px;
    background-color: #f0f0f0;
    overflow: hidden;
    position: relative;
}
.thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}
.card:hover .thumb img { transform: scale(1.05); }

.details {
    padding: 15px;
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.details h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Batasi 2 baris */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* --- PREVIEW PAGE --- */
.preview-container {
    background: white;
    padding: 30px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
}
iframe { width: 100%; height: 75vh; border: none; border-radius: 12px; background: #f9f9f9; }

/* --- BUTTONS --- */
.btn {
    display: inline-block;
    padding: 10px 24px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50px; /* Pill shape */
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
}
.btn:hover { background-color: var(--primary-hover); transform: translateY(-1px); }
.btn-back { background-color: #e5e5e7; color: var(--text-main); }
.btn-back:hover { background-color: #d1d1d6; }

/* --- FOOTER --- */
footer {
    background-color: white;
    border-top: 1px solid #e5e5e5;
    color: var(--text-sec);
    font-size: 0.8rem;
    padding: 30px 0;
    margin-top: 50px;
    text-align: center;
}
footer img.footer-logo { height: 30px; margin-bottom: 10px; }

/* --- HAMBURGER MENU (Mobile) --- */
.menu-toggle { display: none; flex-direction: column; cursor: pointer; gap: 5px; z-index: 1100; }
.bar { height: 2.5px; width: 22px; background-color: var(--text-main); border-radius: 10px; transition: 0.3s; }

/* --- ADMIN PANEL FORM --- */
.form-group input, .form-group textarea, .form-group select {
    width: 100%; padding: 12px;
    border: 1px solid #d2d2d7; border-radius: 10px;
    font-family: inherit; background: #fff;
}
.login-box { background: white; border-radius: 20px; box-shadow: var(--shadow-md); }

/* --- RESPONSIVE (MOBILE) --- */
@media (max-width: 768px) {
    .section-title { font-size: 1.5rem; }
    
    /* 1. PERBAIKAN HEADER & POSISI */
    header {
        padding: 0 20px; /* Menambahkan padding kiri-kanan agar tidak mepet layar */
    }
    header .container {
        width: 100%; /* Container header dibuat penuh di mobile */
        max-width: 100%;
        padding: 0; /* Reset padding container karena sudah ada di header */
    }

    /* Hamburger visible */
    .menu-toggle {
        display: flex;
        /* Memastikan posisi di kanan */
        margin-left: auto; 
    }

    /* Navigasi Fullscreen Overlay */
    nav ul {
        position: fixed;
        top: 0; left: 0; width: 100%; height: 100vh;
        background-color: var(--primary-hover);
        backdrop-filter: blur(10px);
        flex-direction: column;
        justify-content: inherit;
        align-items: center;
        gap: 20px;
        transform: translateY(-100%);
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 999;
        padding-top: 60px; /* Jarak agar tidak tertutup header sticky */
    }
    
    nav ul.active { transform: translateY(0); }

    nav ul li a {
        font-size: 1.5rem;
        font-weight: 600;
        color: var(--card-bg);
    }

    /* Layout Grid HP */
    .grid-buku { grid-template-columns: repeat(2, 1fr); gap: 15px; }
    .card { border-radius: 14px; }
    .thumb { height: 180px; }
    .details { padding: 10px; }
    .details h4 { font-size: 0.85rem; }
    
    /* Container Utama (Main Content) */
    main.container { width: 92%; }
    
    /* 2. PERBAIKAN ANIMASI X (Lebih Presisi) */
    /* Menggunakan translateY untuk menjaga titik pusat tetap di tengah */
    .menu-toggle.open .bar:nth-child(1) {
        transform: translateY(7.5px) rotate(45deg); 
    }
    .menu-toggle.open .bar:nth-child(2) {
        opacity: 0;
    }
    .menu-toggle.open .bar:nth-child(3) {
        transform: translateY(-7.5px) rotate(-45deg);
    }
    
    .page-header {font-size: 0.7rem;}
}

/* Layar Sangat Kecil (iPhone SE lama dsb) */
@media (max-width: 350px) {
    .grid-buku { grid-template-columns: 1fr; } /* 1 kolom */
}

/* --- UPDATE TOMBOL LOAD MORE --- */
.load-more {
    text-align: center; /* Wajib agar tombol ke tengah */
    margin: 40px 0;
    clear: both;
}

.btn-load {
    display: inline-block;
    background-color: var(--primary-color); /* Mengikuti warna tema */
    color: white;
    padding: 12px 35px;
    border-radius: 50px; /* Bentuk kapsul modern */
    font-weight: 600;
    font-size: 0.95rem;
    box-shadow: 0 4px 10px rgba(72, 61, 139, 0.3); /* Bayangan halus */
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
    border: none;
}

.btn-load:hover {
    transform: translateY(-3px); /* Efek naik saat disentuh */
    box-shadow: 0 6px 15px rgba(72, 61, 139, 0.4);
    background-color: var(--primary-hover);
}
/* --- LOGIN PAGE ADMIN --- */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh; /* Posisi tengah vertikal */
    background-color: var(--bg-color);
}

.login-card {
    background: white;
    padding: 40px;
    width: 100%;
    max-width: 380px;
    border-radius: 24px; /* Sudut lebih bulat */
    box-shadow: 0 20px 40px rgba(0,0,0,0.08); /* Bayangan lembut mengambang */
    text-align: center;
    border: 1px solid rgba(0,0,0,0.02);
}

.login-header { margin-bottom: 30px; }
.login-header h2 { font-size: 1.5rem; color: var(--primary-color); margin-bottom: 5px; }
.login-header p { color: var(--text-sec); font-size: 0.9rem; }

.login-card input {
    background: #f9f9f9;
    border: 1px solid #eee;
    transition: 0.3s;
    margin-bottom: 20px;
}
.login-card input:focus {
    background: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(72, 61, 139, 0.1);
}

.btn-login {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    margin-top: 10px;
    border-radius: 12px;
}

.back-link {
    display: block;
    margin-top: 20px;
    font-size: 0.85rem;
    color: var(--text-sec);
}
.back-link:hover { color: var(--primary-color); text-decoration: underline; }

/* --- BADGE KATEGORI --- */
.card {
    position: relative; /* Agar badge bisa diposisikan absolut di dalamnya */
}

.badge-cat {
    position: absolute;
    top: 12px;
    left: 12px;
    background-color: rgba(255, 255, 255, 0.95); /* Latar putih agak transparan */
    color: var(--primary-color);
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    z-index: 5; /* Di atas gambar */
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    backdrop-filter: blur(4px); /* Efek blur kaca */
    letter-spacing: 0.5px;
    pointer-events: none; /* Agar klik tetap tembus ke kartu */
}
.badge-cat {
  background: darkslateblue !important;
  color: white !important;
  font-weight: bold;
  text-align: center;
}