/* ═══════════════════════════════════════════════════
   PageTurn Books — Global Stylesheet
   Modern Library Aesthetic: Cream, Navy, Gold
   ═══════════════════════════════════════════════════ */

/* ── CSS Custom Properties ── */
:root {
    --cream: #FDF6EC;
    --cream-dark: #F5ECD9;
    --navy: #1B2A4A;
    --navy-light: #2C3E6B;
    --gold: #C8A951;
    --gold-light: #D4BC72;
    --white: #FFFFFF;
    --text-primary: #2C2C2C;
    --text-secondary: #6B6B6B;
    --text-light: #9A9A9A;
    --shadow-sm: 0 2px 8px rgba(27,42,74,0.06);
    --shadow-md: 0 4px 20px rgba(27,42,74,0.1);
    --shadow-lg: 0 8px 40px rgba(27,42,74,0.15);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 24px;
    --transition: 0.3s ease;
    --font-heading: 'Playfair Display', Georgia, serif;
    --font-body: 'Lora', 'Times New Roman', serif;
    --header-height: 72px;
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font-body);
    background: var(--cream);
    color: var(--text-primary);
    line-height: 1.7;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--navy); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--gold); }
img { max-width: 100%; height: auto; display: block; }
button { cursor: pointer; font-family: var(--font-body); border: none; background: none; }

/* ── Typography ── */
h1, h2, h3, h4 { font-family: var(--font-heading); font-weight: 700; line-height: 1.3; color: var(--navy); }
.section-title { font-size: 2.2rem; text-align: center; margin-bottom: 0.5rem; }
.section-subtitle { text-align: center; color: var(--text-secondary); font-size: 1.05rem; margin-bottom: 2rem; }
.text-accent { color: var(--gold); }

/* ── Buttons ── */
.btn {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.75rem 1.8rem; border-radius: var(--radius-lg);
    font-weight: 600; font-size: 0.95rem;
    transition: all var(--transition); letter-spacing: 0.02em;
}
.btn-primary {
    background: var(--navy); color: var(--white);
    box-shadow: 0 4px 15px rgba(27,42,74,0.25);
}
.btn-primary:hover { background: var(--navy-light); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(27,42,74,0.3); }
.btn-outline {
    border: 2px solid var(--navy); color: var(--navy); background: transparent;
}
.btn-outline:hover { background: var(--navy); color: var(--white); }

/* ═══════════ HEADER ═══════════ */
.site-header {
    position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
    height: var(--header-height);
    background: rgba(253,246,236,0.85);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    transition: all var(--transition);
}
.site-header.scrolled { background: rgba(253,246,236,0.95); box-shadow: var(--shadow-md); }
.header-container {
    max-width: 1200px; margin: 0 auto; padding: 0 1.5rem;
    height: 100%; display: flex; align-items: center; justify-content: space-between;
}
.logo { display: flex; align-items: center; gap: 0.5rem; font-family: var(--font-heading); font-size: 1.4rem; font-weight: 800; color: var(--navy); }
.logo-icon { font-size: 1.6rem; }
.logo-accent { color: var(--gold); }
.main-nav { display: flex; gap: 2rem; }
.nav-link {
    font-weight: 500; font-size: 0.95rem; color: var(--text-primary);
    position: relative; padding: 0.25rem 0;
}
.nav-link::after {
    content: ''; position: absolute; bottom: -2px; left: 0;
    width: 0; height: 2px; background: var(--gold); transition: width var(--transition);
}
.nav-link:hover::after, .nav-link.active::after { width: 100%; }
.nav-link.active { color: var(--navy); font-weight: 700; }

/* Cart Button */
.cart-button {
    position: relative; padding: 0.5rem; color: var(--navy);
    transition: color var(--transition);
}
.cart-button:hover { color: var(--gold); }
.cart-icon { width: 24px; height: 24px; }
.cart-badge {
    position: absolute; top: -2px; right: -6px;
    background: var(--gold); color: var(--white);
    font-size: 0.7rem; font-weight: 700;
    width: 20px; height: 20px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; transform: scale(0); transition: all var(--transition);
}
.cart-badge.has-items { opacity: 1; transform: scale(1); }
.cart-badge.pulse { animation: badgePulse 0.4s ease; }
@keyframes badgePulse { 0%,100%{ transform:scale(1); } 50%{ transform:scale(1.3); } }

/* Mobile Menu */
.mobile-menu-btn { display: none; flex-direction: column; gap: 5px; padding: 0.5rem; }
.mobile-menu-btn span { display: block; width: 24px; height: 2px; background: var(--navy); transition: all var(--transition); }
.mobile-menu-btn.active span:nth-child(1) { transform: rotate(45deg) translate(5px,5px); }
.mobile-menu-btn.active span:nth-child(2) { opacity: 0; }
.mobile-menu-btn.active span:nth-child(3) { transform: rotate(-45deg) translate(5px,-5px); }

