/* assets/css/style.css */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&family=Lora:ital,wght@0,500;1,500&family=Playfair+Display:ital,wght@0,600;0,700;1,600;1,700&display=swap');

:root {
    /* Colors */
    --c-primary: #5C3D2E;
    --c-secondary: #D4A853;
    --c-bg: #FAF6F0;
    --c-surface: #F0E9DF;
    --c-text-primary: #2B1F1A;
    --c-text-secondary: #7A6E66;
    --c-accent: #2E7D52;
    --c-danger: #A03030;
    --c-white: #FFFFFF;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;

    /* Typography */
    --font-heading: 'Playfair Display', serif;
    --font-subheading: 'Lora', serif;
    --font-body: 'Inter', sans-serif;

    /* Layout */
    --max-width: 1200px;
    --radius-md: 8px;
    --radius-lg: 12px;

    /* Shadows */
    --shadow-soft: 0 2px 12px rgba(92, 61, 46, 0.08);
    --shadow-hover: 0 8px 30px rgba(92, 61, 46, 0.15);
}

/* Base Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    color: var(--c-text-primary);
    background-color: var(--c-bg);
    line-height: 1.7;
    font-size: 15px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
    scroll-behavior: smooth;
    overflow-x: hidden;
}

/* Typography */
h1,
h2,
h3 {
    font-family: var(--font-heading);
    line-height: 1.2;
}

h1 {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: var(--space-md);
}

h2 {
    font-size: 36px;
    font-weight: 700;
    line-height: 1.3;
}

h3 {
    font-size: 20px;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: var(--space-xs);
}

h4,
h5,
h6,
.nav-link {
    font-family: var(--font-subheading);
}

a {
    color: inherit;
    text-decoration: none;
    transition: all 0.2s ease;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Layout Utilities */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--space-md);
    width: 100%;
}

main {
    flex: 1;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 14px;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    line-height: 1;
    cursor: pointer;
    border: none;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    min-height: 44px;
    min-width: 44px;
}

.btn-primary {
    background: var(--c-primary);
    color: var(--c-white);
}

.btn-primary:hover {
    background: #4a3125;
}

.btn-wa {
    background: var(--c-accent);
    color: var(--c-white);
    animation: pulse-glow 3s infinite alternate;
}

.btn-wa:hover {
    background: #256B45;
    transform: scale(1.02);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--c-primary);
    color: var(--c-primary);
}

.btn-outline:hover {
    background: var(--c-primary);
    color: var(--c-white);
}

.btn-danger {
    background: var(--c-danger);
    color: var(--c-white);
}

.btn-danger:hover {
    background: #802727;
}

@keyframes pulse-glow {
    0% {
        box-shadow: 0 0 0 0 rgba(46, 125, 82, 0.4);
    }

    100% {
        box-shadow: 0 0 0 8px rgba(46, 125, 82, 0);
    }
}

/* ============================================================
 * SITE HEADER - CONSISTENCY RULE
 * This header MUST visually match .admin-header in admin.css.
 * Key values to keep in sync:
 *   background : rgba(74, 49, 37, 0.9)   (warm brown)
 *   blur       : 15px
 *   height     : 70px  (via .navbar)
 *   z-index    : 1000
 *   position   : fixed
 * If you change any of these, update admin.css to match!
 * ============================================================ */
.site-header {
    background: rgba(74, 49, 37, 0.9);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    color: var(--c-white);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1000;
    transition: box-shadow 0.3s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

main {
    padding-top: 70px;
}

.site-header.scrolled {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.navbar-brand {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 700;
    color: var(--c-white);
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.navbar-brand svg {
    color: var(--c-secondary);
}

.nav-links-desktop {
    display: flex;
    gap: var(--space-lg);
    list-style: none;
}

@media (max-width: 768px) {
    .desktop-only {
        display: none;
    }
}

.nav-links {
    display: none;
    /* Hide mobile menu by default on desktop */
    list-style: none;
}

.nav-link {
    color: var(--c-surface);
    font-size: 15px;
    font-weight: 500;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    transition: background 0.2s, color 0.2s;
    display: block;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--c-white);
}

/* Mobile Menu */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--c-white);
    cursor: pointer;
    padding: var(--space-sm);
}

/* Book Card */
.book-card {
    background: var(--c-surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: flex;
    flex-direction: column;
    height: 100%;
    opacity: 0;
    /* For scroll reveal */
    transform: translateY(20px);
}

.book-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.book-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.book-cover {
    position: relative;
    aspect-ratio: 2/3;
    overflow: hidden;
    background: var(--c-bg);
    /* placeholder loading color */
}

.book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: filter 0.3s, transform 0.5s ease;
}

.book-card:hover .book-cover img {
    transform: scale(1.05);
    /* very subtle zoom */
}

.book-cover::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30%;
    background: linear-gradient(to top, rgba(43, 31, 26, 0.3) 0%, transparent 100%);
    pointer-events: none;
}

.book-badges {
    position: absolute;
    top: var(--space-sm);
    left: var(--space-sm);
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    z-index: 2;
}

