/* =================================================================
 * Main Stylesheet - VERSI 23.1 (Desain Modern, Slider Disesuaikan)
 * File: /assets/css/style.css
 * Deskripsi: Mengatur semua gaya visual, termasuk penyesuaian
 * ukuran item buku di dalam slider agar lebih kecil dan ringkas.
 * ================================================================= */

/* --- 1. Variabel Warna & Tema --- */
:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --gradient-start: #4e54c8;
    --gradient-end: #8f94fb;
    --bg-color: #f8f9fa;
    --text-color: #212529;
    --card-bg: #ffffff;
    --card-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    --header-bg: #ffffff;
    --footer-bg: #343a40;
    --footer-text: #f8f9fa;
}

body.dark-mode {
    --bg-color: #121212;
    --text-color: #e0e0e0;
    --card-bg: #1e1e1e;
    --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    --header-bg: #1e1e1e;
    --footer-bg: #000000;
    --footer-text: #e0e0e0;
}

/* --- 2. Gaya Dasar & Tipografi --- */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
}

.container {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 20px;
}

h1, h2, h3 {
    line-height: 1.2;
}

h2 {
    font-size: 2.2rem;
    text-align: center;
    margin-bottom: 40px;
    position: relative;
    padding-bottom: 15px;
}

h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background-image: linear-gradient(to right, var(--gradient-start), var(--gradient-end));
    border-radius: 2px;
}

a {
    color: var(--primary-color);
    text-decoration: none;
}

/* --- 3. Animasi Global --- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.content-section {
    padding: 60px 0;
    animation: fadeInUp 0.8s ease-out forwards;
    opacity: 0;
}

/* --- 4. Header & Hero Section --- */
.main-header {
    background-color: var(--header-bg);
    padding: 20px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: background-color 0.3s;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo a {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-color);
    transition: color 0.3s;
}

.hero {
    color: white;
    padding: 100px 20px;
    text-align: center;
    background-image: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    animation: fadeInUp 0.6s ease-out;
}

.hero h1 { font-size: 3rem; margin-bottom: 10px; }
.hero p { font-size: 1.2rem; opacity: 0.9; }

.search-bar form {
    display: flex;
    max-width: 600px;
    margin: 30px auto 0 auto;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.1);
    border-radius: 50px;
    overflow: hidden;
}

.search-bar input[type="text"] { flex: 1; border: none; padding: 15px 25px; font-size: 16px; }
.search-bar button { padding: 15px 30px; border: none; background-color: var(--success-color); color: white; cursor: pointer; font-size: 16px; font-weight: bold; }

/* --- 5. Slider Buku (Swiper.js) --- */
.book-slider-container {
    padding: 20px 0;
}
.swiper-container {
    width: 100%;
    padding-top: 20px;
    padding-bottom: 50px; /* Ruang untuk navigasi */
}

/* PERUBAHAN: Lebar setiap buku diperkecil */
.swiper-slide {
    width: 130px; /* Dari 180px menjadi 130px */
    height: auto;
}
.swiper-slide .book-item {
    width: 100%;
    height: 100%;
    background: var(--card-bg);
    border-radius: 8px; /* Sedikit lebih kecil */
    overflow: hidden;
    box-shadow: var(--card-shadow);
    transition: transform 0.3s, box-shadow 0.3s;
}
.swiper-slide .book-item:hover {
    transform: translateY(-8px) rotate(3deg);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

/* PERUBAHAN: Tinggi gambar disesuaikan */
.book-item img {
    width: 100%;
    height: 180px; /* Dari 230px menjadi 180px */
    object-fit: cover;
}
.book-item p {
    margin: 0;
    padding: 12px 10px; /* Padding disesuaikan */
    font-size: 0.8em; /* Font diperkecil */
    font-weight: 500;
    text-align: center;
    color: var(--text-color);
    /* Mencegah teks panjang merusak layout */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* Navigasi panah slider */
.swiper-button-next, .swiper-button-prev {
    color: var(--primary-color);
}
body.dark-mode .swiper-button-next, body.dark-mode .swiper-button-prev {
    color: var(--gradient-end);
}

/* --- 6. Pratinjau Galeri --- */
.gallery-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}
.gallery-item-preview {
    position: relative;
    overflow: hidden;
    border-radius: 10px;
    box-shadow: var(--card-shadow);
    height: 250px;
    display: block;
}
.gallery-item-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}
.gallery-item-preview:hover img {
    transform: scale(1.1);
}
.gallery-item-preview .overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    color: white;
    padding: 30px 15px 15px 15px;
    text-align: center;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s, transform 0.4s;
}
.gallery-item-preview:hover .overlay {
    opacity: 1;
    transform: translateY(0);
}
.gallery-item-preview .overlay p {
    margin: 0;
    font-weight: bold;
}
.view-all-link {
    display: block;
    text-align: center;
    margin-top: 40px;
    padding: 12px 25px;
    background-image: linear-gradient(to right, var(--gradient-start), var(--gradient-end));
    color: white;
    border-radius: 50px;
    font-weight: bold;
    max-width: 200px;
    margin-left: auto;
    margin-right: auto;
    transition: transform 0.2s;
}
.view-all-link:hover {
    transform: scale(1.05);
}

/* --- 7. Daftar Berita --- */
.news-list {
    list-style: none;
    padding: 0;
    max-width: 800px;
    margin: 0 auto;
}
.news-list li {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 15px;
    box-shadow: var(--card-shadow);
    transition: transform 0.3s, box-shadow 0.3s;
}
.news-list li:hover {
    transform: translateX(5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}
.news-list a {
    font-weight: bold;
    font-size: 1.1em;
}

/* --- 8. Footer --- */
.main-footer {
    background-color: var(--footer-bg);
    color: var(--footer-text);
    padding: 40px 0;
    margin-top: 60px;
    text-align: center;
    transition: background-color 0.3s;
}
.footer-menu ul {
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
}
.footer-menu a {
    color: var(--footer-text);
    opacity: 0.8;
    transition: opacity 0.2s;
}
.footer-menu a:hover {
    opacity: 1;
}

/* --- 9. Tombol Mode Gelap/Terang --- */
.theme-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background-color: var(--card-bg);
    color: var(--text-color);
    box-shadow: var(--card-shadow);
    cursor: pointer;
    font-size: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1001;
    transition: background-color 0.3s, color 0.3s, transform 0.2s;
}
.theme-toggle:hover {
    transform: scale(1.1);
}

/* --- 10. Desain Responsif --- */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2.2em;
    }
    .hero p {
        font-size: 1em;
    }
    h2 {
        font-size: 1.8em;
    }
    .header-content {
        flex-direction: column;
        gap: 10px;
    }
    .content-section {
        padding: 40px 0;
    }
}
/* Media query baru untuk layar HP yang sangat kecil */
@media (max-width: 480px) {
    .swiper-slide {
        width: 110px; /* Lebih kecil lagi di HP */
    }
    .book-item img {
        height: 150px;
    }
}