/* ═══════════ CART SIDEBAR ═══════════ */
.cart-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.4);
    z-index: 2000; opacity: 0; pointer-events: none; transition: opacity var(--transition);
}
.cart-overlay.open { opacity: 1; pointer-events: auto; }
.cart-sidebar {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: 400px; max-width: 90vw; background: var(--white);
    z-index: 2001; transform: translateX(100%);
    transition: transform var(--transition);
    display: flex; flex-direction: column;
    box-shadow: -4px 0 30px rgba(0,0,0,0.1);
}
.cart-sidebar.open { transform: translateX(0); }
.cart-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1.5rem; border-bottom: 1px solid var(--cream-dark);
}
.cart-header h2 { font-size: 1.3rem; }
.cart-close { font-size: 2rem; color: var(--text-secondary); line-height: 1; padding: 0.25rem; }
.cart-close:hover { color: var(--navy); }
.cart-items { flex: 1; overflow-y: auto; padding: 1rem 1.5rem; }
.cart-empty { text-align: center; padding: 3rem 1rem; color: var(--text-secondary); }
.cart-empty-icon { font-size: 3rem; margin-bottom: 1rem; }
.cart-item {
    display: flex; gap: 1rem; padding: 1rem 0;
    border-bottom: 1px solid var(--cream-dark); position: relative;
}
.cart-item-img { width: 60px; height: 80px; object-fit: cover; border-radius: 4px; }
.cart-item-details { flex: 1; }
.cart-item-title { font-family: var(--font-heading); font-size: 0.9rem; margin-bottom: 0.15rem; }
.cart-item-author { font-size: 0.8rem; color: var(--text-secondary); }
.cart-item-price { font-weight: 700; color: var(--gold); font-size: 0.9rem; margin-top: 0.25rem; }
.cart-item-qty { display: flex; align-items: center; gap: 0.75rem; margin-top: 0.4rem; }
.qty-btn {
    width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--cream-dark);
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem; color: var(--navy); background: var(--cream);
}
.qty-btn:hover { background: var(--navy); color: var(--white); }
.cart-item-remove {
    position: absolute; top: 1rem; right: 0;
    font-size: 1.3rem; color: var(--text-light);
}
.cart-item-remove:hover { color: #c0392b; }
.cart-footer { padding: 1.5rem; border-top: 1px solid var(--cream-dark); }
.cart-total { display: flex; justify-content: space-between; font-size: 1.1rem; font-weight: 700; margin-bottom: 1rem; }
.cart-total-price { color: var(--gold); font-size: 1.3rem; }
.cart-checkout-btn { width: 100%; justify-content: center; }

/* Cart Toast */
.cart-toast {
    position: fixed; bottom: 2rem; right: 2rem;
    background: var(--navy); color: var(--white);
    padding: 0.8rem 1.5rem; border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg); z-index: 3000;
    transform: translateY(100px); opacity: 0;
    transition: all 0.3s cubic-bezier(0.34,1.56,0.64,1);
    font-size: 0.9rem;
}
.cart-toast.show { transform: translateY(0); opacity: 1; }
.toast-icon { color: var(--gold); margin-right: 0.3rem; }

/* ═══════════ HERO ═══════════ */
.hero {
    margin-top: var(--header-height);
    padding: 5rem 1.5rem 4rem;
    max-width: 1200px; margin-left: auto; margin-right: auto;
    display: flex; align-items: center; justify-content: space-between; gap: 3rem;
    min-height: 50vh;
}
.hero-content { max-width: 560px; }
.hero-title { font-size: 3rem; margin-bottom: 1rem; line-height: 1.15; }
.hero-subtitle { font-size: 1.1rem; color: var(--text-secondary); margin-bottom: 2rem; line-height: 1.8; }
.hero-cta { font-size: 1.05rem; padding: 0.9rem 2.2rem; }
.hero-decoration { position: relative; width: 260px; height: 300px; flex-shrink: 0; }
.hero-book {
    position: absolute; border-radius: 6px;
    box-shadow: var(--shadow-md);
}
.hb-1 { width: 140px; height: 200px; background: var(--navy); top: 50px; left: 60px; transform: rotate(-5deg); }
.hb-2 { width: 130px; height: 190px; background: var(--gold); top: 30px; left: 80px; transform: rotate(5deg); }
.hb-3 { width: 120px; height: 180px; background: var(--navy-light); top: 60px; left: 100px; transform: rotate(-2deg); opacity: 0.7; }

/* ═══════════ SHOP SECTION ═══════════ */
.shop-section {
    max-width: 1200px; margin: 0 auto; padding: 3rem 1.5rem 5rem;
}
.shop-header { margin-bottom: 1rem; }