.badge {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.badge-promo {
    background: var(--c-danger);
    color: var(--c-white);
}

.badge-bestseller {
    background: var(--c-secondary);
    color: var(--c-text-primary);
}

.badge-baru {
    background: var(--c-primary);
    color: var(--c-white);
}

.book-info {
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    flex: 1;
}

.book-price-row {
    margin-top: auto;
    padding-top: var(--space-md);
    display: flex;
    align-items: flex-end;
    gap: var(--space-sm);
}

.price-current {
    font-family: var(--font-body);
    font-size: 18px;
    font-weight: 700;
    color: var(--c-primary);
}

.price-original {
    font-size: 13px;
    color: var(--c-text-secondary);
    text-decoration: line-through;
}

/* Sections & Typography */
.section {
    padding: var(--space-xl) 0;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-xl);
}

.divider {
    text-align: center;
    color: var(--c-secondary);
    font-size: 24px;
    letter-spacing: 8px;
    margin: var(--space-xl) 0;
    opacity: 0.7;
}

/* Footer */
.site-footer {
    background: var(--c-primary);
    color: var(--c-surface);
    padding: var(--space-2xl) 0 var(--space-md);
    margin-top: auto;
    border-top: 3px solid var(--c-secondary);
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--space-2xl);
    margin-bottom: var(--space-2xl);
}

.footer-text {
    color: #d4c8c2;
}

.footer-links a {
    color: var(--c-surface);
    display: block;
    margin-bottom: 8px;
}

.footer-links a:hover {
    color: var(--c-secondary);
}

/* Responsive Grid */
.book-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-lg);
}

@media (max-width: 1024px) {
    .book-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    h1 {
        font-size: 40px;
    }

    h2 {
        font-size: 32px;
    }
}

@media (max-width: 768px) {
    .book-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }

    .menu-toggle {
        display: block;
    }

    .nav-links {
        display: flex;
        /* Aktifkan flex saat di mobile */
        position: fixed;
        top: 0;
        /* Mulai dari atas agar seamless */
        right: -100%;
        width: 280px;
        height: 100vh;
        background: rgba(74, 49, 37, 0.8);
        /* Dibuat lebih transparan agar efek blur lebih terasa */
        backdrop-filter: blur(25px);
        -webkit-backdrop-filter: blur(25px);
        flex-direction: column;
        padding: 90px var(--space-xl) var(--space-xl);
        /* Offset agar menu di bawah header */
        transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.3);
        z-index: 999;
        /* Di bawah header (1000) agar logo dan tombol X tetap di atas */
        gap: var(--space-md);
        border-left: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 0;
        /* Hindari rounding yang menyebabkan gap */
    }

    .nav-links.active {
        right: 0;
    }

    .nav-link {
        font-size: 16px;
        width: 100%;
        text-align: left;
    }
}

@media (max-width: 480px) {
    .book-grid {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 32px;
    }

    h2 {
        font-size: 26px;
    }
}

/* UI Enhancements */
.site-logo-img {
    max-height: 28px;
    width: auto;
    object-fit: contain;
}

@media (max-width: 768px) {
    .site-logo-img {
        max-height: 24px;
    }

    .site-title-text {
        display: none;
    }
}

.stock-status {
    margin-bottom: var(--space-lg);
    padding: var(--space-md);
    background: var(--c-surface);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--c-secondary);
}

/* Carousel */
.carousel-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    aspect-ratio: 16/9;
    background: var(--c-bg);
}

.carousel-track {
    display: flex;
    transition: transform 0.5s ease-in-out;
    height: 100%;
}

.carousel-slide {
    min-width: 100%;
    position: relative;
}

.carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.carousel-caption {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    padding: var(--space-md) var(--space-xl);
    background: rgba(0, 0, 0, 0.6);
    border-radius: var(--radius-md);
    color: var(--c-white);
    font-size: clamp(18px, 4vw, 32px);
    font-weight: 700;
    width: 80%;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.8);
    color: var(--c-primary);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.2s;
    z-index: 10;
}

.carousel-btn:hover {
    background: var(--c-white);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.prev-btn {
    left: var(--space-md);
}

.next-btn {
    right: var(--space-md);
}

.carousel-dots {
    position: absolute;
    bottom: var(--space-md);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
}

.carousel-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    border: none;
    cursor: pointer;
    transition: background 0.3s;
}

.carousel-dot.active {
    background: var(--c-white);
    transform: scale(1.2);
}

@media (min-width: 1024px) {
    .carousel-container {
        aspect-ratio: 21/9;
    }
}

/* Katalog filters — stack vertically on tablet and below */
@media (max-width: 768px) {
    .katalog-toolbar {
        flex-direction: column !important;
    }

    .katalog-toolbar form {
        flex-direction: column !important;
    }

    .katalog-toolbar .search-box {
        min-width: 100% !important;
    }

    .katalog-toolbar .filter-row {
        flex-direction: column !important;
        width: 100%;
    }

    .katalog-toolbar .filter-row>div {
        width: 100%;
    }

    .katalog-toolbar select {
        width: 100%;
    }
}

/* Category Filter Pills */
.category-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.category-pill {
    display: inline-flex;
    align-items: center;
    background: var(--c-surface);
    color: var(--c-text-secondary);
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    user-select: none;
}

.category-pill:hover {
    background: #e8ded1;
    color: var(--c-text-primary);
}

.category-pill.active {
    background: var(--c-primary);
    color: var(--c-white);
    border-color: var(--c-primary);
    box-shadow: 0 4px 10px rgba(92, 61, 46, 0.2);
}