/* ==========================================================================
   Everline Publications — storefront + dashboard stylesheet
   ========================================================================== */

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

:root {
    --primary-navy: #1F3563;
    --primary-blue: #2C3E7C;
    --primary-teal: #0D9DAA;
    --primary-sky: #4DA6D4;

    --accent-orange: #FF6B35;
    --accent-cyan: #00A0B0;

    --text-dark: #1C1C1E;
    --text-gray: #48484A;
    --text-light: #8E8E93;

    --bg-light: #E8F4F8;
    --bg-ultra-light: #F0F8FA;
    --bg-white: #FFFFFF;

    --border-light: rgba(60, 60, 67, 0.12);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 32px rgba(0,0,0,0.14);

    --gradient-primary: linear-gradient(135deg, #2C3E7C 0%, #1F3563 50%, #0D9DAA 100%);
    --gradient-secondary: linear-gradient(135deg, #0D9DAA 0%, #4DA6D4 50%, #5DADE2 100%);
    --gradient-accent: linear-gradient(135deg, #FF6B35 0%, #FF8347 50%, #FFA07A 100%);

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;

    /* ---- New tokens (additive — storefront redesign) ---- */
    --bg-paper: #FAF7F1;
    --bg-paper-dim: #F3EEE3;
    --surface-navy: #16274A;

    --danger: #E5484D;
    --danger-bg: #FDE2E2;
    --success: #147A41;
    --success-bg: #E2F8EA;
    --warning: #8A6100;
    --warning-bg: #FFF4D9;
    --info: #0E5F8A;
    --info-bg: #E3F2FB;

    --gradient-brand: linear-gradient(120deg, #1F3563 0%, #0D9DAA 100%);
    --radius-xl: 26px;

    --font-display: Georgia, "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;

    --ease-out: cubic-bezier(.16,1,.3,1);
    --ease-spring: cubic-bezier(.34,1.56,.64,1);
    --dur-fast: .16s;
    --dur-base: .28s;
    --dur-slow: .5s;

    color-scheme: light;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

html { scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-dark);
    line-height: 1.6;
    background: var(--bg-paper);
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; }
ul { list-style: none; }
button { font-family: inherit; }

:focus-visible {
    outline: 2.5px solid var(--primary-teal);
    outline-offset: 3px;
    border-radius: 4px;
}
.btn:focus-visible, .book-btn:focus-visible { outline-offset: 4px; }

.skip-link {
    position: absolute; left: 1rem; top: -60px; background: var(--primary-navy); color: #fff;
    padding: .8rem 1.2rem; border-radius: var(--radius-sm); z-index: 1000; font-weight: 700;
    transition: top var(--dur-base) var(--ease-out);
}
.skip-link:focus { top: 1rem; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }

.icon { display: inline-block; vertical-align: middle; flex-shrink: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    padding: .85rem 1.6rem; border-radius: var(--radius-md); border: none;
    font-weight: 700; font-size: .95rem; cursor: pointer;
    transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-base) var(--ease-out), background var(--dur-base) ease, filter var(--dur-base) ease;
    text-align: center;
}
.btn-primary { background: var(--gradient-brand); color: #fff; box-shadow: var(--shadow-md); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.btn-primary:active { transform: translateY(0) scale(.97); }
.btn-accent { background: var(--gradient-accent); color: #fff; }
.btn-accent:active { transform: scale(.97); }
.btn-outline { background: #fff; border: 2px solid var(--primary-navy); color: var(--primary-navy); }
.btn-outline:hover { background: var(--primary-navy); color: #fff; }
.btn-outline:active { transform: scale(.97); }
.btn-block { width: 100%; }
.btn-sm { padding: .5rem 1rem; font-size: .8rem; border-radius: var(--radius-sm); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }
.btn.is-loading { color: transparent !important; pointer-events: none; position: relative; }
.btn.is-loading::after {
    content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%;
    border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff; animation: spin .7s linear infinite;
}
.btn-outline.is-loading::after { border-color: rgba(31,53,99,.25); border-top-color: var(--primary-navy); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Header ---------- */
header.site-header {
    background: rgba(250,247,241,0.85);
    backdrop-filter: blur(18px) saturate(180%);
    -webkit-backdrop-filter: blur(18px) saturate(180%);
    box-shadow: 0 1px 0 var(--border-light);
    position: sticky; top: 0; z-index: 100;
    padding: .85rem 0;
}
.nav-container { display: flex; align-items: center; justify-content: space-between; gap: 1.25rem; }
.logo { display: flex; align-items: center; gap: .65rem; font-size: 1.28rem; font-weight: 800; color: var(--primary-navy); font-family: var(--font-display); flex-shrink: 0; }
.logo .brand-mark {
    width: 40px; height: 40px; border-radius: 11px; background: var(--gradient-brand);
    color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.05rem;
    font-family: -apple-system, sans-serif; box-shadow: var(--shadow-sm);
}
nav.main-nav { display: flex; align-items: center; gap: 1.6rem; }
nav.main-nav a { display: flex; align-items: center; gap: .4rem; font-weight: 600; font-size: .92rem; color: var(--text-dark); position: relative; padding: .3rem 0; transition: color var(--dur-fast) ease; }
nav.main-nav a::after {
    content: ''; position: absolute; left: 0; right: 0; bottom: -4px; height: 2px; background: var(--primary-teal);
    transform: scaleX(0); transform-origin: left; transition: transform var(--dur-base) var(--ease-out);
}
nav.main-nav a:hover { color: var(--primary-teal); }
nav.main-nav a:hover::after { transform: scaleX(1); }

.search-form {
    display: flex; align-items: center; flex: 1; max-width: 400px;
    background: #fff; border: 1.5px solid var(--border-light); border-radius: 100px;
    padding: .3rem .3rem .3rem 1.1rem; transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.search-form:focus-within { border-color: var(--primary-teal); box-shadow: 0 0 0 3px rgba(13,157,170,.12); }
.search-form input {
    flex: 1; min-width: 0; border: none; background: transparent; padding: .5rem 0; font-size: .9rem; outline: none;
}
.search-form button {
    width: 38px; height: 38px; flex-shrink: 0; background: var(--primary-navy); color: #fff; border: none;
    border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: background var(--dur-fast) ease;
}
.search-form button:hover { background: var(--primary-teal); }

.mobile-search-form {
    display: flex; align-items: center; background: #fff; border: 1.5px solid var(--border-light);
    border-radius: 100px; padding: .3rem .3rem .3rem 1.1rem;
}
.mobile-search-form:focus-within { border-color: var(--primary-teal); }
.mobile-search-form input { flex: 1; min-width: 0; border: none; background: transparent; padding: .6rem 0; font-size: .95rem; outline: none; }
.mobile-search-form button {
    width: 40px; height: 40px; flex-shrink: 0; background: var(--primary-navy); color: #fff; border: none;
    border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer;
}

.header-icon-btn {
    display: none; align-items: center; justify-content: center; width: 40px; height: 40px;
    border-radius: 50%; background: transparent; border: none; color: var(--primary-navy); cursor: pointer;
    transition: background var(--dur-fast) ease;
}
.header-icon-btn:hover { background: var(--bg-ultra-light); }

.cart-icon-link { position: relative; display: flex; align-items: center; gap: .45rem; font-weight: 700; }
.cart-badge {
    position: absolute; top: -8px; right: -12px;
    background: var(--accent-orange); color: #fff; font-size: .68rem; font-weight: 800;
    border-radius: 50%; width: 19px; height: 19px; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 0 2px var(--bg-paper); transition: transform var(--dur-base) var(--ease-spring);
}
.cart-badge.bump { animation: bump .4s var(--ease-spring); }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.45); } 100% { transform: scale(1); } }

.mobile-toggle {
    display: none; background: none; border: none; cursor: pointer; color: var(--primary-navy);
    align-items: center; justify-content: center; width: 40px; height: 40px;
}

/* ---------- Mobile nav panel ---------- */
.mobile-nav-overlay {
    position: fixed; inset: 0; background: rgba(22,39,74,.45); backdrop-filter: blur(2px);
    z-index: 199; opacity: 0; pointer-events: none; transition: opacity var(--dur-base) ease;
}
.mobile-nav-overlay.open { opacity: 1; pointer-events: auto; }
.mobile-nav-panel {
    position: fixed; top: 0; right: 0; bottom: 0; width: min(320px, 84vw); background: #fff; z-index: 200;
    padding: 1.4rem 1.3rem 2rem; box-shadow: var(--shadow-lg);
    transform: translateX(100%); transition: transform var(--dur-base) var(--ease-out);
    display: flex; flex-direction: column; gap: 1.4rem; overflow-y: auto;
}
.mobile-nav-panel.open { transform: translateX(0); }
.mobile-nav-head { display: flex; align-items: center; justify-content: space-between; }
.mobile-nav-head .close-btn { background: var(--bg-ultra-light); border: none; width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--primary-navy); cursor: pointer; }
.mobile-nav-links { display: flex; flex-direction: column; gap: .2rem; }
.mobile-nav-links a { display: flex; align-items: center; gap: .8rem; padding: .85rem .5rem; font-weight: 700; font-size: 1rem; color: var(--text-dark); border-radius: var(--radius-sm); transition: background var(--dur-fast) ease; }
.mobile-nav-links a:hover { background: var(--bg-ultra-light); }
body.nav-open { overflow: hidden; }

/* ---------- Hero ---------- */
.hero {
    background: var(--surface-navy); color: #fff; padding: 4.5rem 0 5rem; position: relative; overflow: hidden;
}
.hero::before, .hero::after {
    content: ''; position: absolute; border-radius: 50%; filter: blur(60px); opacity: .55; pointer-events: none;
}
.hero::before { width: 480px; height: 480px; background: radial-gradient(circle, var(--primary-teal), transparent 70%); top: -220px; right: -120px; }
.hero::after { width: 380px; height: 380px; background: radial-gradient(circle, var(--accent-orange), transparent 70%); bottom: -220px; left: -80px; opacity: .28; }
.hero .container { display: flex; align-items: center; gap: 3rem; flex-wrap: wrap; position: relative; z-index: 1; }
.hero-content { flex: 1.1; min-width: 280px; }
.hero-eyebrow { display: inline-flex; align-items: center; gap: .5rem; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18); padding: .4rem .9rem; border-radius: 100px; font-size: .78rem; font-weight: 700; letter-spacing: .03em; margin-bottom: 1.1rem; }
.hero-content h1 { font-family: var(--font-display); font-size: 2.9rem; margin-bottom: 1rem; letter-spacing: -0.01em; }
.hero-content p { font-size: 1.08rem; opacity: .85; margin-bottom: 1.8rem; max-width: 520px; }
.hero-badges { display: flex; gap: .7rem; flex-wrap: wrap; margin-top: 1.7rem; }
.hero-badge {
    display: inline-flex; align-items: center; gap: .45rem;
    background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.16);
    padding: .5rem 1rem .5rem .7rem; border-radius: 100px; font-size: .8rem; font-weight: 600;
}
.hero-cta { display: flex; gap: 1rem; flex-wrap: wrap; }

.hero-visual { flex: .9; min-width: 240px; display: flex; align-items: center; justify-content: center; position: relative; }
.hero-banner-carousel {
    position: relative; width: 300px; height: 300px; border-radius: var(--radius-xl); overflow: hidden;
    box-shadow: var(--shadow-lg); background: var(--bg-ultra-light);
}
.hero-banner-carousel .slide {
    position: absolute; inset: 0; opacity: 0; transition: opacity .6s var(--ease-out);
}
.hero-banner-carousel .slide.active { opacity: 1; }
.hero-banner-carousel img { width: 100%; height: 100%; object-fit: cover; }
.hero-banner-dots { position: absolute; left: 0; right: 0; bottom: .9rem; display: flex; justify-content: center; gap: .4rem; z-index: 2; }
.hero-banner-dots button {
    width: 7px; height: 7px; border-radius: 50%; border: none; background: rgba(255,255,255,.5); padding: 0; cursor: pointer;
    transition: all var(--dur-base) ease;
}
.hero-banner-dots button.active { background: #fff; width: 20px; border-radius: 100px; }

/* ---------- Section headings ---------- */
.section { padding: 3.8rem 0; }
.section-head { text-align: center; margin-bottom: 2.4rem; }
.section-head h2 { font-family: var(--font-display); font-size: 2.1rem; color: var(--primary-navy); margin-bottom: .5rem; }
.section-head p { color: var(--text-gray); }

/* ---------- Category chips ---------- */
.category-chips { display: flex; gap: .6rem; flex-wrap: wrap; justify-content: center; margin-bottom: 2.2rem; }
.category-chip {
    padding: .55rem 1.15rem; border-radius: 100px; background: #fff; border: 1.5px solid var(--border-light);
    font-size: .85rem; font-weight: 600; color: var(--text-gray); transition: all var(--dur-fast) ease;
}
.category-chip.active, .category-chip:hover { background: var(--primary-navy); color: #fff; border-color: transparent; }

/* ---------- Book / product grid ---------- */
.books-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 1.25rem;
}
.book-card {
    background: #fff; border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm);
    transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
    display: flex; flex-direction: column; border: 1px solid transparent;
}
.book-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }
.book-cover-link {
    display: block; position: relative; aspect-ratio: 3/4; overflow: hidden;
    background: linear-gradient(160deg, var(--bg-ultra-light), #fff);
}
.book-cover-link img {
    width: 100%; height: 100%; object-fit: contain; padding: .45rem; position: relative; z-index: 1;
    transition: transform var(--dur-slow) var(--ease-out), opacity var(--dur-base) ease;
}
/* Fade-in is JS-opt-in only: .img-fade-init (added by JS before load) starts
   hidden; without JS the image simply has no such class and stays visible. */
.book-cover-link img.img-fade-init { opacity: 0; }
.book-card:hover .book-cover-link img { transform: scale(1.035); }
.book-badge {
    position: absolute; top: .6rem; left: .6rem; z-index: 2; background: var(--gradient-accent); color: #fff;
    font-size: .66rem; font-weight: 800; padding: .32rem .65rem; border-radius: 100px; text-transform: uppercase;
    letter-spacing: .03em; box-shadow: var(--shadow-sm);
}
.book-info { padding: .75rem .85rem .85rem; display: flex; flex-direction: column; gap: .22rem; flex: 1; }
.book-top-row { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.book-category { flex: 1; min-width: 0; font-size: .68rem; font-weight: 700; color: var(--primary-teal); text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book-title {
    font-size: .95rem; color: var(--primary-navy); line-height: 1.3; margin: 0;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.5em;
}
.book-title a { color: inherit; }
.book-title a:hover { color: var(--primary-teal); }
.book-meta-row { font-size: .76rem; color: var(--text-light); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book-meta-row .author { color: var(--text-gray); font-weight: 600; }
.book-price-row { display: flex; align-items: center; justify-content: space-between; margin-top: .2rem; gap: .5rem; }
.book-price { font-size: 1.1rem; font-weight: 800; color: var(--primary-navy); }
.book-btn {
    width: 38px; height: 38px; flex-shrink: 0; border: none; border-radius: 50%;
    background: var(--gradient-brand); color: #fff; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: filter var(--dur-fast) ease, transform var(--dur-fast) var(--ease-out);
}
.book-btn:hover:not(:disabled) { filter: brightness(1.08); }
.book-btn:active:not(:disabled) { transform: scale(.9); }
.book-btn:disabled { background: var(--bg-ultra-light); color: var(--text-light); cursor: not-allowed; }
.out-of-stock { color: var(--danger); font-weight: 700; font-size: .76rem; }

.no-results { text-align: center; padding: 3.5rem 1rem; color: var(--text-gray); }
.no-results .icon { color: var(--border-light); margin: 0 auto 1rem; width: 48px; height: 48px; }

/* ---------- Pagination ---------- */
.pagination { display: flex; justify-content: center; gap: .5rem; margin-top: 2.6rem; }
.pagination a, .pagination span {
    padding: .55rem .95rem; border-radius: var(--radius-sm); background: #fff; border: 1px solid var(--border-light);
    font-weight: 600; font-size: .85rem; color: var(--text-dark); transition: all var(--dur-fast) ease;
}
.pagination a:hover { border-color: var(--primary-teal); color: var(--primary-teal); }
.pagination .current { background: var(--primary-navy); color: #fff; border-color: transparent; }

.infinite-sentinel { height: 1px; }
.infinite-loader { display: none; align-items: center; justify-content: center; gap: .6rem; padding: 2.4rem 0 .5rem; color: var(--text-gray); font-size: .88rem; font-weight: 600; }
.infinite-loader.is-visible { display: flex; }
.infinite-loader .spinner { width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid var(--border-light); border-top-color: var(--primary-teal); animation: spin .7s linear infinite; }

/* ---------- Breadcrumbs ---------- */
.breadcrumbs { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem; font-size: .82rem; color: var(--text-light); padding: 1.2rem 0 0; }
.breadcrumbs a { color: var(--text-gray); font-weight: 600; }
.breadcrumbs a:hover { color: var(--primary-teal); }
.breadcrumbs .icon { width: 13px; height: 13px; opacity: .6; }
.breadcrumbs .current { color: var(--text-dark); font-weight: 700; }

/* ---------- Product detail ---------- */
.product-detail { display: grid; grid-template-columns: 380px 1fr; gap: 3.2rem; padding: 1.8rem 0 3rem; align-items: flex-start; }
.product-detail .cover {
    border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-md);
    background: linear-gradient(160deg, var(--bg-ultra-light), #fff); position: sticky; top: 100px;
}
.product-detail .cover img { width: 100%; aspect-ratio: 3/4; object-fit: contain; padding: 1.2rem; }
.product-info .category-tag { color: var(--primary-teal); font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.product-info h1 { font-family: var(--font-display); font-size: 2.1rem; color: var(--primary-navy); margin: .4rem 0; }
.product-info .author { color: var(--text-gray); margin-bottom: 1rem; }
.product-info .product-meta-row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; color: var(--text-gray); font-size: .9rem; margin-bottom: 1.1rem; }
.product-info .price-block { font-size: 2.3rem; font-weight: 800; color: var(--primary-navy); margin: 1rem 0; font-family: var(--font-display); }
.product-info .description { color: var(--text-gray); margin-bottom: 1.5rem; white-space: pre-line; }
.add-to-cart-row { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.qty-select { padding: .8rem 1rem; border-radius: var(--radius-sm); border: 1.5px solid var(--border-light); font-size: .95rem; font-weight: 600; background: #fff; cursor: pointer; }
.qty-select:focus { border-color: var(--primary-teal); }

.qty-stepper { display: inline-flex; align-items: center; border: 1.5px solid var(--border-light); border-radius: var(--radius-sm); overflow: hidden; }
.qty-stepper button { width: 40px; height: 44px; border: none; background: #fff; color: var(--primary-navy); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background var(--dur-fast) ease; }
.qty-stepper button:hover { background: var(--bg-ultra-light); }
.qty-stepper button:disabled { opacity: .35; cursor: not-allowed; }
.qty-stepper input { width: 46px; height: 44px; border: none; border-left: 1.5px solid var(--border-light); border-right: 1.5px solid var(--border-light); text-align: center; font-weight: 700; font-size: .95rem; -moz-appearance: textfield; }
.qty-stepper input::-webkit-outer-spin-button, .qty-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.stock-note { margin-top: .9rem; font-size: .85rem; color: var(--text-light); display: flex; align-items: center; gap: .4rem; }
.stock-note .icon { color: var(--success); }
.related-products { padding: 1.5rem 0 4rem; }

.sticky-add-bar {
    display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 90; background: #fff;
    box-shadow: 0 -6px 24px rgba(0,0,0,.08); padding: .8rem 1rem; align-items: center; gap: 1rem;
    padding-bottom: calc(.8rem + env(safe-area-inset-bottom));
}
.sticky-add-bar .price { font-weight: 800; color: var(--primary-navy); font-size: 1.1rem; white-space: nowrap; }
.sticky-add-bar form:first-of-type .btn { padding: .8rem; width: 46px; flex-shrink: 0; }

/* ---------- Cart ---------- */
.cart-page { padding: 2.4rem 0 3rem; }
.cart-table { width: 100%; background: #fff; border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); border-collapse: collapse; }
.cart-table th { text-align: left; background: var(--bg-ultra-light); padding: 1rem; font-size: .8rem; text-transform: uppercase; color: var(--text-gray); letter-spacing: .02em; }
.cart-table td { padding: 1rem; border-top: 1px solid var(--border-light); vertical-align: middle; }
.cart-item-info { display: flex; align-items: center; gap: 1rem; }
.cart-item-info img { width: 56px; height: 76px; object-fit: contain; border-radius: 8px; background: var(--bg-ultra-light); padding: .3rem; }
.cart-item-name { font-weight: 700; }
.cart-item-author { font-size: .8rem; color: var(--text-light); margin-top: .1rem; }
.cart-remove-btn { background: none; border: none; color: var(--text-light); cursor: pointer; width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: all var(--dur-fast) ease; }
.cart-remove-btn:hover { background: var(--danger-bg); color: var(--danger); }

.cart-summary { max-width: 380px; margin-left: auto; margin-top: 2rem; background: #fff; padding: 1.6rem; border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.cart-summary .row { display: flex; justify-content: space-between; margin-bottom: .8rem; color: var(--text-gray); }
.cart-summary .row.total { font-size: 1.3rem; font-weight: 800; color: var(--primary-navy); border-top: 1px solid var(--border-light); padding-top: .8rem; }
.empty-cart { text-align: center; padding: 4.5rem 1rem; }
.empty-cart .icon { width: 64px; height: 64px; color: var(--border-light); margin: 0 auto 1.2rem; }

/* Cart rows collapse to cards on small screens (see media query) */
.cart-row-card { display: none; }

/* ---------- Forms (checkout, tracking) ---------- */
.form-card { background: #fff; border-radius: var(--radius-lg); padding: 2rem; box-shadow: var(--shadow-sm); }
.form-group { margin-bottom: 1.1rem; }
.form-group label { display: block; font-weight: 700; font-size: .85rem; margin-bottom: .4rem; color: var(--text-dark); }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: .8rem 1rem; border-radius: var(--radius-sm); border: 1.5px solid var(--border-light);
    font-size: .95rem; font-family: inherit; outline: none; transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--primary-teal); box-shadow: 0 0 0 3px rgba(13,157,170,.12); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.radio-group { display: flex; gap: 1rem; flex-wrap: wrap; }
.radio-option { flex: 1; min-width: 180px; border: 1.5px solid var(--border-light); border-radius: var(--radius-sm); padding: .9rem; display: flex; gap: .6rem; align-items: center; cursor: pointer; transition: border-color var(--dur-fast) ease, background var(--dur-fast) ease; }
.radio-option:hover { border-color: var(--primary-teal); background: var(--bg-ultra-light); }
.radio-option input { width: auto; }
.errorlist { color: var(--danger); font-size: .8rem; list-style: none; margin-top: .3rem; }
.checkout-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 2.5rem; padding: 2.4rem 0 3rem; align-items: flex-start; }
.order-summary-card { background: #fff; border-radius: var(--radius-lg); padding: 1.6rem; box-shadow: var(--shadow-sm); position: sticky; top: 100px; }
.order-summary-card .item { display: flex; justify-content: space-between; font-size: .88rem; padding: .5rem 0; border-bottom: 1px dashed var(--border-light); }

/* ---------- Messages & toasts ---------- */
.messages { padding: 1rem 0 0; }
.alert {
    display: flex; align-items: center; gap: .6rem;
    padding: .9rem 1.2rem; border-radius: var(--radius-sm); margin-bottom: .8rem; font-weight: 600; font-size: .9rem;
    animation: slide-down var(--dur-base) var(--ease-out);
}
@keyframes slide-down { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
.alert-success { background: var(--success-bg); color: var(--success); }
.alert-error { background: var(--danger-bg); color: var(--danger); }
.alert-warning { background: var(--warning-bg); color: var(--warning); }
.alert-info { background: var(--info-bg); color: var(--info); }
.alert.is-leaving { animation: fade-out var(--dur-base) ease forwards; }
@keyframes fade-out { to { opacity: 0; transform: translateY(-6px); } }

.toast-stack {
    position: fixed; top: 5.5rem; right: 1.25rem; z-index: 300; display: flex; flex-direction: column; gap: .6rem;
    width: min(340px, calc(100vw - 2rem));
}
.toast {
    background: #fff; border-radius: var(--radius-md); box-shadow: var(--shadow-lg); padding: .9rem 1.1rem;
    display: flex; align-items: center; gap: .7rem; font-size: .88rem; font-weight: 600; color: var(--text-dark);
    border-left: 4px solid var(--success);
    animation: toast-in var(--dur-base) var(--ease-spring);
}
.toast .icon { color: var(--success); flex-shrink: 0; }
.toast.is-leaving { animation: toast-out var(--dur-fast) ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateX(24px) scale(.96); } to { opacity: 1; transform: translateX(0) scale(1); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(24px) scale(.96); } }

/* ---------- Order pages ---------- */
.order-status-badge { padding: .3rem .8rem; border-radius: 100px; font-size: .75rem; font-weight: 800; text-transform: uppercase; }
.status-pending { background: #fff4d9; color: #8a6100; }
.status-confirmed, .status-processing { background: #e3f2fb; color: #0e5f8a; }
.status-shipped { background: #e6e2fb; color: #4a3aa8; }
.status-delivered { background: #e2f8ea; color: #147a41; }
.status-cancelled { background: #fde2e2; color: #b3261e; }

/* ---------- Product management (dashboard) ---------- */
.table-thumb { width: 44px; height: 60px; object-fit: cover; border-radius: var(--radius-sm); background: var(--bg-ultra-light); }

.badge-pill { padding: .3rem .8rem; border-radius: 100px; font-size: .75rem; font-weight: 800; text-transform: uppercase; }
.badge-active { background: #e2f8ea; color: #147a41; }
.badge-inactive { background: #fde2e2; color: #b3261e; }
.badge-featured { background: #fff4d9; color: #8a6100; }

.image-preview-box { margin-top: .6rem; width: 110px; height: 150px; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border-light); background: var(--bg-ultra-light); }
.image-preview-box img { width: 100%; height: 100%; object-fit: cover; }

.checkbox-row { display: flex; gap: 1.5rem; align-items: center; margin: 1rem 0 1.4rem; flex-wrap: wrap; }
.checkbox-row label { display: flex; align-items: center; gap: .5rem; font-weight: 600; font-size: .88rem; color: var(--text-dark); cursor: pointer; }
.checkbox-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--primary-teal); cursor: pointer; }

.timeline { border-left: 3px solid var(--primary-teal); margin-left: 1rem; padding-left: 1.5rem; }
.timeline-item { position: relative; padding-bottom: 1.6rem; }
.timeline-item::before { content: ''; position: absolute; left: -1.94rem; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--primary-teal); box-shadow: 0 0 0 3px var(--bg-ultra-light); }
.timeline-item time { font-size: .78rem; color: var(--text-light); display: block; }

.success-hero { text-align: center; padding: 3rem 0; }
.success-hero .check { width: 68px; height: 68px; color: var(--success); background: var(--success-bg); border-radius: 50%; padding: 14px; margin: 0 auto; animation: pop var(--dur-slow) var(--ease-spring); }
@keyframes pop { from { transform: scale(.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- Payment methods ---------- */
.payment-methods-section { padding-top: 0; }
.payment-methods-card { background: #fff; border-radius: var(--radius-lg); padding: 1.8rem 2rem; box-shadow: var(--shadow-sm); }
.payment-methods-head { display: flex; align-items: flex-start; gap: .9rem; margin-bottom: 1.4rem; }
.payment-methods-shield { flex-shrink: 0; color: var(--success); background: var(--success-bg); border-radius: 50%; padding: 9px; display: flex; }
.payment-methods-head h4 { color: var(--primary-navy); margin-bottom: .2rem; }
.payment-methods-head p { color: var(--text-gray); font-size: .85rem; }
.payment-badges { display: flex; flex-wrap: wrap; gap: .6rem; }
.payment-badge {
    display: inline-flex; align-items: center; gap: .45rem; padding: .5rem .9rem;
    border-radius: var(--radius-sm); border: 1.5px solid var(--border-light); background: var(--bg-ultra-light);
    font-size: .82rem; font-weight: 700; color: var(--text-dark);
}
.payment-badge .icon { color: var(--primary-teal); }

/* ---------- About / trust / footer ---------- */
.trust-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.5rem; }
.trust-card { background: #fff; border-radius: var(--radius-lg); padding: 1.8rem 1.6rem; text-align: center; box-shadow: var(--shadow-sm); transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out); }
.trust-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.trust-card .icon-wrap { width: 52px; height: 52px; border-radius: 14px; background: var(--bg-ultra-light); color: var(--primary-teal); display: flex; align-items: center; justify-content: center; margin: 0 auto .9rem; }

footer.site-footer { background: var(--surface-navy); color: #cfd9ea; padding: 3.2rem 0 1.5rem; margin-top: 3rem; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 2rem; margin-bottom: 2rem; }
.footer-grid h4 { color: #fff; margin-bottom: 1rem; font-family: var(--font-display); }
.footer-grid a { display: flex; align-items: center; gap: .5rem; padding: .35rem 0; color: #cfd9ea; transition: color var(--dur-fast) ease; }
.footer-grid a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.15); padding-top: 1.2rem; text-align: center; font-size: .85rem; color: #9fb0c9; }

/* ---------- Dashboard ---------- */
.dash-wrapper { display: flex; min-height: 100vh; background: var(--bg-ultra-light); }
.dash-sidebar { width: 250px; background: var(--primary-navy); color: #fff; padding: 1.5rem 1rem; flex-shrink: 0; }
.dash-sidebar .brand { font-weight: 800; font-size: 1.2rem; margin-bottom: 2rem; padding: 0 .5rem; }
.dash-sidebar a { display: flex; align-items: center; gap: .7rem; padding: .8rem .9rem; border-radius: var(--radius-sm); color: #cfd9ea; font-weight: 600; margin-bottom: .3rem; font-size: .92rem; }
.dash-sidebar a:hover, .dash-sidebar a.active { background: rgba(255,255,255,0.12); color: #fff; }
.dash-main { flex: 1; padding: 2rem 2.5rem; max-width: 100%; overflow-x: auto; min-width: 0; }
.breadcrumbs { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem; font-size: .82rem; margin-bottom: 1rem; }
.breadcrumbs a { color: var(--text-gray); font-weight: 600; }
.breadcrumbs a:hover { color: var(--primary-teal); }
.breadcrumbs .crumb-sep { color: var(--border-light); }
.breadcrumbs .crumb-current { color: var(--primary-navy); font-weight: 700; }
.dash-topbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .8rem; margin-bottom: 2rem; }
.dash-topbar h1 { font-size: 1.5rem; color: var(--primary-navy); }

/* Mobile top bar (hamburger + brand) — hidden on desktop, shown below the 900px breakpoint */
.dash-mobile-bar { display: none; align-items: center; gap: .7rem; background: var(--primary-navy); color: #fff; padding: .9rem 1.1rem; }
.dash-mobile-bar .dash-mobile-toggle { display: flex; color: #fff; }
.dash-mobile-brand { font-weight: 800; font-size: 1.05rem; }
.dash-mobile-panel .mobile-nav-links a { color: var(--text-dark); }
.dash-mobile-panel .mobile-nav-links a:hover,
.dash-mobile-panel .mobile-nav-links a.active { background: var(--bg-ultra-light); color: var(--primary-teal); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.2rem; margin-bottom: 2rem; }
.stat-card { background: #fff; border-radius: var(--radius-lg); padding: 1.4rem; box-shadow: var(--shadow-sm); }
.stat-card .label { font-size: .78rem; text-transform: uppercase; color: var(--text-light); font-weight: 700; }
.stat-card .value { font-size: 1.7rem; font-weight: 800; color: var(--primary-navy); margin-top: .3rem; }

.data-table { width: 100%; background: #fff; border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); border-collapse: collapse; }
.data-table th { text-align: left; background: var(--bg-ultra-light); padding: .9rem 1.1rem; font-size: .76rem; text-transform: uppercase; color: var(--text-gray); }
.data-table td { padding: .9rem 1.1rem; border-top: 1px solid var(--border-light); font-size: .88rem; }
.data-table tr:hover td { background: var(--bg-ultra-light); }
.table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

.dash-card { background: #fff; border-radius: var(--radius-lg); padding: 1.6rem; box-shadow: var(--shadow-sm); margin-bottom: 1.5rem; }
.filter-bar { display: flex; gap: .7rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.filter-bar select, .filter-bar input { padding: .6rem .9rem; border-radius: var(--radius-sm); border: 1px solid var(--border-light); font-size: .85rem; }

/* Two-column detail layouts (order detail, customer detail, reports charts).
   Kept as real classes (not inline styles) so the 900px breakpoint below can collapse them. */
.dash-grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 1.5rem; align-items: flex-start; }
.dash-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--gradient-primary); padding: 1rem; }
.login-card { background: #fff; padding: 2.5rem; border-radius: var(--radius-lg); width: 100%; max-width: 380px; box-shadow: var(--shadow-lg); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .product-detail { grid-template-columns: 1fr; }
    .product-detail .cover { position: static; max-width: 320px; margin: 0 auto; }
    .checkout-grid { grid-template-columns: 1fr; }
    .order-summary-card { position: static; }
    .dash-wrapper { flex-direction: column; }
    .dash-sidebar { display: none; }
    .dash-mobile-bar { display: flex; }
    .dash-main { padding: 1.5rem 1.25rem; }
    .dash-grid-2-1, .dash-grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 780px) {
    .sticky-add-bar.is-active { display: flex; }
}

@media (max-width: 720px) {
    nav.main-nav, .search-form { display: none; }
    .mobile-toggle, .header-icon-btn { display: flex; }
    .hero { padding: 1.4rem 0 1.6rem; }
    .hero .container { gap: 1rem; text-align: left; }
    .hero-eyebrow { margin-bottom: .5rem; font-size: .68rem; padding: .3rem .7rem; }
    .hero-content h1 { font-size: 1.4rem; margin-bottom: .45rem; line-height: 1.2; }
    .hero-content p { font-size: .88rem; margin-bottom: .9rem; margin-left: 0; margin-right: 0; }
    .hero-cta { justify-content: flex-start; }
    .hero-cta .btn { padding: .65rem 1.2rem; font-size: .86rem; }
    .hero-badges { justify-content: flex-start; margin-top: .7rem; gap: .4rem; }
    .hero-badge { font-size: .68rem; padding: .32rem .7rem .32rem .5rem; }
    .hero-visual { margin-top: 0; justify-content: flex-start; }
    .hero-banner-carousel { width: 120px; height: 120px; border-radius: var(--radius-md); }
    .form-row { grid-template-columns: 1fr; }

    /* Buy Now / Add to Cart / quantity share one compact row instead of wrapping */
    .add-to-cart-row { flex-wrap: nowrap; gap: .5rem; }
    .add-to-cart-row .qty-select { flex-shrink: 0; width: 62px; padding: .8rem .4rem; }
    .add-to-cart-row .btn { flex: 1; min-width: 0; padding: .8rem .4rem; font-size: .78rem; gap: .3rem; white-space: nowrap; }
    .add-to-cart-row .btn .icon { display: none; }

    /* Category chips: single horizontally-scrolling row instead of a jagged center-wrapped block */
    .category-chips {
        flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; -webkit-overflow-scrolling: touch;
        scrollbar-width: none; margin: 0 -1.5rem 2rem; padding: 0 1.5rem .3rem;
    }
    .category-chips::-webkit-scrollbar { display: none; }
    .category-chip { flex-shrink: 0; }

    /* Cart & order tables collapse to stacked cards */
    .cart-table thead { display: none; }
    .cart-table, .cart-table tbody, .cart-table tr, .cart-table td { display: block; width: 100%; }
    .cart-table tr { background: #fff; border-radius: var(--radius-md); margin-bottom: 1rem; padding: 1rem; box-shadow: var(--shadow-sm); }
    .cart-table td { border: none; padding: .4rem 0; }
    .cart-table td[data-label]::before { content: attr(data-label); display: block; font-size: .72rem; text-transform: uppercase; color: var(--text-light); font-weight: 700; margin-bottom: .2rem; }
    .cart-table td:first-child::before { content: none; }

    .data-table-responsive thead { display: none; }
    .data-table-responsive, .data-table-responsive tbody, .data-table-responsive tr, .data-table-responsive td { display: block; width: 100%; }
    .data-table-responsive tr { background: #fff; border-radius: var(--radius-md); margin-bottom: .9rem; padding: .9rem 1rem; box-shadow: var(--shadow-sm); }
    .data-table-responsive td { border: none; padding: .35rem 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem 1rem; }
    .data-table-responsive td[data-label]::before { content: attr(data-label); font-size: .72rem; text-transform: uppercase; color: var(--text-light); font-weight: 700; }

    /* Dashboard: filter bar fields and login card go full-width, sidebar spacing tightens */
    .filter-bar { flex-direction: column; align-items: stretch; }
    .filter-bar select, .filter-bar input, .filter-bar button { width: 100%; }
    .login-card { padding: 1.8rem 1.4rem; }
}

@media (max-width: 480px) {
    .container { padding: 0 1.1rem; }
    .category-chips { margin: 0 -1.1rem 1.6rem; padding: 0 1.1rem .3rem; }
    .section { padding: 2.6rem 0; }
    .books-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .8rem; }
    .book-info { padding: .65rem .7rem .75rem; }
    .toast-stack { top: auto; bottom: 1rem; right: 1rem; left: 1rem; width: auto; }
}