/* Filter Bar */
.filter-bar {
    display: flex; flex-wrap: wrap; gap: 0.6rem;
    justify-content: center; margin-bottom: 2.5rem;
}
.filter-btn {
    padding: 0.55rem 1.4rem; border-radius: var(--radius-lg);
    font-size: 0.9rem; font-weight: 500; color: var(--text-primary);
    background: var(--white); border: 1.5px solid var(--cream-dark);
    transition: all var(--transition);
}
.filter-btn:hover { border-color: var(--gold); color: var(--gold); }
.filter-btn.active {
    background: var(--navy); color: var(--white); border-color: var(--navy);
}

/* Book Grid */
.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.8rem;
}

/* Book Card */
.book-card {
    background: var(--white); border-radius: var(--radius-md);
    overflow: hidden; box-shadow: var(--shadow-sm);
    transition: all var(--transition);
    animation: fadeInUp 0.5s ease both;
    display: flex; flex-direction: column;
}
.book-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
@keyframes fadeInUp { from { opacity:0; transform:translateY(20px); } to { opacity:1; transform:translateY(0); } }
.book-card-image {
    position: relative; height: 220px; overflow: hidden; background: var(--cream-dark);
    display: flex; align-items: center; justify-content: center;
}
.book-card-image img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform var(--transition);
}
.book-card:hover .book-card-image img { transform: scale(1.05); }
.book-category-tag {
    position: absolute; top: 0.75rem; left: 0.75rem;
    background: var(--navy); color: var(--white);
    padding: 0.25rem 0.75rem; border-radius: var(--radius-lg);
    font-size: 0.72rem; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase;
}
.book-card-body { padding: 1.2rem; flex: 1; display: flex; flex-direction: column; }
.book-title { font-size: 1.05rem; margin-bottom: 0.2rem; font-family: var(--font-heading); }
.book-author { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 0.5rem; }
.book-description {
    font-size: 0.82rem; color: var(--text-secondary); line-height: 1.5;
    flex: 1; margin-bottom: 0.8rem;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.book-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: auto; }
.book-price { font-size: 1.2rem; font-weight: 700; color: var(--gold); font-family: var(--font-heading); }
.btn-add-cart {
    padding: 0.5rem 1rem; border-radius: var(--radius-lg);
    background: var(--navy); color: var(--white);
    font-size: 0.8rem; font-weight: 600;
    transition: all var(--transition);
}
.btn-add-cart:hover { background: var(--gold); transform: scale(1.05); }
.btn-icon { margin-right: 0.15rem; }

/* Loading & Empty */
.loading-spinner { grid-column: 1 / -1; text-align: center; padding: 3rem; color: var(--text-secondary); }
.spinner {
    width: 40px; height: 40px; border: 3px solid var(--cream-dark);
    border-top-color: var(--gold); border-radius: 50%;
    animation: spin 0.8s linear infinite; margin: 0 auto 1rem;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty-msg, .error-msg { grid-column: 1/-1; text-align: center; padding: 3rem; color: var(--text-secondary); font-size: 1.1rem; }

/* ═══════════ ABOUT PAGE ═══════════ */
.about-hero {
    margin-top: var(--header-height); padding: 5rem 1.5rem 3rem;
    text-align: center; background: linear-gradient(180deg, var(--cream-dark) 0%, var(--cream) 100%);
}
.about-lead { max-width: 600px; margin: 1rem auto 0; font-size: 1.15rem; color: var(--text-secondary); line-height: 1.8; }
.about-section { max-width: 1100px; margin: 0 auto; padding: 3rem 1.5rem; }
.about-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px,1fr)); gap: 2rem; }
.about-card {
    background: var(--white); padding: 2.5rem 2rem; border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm); text-align: center;
    transition: all var(--transition);
}
.about-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.about-card-icon { font-size: 2.5rem; margin-bottom: 1rem; }
.about-card h2 { font-size: 1.3rem; margin-bottom: 0.75rem; }
.about-card p { color: var(--text-secondary); font-size: 0.95rem; line-height: 1.7; }
.about-values { text-align: center; padding-bottom: 4rem; }
.values-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(220px,1fr)); gap: 2rem; margin-top: 2rem; }
.value-item { padding: 1.5rem; }
.value-number { font-family: var(--font-heading); font-size: 2rem; color: var(--gold); font-weight: 800; margin-bottom: 0.5rem; }
.value-item h3 { font-size: 1.1rem; margin-bottom: 0.5rem; }
.value-item p { font-size: 0.9rem; color: var(--text-secondary); }
.about-cta {
    text-align: center; padding: 4rem 1.5rem;
    background: var(--navy); color: var(--white); margin-top: 2rem;
}
.about-cta h2 { color: var(--white); margin-bottom: 1.5rem; font-size: 1.8rem; }
.about-cta .btn-primary { background: var(--gold); color: var(--navy); }
.about-cta .btn-primary:hover { background: var(--gold-light); }

/* ═══════════ CONTACT PAGE ═══════════ */
.contact-hero {
    margin-top: var(--header-height); padding: 5rem 1.5rem 3rem;
    text-align: center; background: linear-gradient(180deg, var(--cream-dark) 0%, var(--cream) 100%);
}
.contact-lead { max-width: 500px; margin: 1rem auto 0; color: var(--text-secondary); font-size: 1.05rem; }
.contact-section { max-width: 1100px; margin: 0 auto; padding: 3rem 1.5rem 5rem; }
.contact-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 3rem; }
.contact-form-wrapper {
    background: var(--white); padding: 2.5rem; border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}
.contact-form-wrapper h2 { margin-bottom: 1.5rem; font-size: 1.4rem; }
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; margin-bottom: 0.4rem; font-weight: 600; font-size: 0.9rem; color: var(--navy); }
.form-group input, .form-group textarea {
    width: 100%; padding: 0.8rem 1rem; border: 1.5px solid var(--cream-dark);
    border-radius: var(--radius-sm); font-family: var(--font-body);
    font-size: 0.95rem; transition: border-color var(--transition);
    background: var(--cream);
}
.form-group input:focus, .form-group textarea:focus { outline: none; border-color: var(--gold); background: var(--white); }
.form-group textarea { resize: vertical; min-height: 120px; }
.form-status {
    margin-top: 1rem; padding: 0.8rem 1rem; border-radius: var(--radius-sm);
    font-size: 0.9rem; display: none;
}
.form-status.success { background: #e8f5e9; color: #2e7d32; }
.form-status.error { background: #fbe9e7; color: #c62828; }
.contact-info { display: flex; flex-direction: column; gap: 1.5rem; }
.info-card {
    background: var(--white); padding: 1.5rem; border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm); transition: all var(--transition);
}
.info-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.info-icon { font-size: 1.5rem; margin-bottom: 0.5rem; }
.info-card h3 { font-size: 1rem; margin-bottom: 0.3rem; }
.info-card p { font-size: 0.9rem; color: var(--text-secondary); line-height: 1.5; }

/* ═══════════ FOOTER ═══════════ */
.site-footer { background: var(--navy); color: var(--white); padding: 3rem 1.5rem 0; margin-top: auto; }
.footer-container { max-width: 1100px; margin: 0 auto; display: flex; justify-content: space-between; gap: 3rem; flex-wrap: wrap; }
.footer-brand .logo-text { color: var(--white); }
.footer-tagline { color: rgba(255,255,255,0.6); font-size: 0.9rem; margin-top: 0.5rem; }
.footer-links { display: flex; gap: 4rem; }
.footer-col { display: flex; flex-direction: column; gap: 0.5rem; }
.footer-col h4 { color: var(--gold); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.5rem; }
.footer-col a { color: rgba(255,255,255,0.7); font-size: 0.9rem; }
.footer-col a:hover { color: var(--gold); }
.footer-bottom {
    text-align: center; padding: 1.5rem 0; margin-top: 2.5rem;
    border-top: 1px solid rgba(255,255,255,0.1); color: rgba(255,255,255,0.5); font-size: 0.8rem;
}

/* ═══════════ MAIN CONTENT ═══════════ */
.main-content { min-height: calc(100vh - var(--header-height) - 200px); }

/* ═══════════ RESPONSIVE ═══════════ */
@media (max-width: 768px) {
    .mobile-menu-btn { display: flex; }
    .main-nav {
        position: fixed; top: var(--header-height); left: 0; right: 0;
        background: var(--cream); flex-direction: column; padding: 1.5rem;
        gap: 1rem; box-shadow: var(--shadow-md);
        transform: translateY(-100%); opacity: 0; pointer-events: none;
        transition: all var(--transition);
    }
    .main-nav.open { transform: translateY(0); opacity: 1; pointer-events: auto; }
    .hero { flex-direction: column; text-align: center; padding: 3rem 1.5rem; min-height: auto; }
    .hero-title { font-size: 2.2rem; }
    .hero-decoration { display: none; }
    .book-grid { grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 1.2rem; }
    .section-title { font-size: 1.7rem; }
    .contact-grid { grid-template-columns: 1fr; }
    .footer-container { flex-direction: column; text-align: center; }
    .footer-links { justify-content: center; }
}
@media (max-width: 480px) {
    .hero-title { font-size: 1.8rem; }
    .book-grid { grid-template-columns: 1fr; }
    .filter-bar { gap: 0.4rem; }
    .filter-btn { padding: 0.45rem 1rem; font-size: 0.82rem; }
}
