/* ==========================================================================
   Vivekananda Book World - Design System & Custom Stylesheet
   Theme: Ramakrishna Mission Modernized Saffron & Maroon Palette
   ========================================================================== */

/* --- IMPORT GOOGLE FONTS --- */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@500;700&family=Inter:wght@300;400;500;600;700&family=Playfair+Display:ital,wght@0,600;0,700;1,400&display=swap');

/* --- DESIGN TOKENS (VARIABLES) --- */
:root {
    --primary: #e65100;         /* Traditional Deep Saffron */
    --primary-light: #ff8038;
    --primary-dark: #b22a00;
    --accent: #f47b20;          /* Vibrant Orange */
    --dark-maroon: #5d1117;     /* Classic RKM Emblem Maroon */
    --dark-maroon-hover: #450c10;
    --gold: #d4af37;            /* Elegant Accent Gold */
    --bg-light: #f5f6f8;        /* Soft Clean Gray */
    --bg-card: #ffffff;         /* Pure White */
    --text-main: #2b3a4a;       /* Slate Dark for readability */
    --text-muted: #6b7c93;      /* Muted Slate Gray */
    --text-white: #ffffff;
    --border: #e2e8f0;          /* Subtle Slate Border */
    --border-focus: #ff8038;
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 10px 20px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 20px 40px rgba(93, 17, 23, 0.1);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-heading: 'Playfair Display', serif;
    --font-sans: 'Inter', sans-serif;
    --font-emblem: 'Cinzel', serif;
}

/* --- BASE RESET & SETUP --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-light);
    color: var(--text-main);
    font-family: var(--font-sans);
    line-height: 1.6;
    overflow-x: hidden;
}

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

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

button, input, textarea, select {
    font-family: inherit;
}

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

/* --- HEADER SECTION --- */
header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 3px solid var(--primary);
    box-shadow: var(--shadow-sm);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-emblem {
    width: 50px;
    height: 50px;
    background: radial-gradient(circle, #fff 40%, var(--primary) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-emblem);
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--dark-maroon);
    border: 2px solid var(--gold);
    box-shadow: 0 0 10px rgba(230, 81, 0, 0.2);
}

.logo-text h1 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--dark-maroon);
    line-height: 1.2;
}

.logo-text span {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 0.5px;
    display: block;
    margin-top: 2px;
}

/* --- NAVIGATION --- */
nav ul {
    display: flex;
    list-style: none;
    gap: 24px;
    align-items: center;
}

nav ul li a {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    padding: 8px 4px;
    position: relative;
}

nav ul li a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary);
    transition: var(--transition);
}

nav ul li a:hover {
    color: var(--primary);
}

nav ul li a:hover::after, nav ul li a.active::after {
    width: 100%;
}

nav ul li a.active {
    color: var(--primary);
}

.btn-admin {
    background-color: var(--dark-maroon);
    color: white !important;
    padding: 8px 18px !important;
    border-radius: var(--radius-sm);
    font-weight: bold !important;
    box-shadow: 0 4px 6px rgba(93, 17, 23, 0.2);
}

.btn-admin:hover {
    background-color: var(--dark-maroon-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(93, 17, 23, 0.3);
}

.btn-admin::after {
    display: none !important;
}

.nav-cart-btn {
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.nav-cart-count {
    min-width: 20px;
    height: 20px;
    border-radius: 999px;
    background: var(--gold);
    color: var(--dark-maroon);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    font-size: 0.75rem;
    line-height: 1;
}

/* --- HERO SECTION --- */
.hero-banner {
    background: linear-gradient(135deg, rgba(93,17,23,0.92) 0%, rgba(230,81,0,0.85) 100%), 
                url('gallery/0G9A814848.webp') center/cover no-repeat;
    color: var(--text-white);
    padding: 100px 0 80px 0;
    text-align: center;
    position: relative;
    border-bottom: 5px solid var(--gold);
}

.hero-banner h2 {
    font-family: var(--font-heading);
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.hero-banner p {
    font-size: 1.25rem;
    max-width: 750px;
    margin: 0 auto 30px auto;
    font-weight: 300;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.9);
}

.hero-divider {
    width: 80px;
    height: 4px;
    background-color: var(--gold);
    margin: 0 auto 20px auto;
    border-radius: 2px;
}

/* --- STORE CONTAINER --- */
.store-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 40px;
    margin: 60px auto;
    align-items: start;
}

/* --- SIDEBAR FILTER --- */
.sidebar-filter {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 100px;
}

.filter-section {
    margin-bottom: 32px;
}

.filter-section:last-child {
    margin-bottom: 0;
}

.filter-section h4 {
    font-family: var(--font-sans);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--dark-maroon);
    border-left: 4px solid var(--primary);
    padding-left: 12px;
    margin-bottom: 18px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-section ul {
    list-style: none;
}

.filter-section ul li {
    margin-bottom: 12px;
}

.filter-section ul li a {
    font-size: 0.95rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
}

.filter-section ul li a span {
    background-color: var(--bg-light);
    color: var(--text-main);
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    transition: var(--transition);
}

.filter-section ul li a:hover, .filter-section ul li a.active {
    color: var(--primary);
    padding-left: 4px;
}

.filter-section ul li a.active span, .filter-section ul li a:hover span {
    background-color: var(--primary);
    color: white;
}

/* --- SEARCH & CONTROL BAR --- */
.store-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px 24px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-sm);
    gap: 20px;
    flex-wrap: wrap;
}

.search-wrapper {
    position: relative;
    flex: 1;
    min-width: 250px;
}

.search-wrapper i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.1rem;
}

.search-input {
    width: 100%;
    padding: 12px 16px 12px 46px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    transition: var(--transition);
    background-color: var(--bg-light);
    outline: none;
}

.search-input:focus {
    border-color: var(--border-focus);
    background-color: var(--bg-card);
    box-shadow: 0 0 0 3px rgba(230, 81, 0, 0.15);
}

.cart-status-btn {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 6px rgba(230, 81, 0, 0.2);
    transition: var(--transition);
}

.cart-status-btn:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(230, 81, 0, 0.3);
}

.search-action-btn {
    min-width: 118px;
    justify-content: center;
}

.cart-count-badge {
    background-color: var(--gold);
    color: var(--dark-maroon);
    font-size: 0.8rem;
    font-weight: 800;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- BOOKS GRID --- */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 30px;
}

.book-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.book-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(230, 81, 0, 0.3);
}

.book-image-wrapper {
    height: 240px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background-color: #f1f2f5;
    position: relative;
}

.book-image-wrapper img {
    height: 100%;
    width: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.book-card:hover .book-image-wrapper img {
    transform: scale(1.05);
}

/* --- PREMIUM CSS DYNAMIC BOOK COVERS --- */
.fallback-cover {
    width: 160px;
    height: 220px;
    border-radius: 4px 12px 12px 4px;
    position: relative;
    box-shadow: 5px 5px 15px rgba(0,0,0,0.3), inset 3px 0 6px rgba(255,255,255,0.2), inset -2px 0 6px rgba(0,0,0,0.4);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 16px;
    color: #f4d068; /* Goldish Text */
    overflow: hidden;
    border-left: 5px solid rgba(0, 0, 0, 0.4);
}

/* Color thematic variations for dynamic covers */
.cover-maroon { background: linear-gradient(135deg, #7c1a22 0%, #450c10 100%); }
.cover-saffron { background: linear-gradient(135deg, #e65100 0%, #a33900 100%); }
.cover-blue { background: linear-gradient(135deg, #0d47a1 0%, #082d66 100%); }
.cover-green { background: linear-gradient(135deg, #1b5e20 0%, #103813 100%); }

.fallback-cover::after {
    content: '';
    position: absolute;
    top: 0;
    left: 8px;
    width: 2px;
    height: 100%;
    background: rgba(255,255,255,0.06);
    box-shadow: 1px 0 3px rgba(0,0,0,0.2);
}

.fallback-cover-title {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.3;
    text-align: center;
    margin-top: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

.fallback-cover-author {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: center;
    margin-bottom: 10px;
    font-weight: 600;
    border-top: 1px solid rgba(244, 208, 104, 0.3);
    padding-top: 8px;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.5);
}

.book-tag {
    position: absolute;
    top: 12px;
    right: 12px;
    background-color: var(--gold);
    color: var(--dark-maroon);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    box-shadow: var(--shadow-sm);
    z-index: 10;
}

.book-title {
    font-family: var(--font-sans);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 6px;
    line-height: 1.4;
    min-height: 48px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-author {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 12px;
}

.book-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border);
    padding-top: 15px;
    margin-top: auto;
}

.book-price {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--dark-maroon);
}

.btn-add-cart {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 700;
    font-size: 0.85rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-add-cart:hover {
    background-color: var(--primary);
    color: white;
    transform: scale(1.03);
}

.no-books {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-muted);
}

.no-books i {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 15px;
}

/* --- SIDE CART DRAWER --- */
.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.cart-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.cart-drawer {
    position: fixed;
    top: 0;
    right: -420px;
    width: 100%;
    max-width: 420px;
    height: 100vh;
    background: var(--bg-card);
    box-shadow: -10px 0 30px rgba(0,0,0,0.15);
    z-index: 2001;
    display: flex;
    flex-direction: column;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.cart-overlay.open .cart-drawer {
    right: 0;
}

.cart-header {
    padding: 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--dark-maroon);
    color: white;
}

.cart-header h3 {
    font-family: var(--font-sans);
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-close-cart {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px;
}

.cart-items-list {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.cart-item {
    display: flex;
    gap: 16px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
    margin-bottom: 16px;
    align-items: center;
}

.cart-item-details {
    flex: 1;
}

.cart-item-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-main);
    line-height: 1.3;
    margin-bottom: 4px;
}

.cart-item-price {
    font-weight: 700;
    color: var(--primary);
    font-size: 0.9rem;
}

.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
}

.qty-btn {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-light);
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: var(--transition);
}

.qty-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.qty-val {
    font-weight: 700;
    font-size: 0.9rem;
}

.btn-remove-item {
    background: transparent;
    border: none;
    color: #e53935;
    cursor: pointer;
    font-size: 1rem;
    padding: 6px;
    border-radius: 4px;
    transition: var(--transition);
}

.btn-remove-item:hover {
    background-color: #ffebee;
}

.cart-footer {
    padding: 24px;
    border-top: 1px solid var(--border);
    background: var(--bg-light);
}

.cart-total-bar {
    display: flex;
    justify-content: space-between;
    font-size: 1.2rem;
    font-weight: 800;
    margin-bottom: 20px;
    color: var(--dark-maroon);
}

.btn-whatsapp-checkout {
    width: 100%;
    background-color: #25d366; /* WhatsApp Green */
    color: white;
    border: none;
    padding: 16px;
    border-radius: var(--radius-sm);
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 10px rgba(37, 211, 102, 0.3);
    transition: var(--transition);
    text-decoration: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    touch-action: manipulation;
}

.btn-whatsapp-checkout[aria-disabled="true"] {
    opacity: 0.72;
}

.btn-whatsapp-checkout:hover {
    background-color: #1ebd59;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(37, 211, 102, 0.4);
}

.empty-cart-msg {
    text-align: center;
    color: var(--text-muted);
    padding-top: 40px;
}

.empty-cart-msg i {
    font-size: 4rem;
    color: #e0e0e0;
    margin-bottom: 15px;
}

/* --- BOOK PREVIEW MODAL --- */
.book-preview-overlay {
    position: fixed;
    inset: 0;
    z-index: 2600;
    background: rgba(17, 17, 17, 0.72);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.book-preview-overlay.open {
    display: flex;
}

.book-preview-modal {
    position: relative;
    width: min(940px, 100%);
    max-height: min(88vh, 760px);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: grid;
    grid-template-columns: minmax(260px, 360px) 1fr;
    overflow: hidden;
}

.book-preview-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(17, 17, 17, 0.72);
    color: white;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
}

.book-preview-media {
    background: #f1f2f5;
    min-height: 420px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px;
}

.book-preview-media img {
    width: 100%;
    max-height: 560px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
}

.preview-fallback-cover {
    width: 210px;
    height: 310px;
}

.book-preview-details {
    padding: 34px;
    overflow-y: auto;
}

.preview-category {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    background: rgba(230, 81, 0, 0.1);
    color: var(--primary-dark);
    border-radius: 999px;
    padding: 5px 12px;
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    margin-bottom: 14px;
}

.book-preview-details h3 {
    font-family: var(--font-heading);
    color: var(--dark-maroon);
    font-size: 2rem;
    line-height: 1.18;
    margin-bottom: 10px;
}

.preview-author {
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 18px;
}

.preview-author a {
    color: var(--primary);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.preview-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.preview-meta span {
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-size: 0.9rem;
}

.preview-meta i {
    color: var(--primary);
    margin-right: 5px;
}

.preview-description {
    color: var(--text-main);
    line-height: 1.75;
    margin-bottom: 24px;
}

.preview-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.btn-preview-fullscreen {
    border: 2px solid var(--dark-maroon);
    color: var(--dark-maroon);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.preview-add-cart {
    background: var(--primary);
    color: white;
}

/* --- MEDIA GALLERY SECTION --- */
.gallery-section {
    background-color: var(--bg-card);
    padding: 80px 0;
    border-top: 1px solid var(--border);
}

.gallery-title {
    text-align: center;
    margin-bottom: 50px;
}

.gallery-title h3 {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    color: var(--dark-maroon);
    margin-bottom: 12px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.gallery-item {
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    background-color: var(--bg-light);
    aspect-ratio: 4 / 3;
    position: relative;
    cursor: pointer;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.gallery-item:hover img {
    transform: scale(1.08);
}

.gallery-overlay-hover {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(93, 17, 23, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
}

.gallery-item:hover .gallery-overlay-hover {
    opacity: 1;
}

.gallery-overlay-hover i {
    color: var(--gold);
    font-size: 2rem;
    transform: scale(0.8);
    transition: var(--transition);
}

.gallery-item:hover .gallery-overlay-hover i {
    transform: scale(1);
}

/* --- LIGHTBOX MODAL --- */
.lightbox-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
}

.lightbox-content {
    max-width: 90%;
    max-height: 85%;
    position: relative;
}

.lightbox-content img {
    max-height: 80vh;
    border: 4px solid white;
    border-radius: 4px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    color: white;
    font-size: 2rem;
    cursor: pointer;
}

.lightbox-prev, .lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 2.5rem;
    cursor: pointer;
    background: rgba(0,0,0,0.5);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    transition: var(--transition);
}

.lightbox-prev:hover, .lightbox-next:hover {
    background: var(--primary);
}

.lightbox-prev { left: -70px; }
.lightbox-next { right: -70px; }

@media(max-width: 768px) {
    .lightbox-prev { left: 10px; }
    .lightbox-next { right: 10px; }
}

/* --- FOOTER --- */
footer {
    background-color: #111111;
    color: #b0b0b0;
    padding: 60px 0 30px 0;
    border-top: 6px solid var(--primary);
    font-size: 0.95rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-col h3 {
    font-family: var(--font-sans);
    color: white;
    margin-bottom: 20px;
    font-size: 1.15rem;
    font-weight: 700;
    position: relative;
    padding-bottom: 10px;
}

.footer-col h3::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 50px;
    height: 2px;
    background-color: var(--gold);
}

.footer-col p {
    margin-bottom: 12px;
    line-height: 1.8;
}

.footer-col ul {
    list-style: none;
}

.footer-col ul li {
    margin-bottom: 10px;
}

.footer-col ul li a:hover {
    color: var(--primary-light);
    padding-left: 4px;
}

.footer-bottom {
    text-align: center;
    border-top: 1px solid #222;
    padding-top: 30px;
    font-size: 0.85rem;
    color: #666;
}

/* --- FLOATING SOCIAL MEDIA SIDEBAR --- */
.social-sidebar {
    position: fixed;
    right: 0;
    top: 40%;
    display: flex;
    flex-direction: column;
    z-index: 999;
}

.social-sidebar a {
    background-color: var(--primary);
    color: white;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    margin-bottom: 2px;
    border-top-left-radius: var(--radius-sm);
    border-bottom-left-radius: var(--radius-sm);
    box-shadow: -2px 2px 5px rgba(0,0,0,0.15);
}

.social-sidebar a:hover {
    width: 54px;
    background-color: var(--dark-maroon);
}

/* --- ADMIN LOGIN PAGE --- */
.login-body {
    background: linear-gradient(135deg, var(--dark-maroon) 0%, var(--primary) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    padding: 40px 32px;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header .emblem {
    width: 60px;
    height: 60px;
    margin: 0 auto 16px auto;
    font-size: 1.3rem;
}

.login-header h2 {
    font-family: var(--font-heading);
    color: var(--dark-maroon);
    font-size: 1.7rem;
    font-weight: 700;
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 4px;
}

.form-group {
    margin-bottom: 20px;
    position: relative;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    transition: var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(230, 81, 0, 0.15);
}

.btn-primary {
    width: 100%;
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 14px;
    font-size: 1rem;
    font-weight: 700;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 6px rgba(230, 81, 0, 0.2);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(230, 81, 0, 0.3);
}

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 20px;
    font-weight: 600;
    border-left: 4px solid;
}

.alert-danger {
    background-color: #ffebee;
    color: #c62828;
    border-color: #e53935;
}

.alert-success {
    background-color: #e8f5e9;
    color: #2e7d32;
    border-color: #4caf50;
}

/* --- ADMIN DASHBOARD PAGE --- */
.admin-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

.admin-sidebar {
    background-color: var(--dark-maroon);
    color: white;
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    border-right: 3px solid var(--gold);
}

.admin-sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
}

.admin-sidebar-logo .emblem {
    width: 40px;
    height: 40px;
    font-size: 0.9rem;
}

.admin-sidebar-logo h2 {
    font-size: 1rem;
    font-family: var(--font-heading);
    color: white;
    line-height: 1.2;
}

.admin-nav {
    list-style: none;
    flex: 1;
}

.admin-nav li {
    margin-bottom: 8px;
}

.admin-nav li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    transition: var(--transition);
}

.admin-nav li a:hover, .admin-nav li a.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--gold);
}

.admin-logout-btn {
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 20px;
}

.admin-content {
    background-color: var(--bg-light);
    padding: 40px;
    overflow-y: auto;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 20px;
}

.admin-header h1 {
    font-family: var(--font-heading);
    color: var(--dark-maroon);
    font-size: 2rem;
}

.admin-header-actions {
    display: flex;
    gap: 16px;
}

.btn-secondary {
    background-color: white;
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.btn-secondary:hover {
    background-color: var(--bg-light);
}

/* Dashboard Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.stat-card {
    background: white;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
}

.stat-info h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.stat-info p {
    font-size: 2rem;
    font-weight: 800;
    color: var(--dark-maroon);
    line-height: 1;
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-sm);
    background-color: rgba(230, 81, 0, 0.1);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

/* Admin Inventory Table */
.inventory-card {
    background: white;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.inventory-header {
    padding: 24px;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--dark-maroon);
}

.table-responsive {
    overflow-x: auto;
}

table.admin-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

table.admin-table th, table.admin-table td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}

table.admin-table th {
    background-color: #fafbfc;
    font-weight: 700;
    color: var(--text-main);
}

table.admin-table tr:hover td {
    background-color: #fafbfc;
}

.admin-book-thumb {
    width: 40px;
    height: 56px;
    background-color: var(--bg-light);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--border);
}

.admin-book-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.row-flex {
    display: flex;
    align-items: center;
    gap: 12px;
}

.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-featured {
    background-color: #fff8e1;
    color: #ffb300;
    border: 1px solid #ffe082;
}

.badge-standard {
    background-color: #f1f2f5;
    color: var(--text-muted);
}

.action-buttons {
    display: flex;
    gap: 8px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-icon:hover {
    background-color: var(--bg-light);
}

.btn-edit:hover {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-delete:hover {
    color: #e53935;
    border-color: #e53935;
}

/* Modals & Forms */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-card {
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 650px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 30px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
}

.modal-header h2 {
    font-family: var(--font-heading);
    color: var(--dark-maroon);
    font-size: 1.5rem;
}

.row-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.image-rotate-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 12px;
}

@media(max-width: 600px) {
    .row-grid-2 {
        grid-template-columns: 1fr;
    }

    .modal-card {
        padding-bottom: calc(88px + env(safe-area-inset-bottom));
    }

    .modal-actions {
        position: sticky;
        bottom: 0;
        z-index: 5;
        flex-shrink: 0;
        background: #fff;
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
    }

    .modal-actions .btn-primary,
    .modal-actions .btn-secondary,
    .image-rotate-controls .btn-secondary {
        width: 100%;
        min-height: 48px;
        justify-content: center;
    }
}

/* --- RESPONSIVE MEDIA QUERIES --- */
@media (max-width: 1024px) {
    .store-layout {
        grid-template-columns: 1fr;
    }
    .sidebar-filter {
        position: static;
    }
}

@media (max-width: 768px) {
    header {
        position: static;
    }
    .header-container {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }
    nav ul {
        flex-wrap: wrap;
        justify-content: center;
        gap: 16px;
    }
    .container {
        padding: 0 16px;
    }
    .store-layout {
        margin: 36px auto;
        gap: 24px;
    }
    .store-controls {
        padding: 14px;
        gap: 12px;
    }
    .search-wrapper {
        min-width: 100%;
    }
    .search-action-btn {
        width: 100%;
    }
    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 16px;
    }
    .book-card {
        padding: 14px;
    }
    .book-image-wrapper {
        height: 190px;
    }
    .book-title {
        font-size: 0.95rem;
        min-height: 42px;
    }
    .book-footer {
        align-items: stretch;
        gap: 10px;
        flex-direction: column;
    }
    .btn-add-cart {
        justify-content: center;
        width: 100%;
    }
    .cart-drawer {
        max-width: 100%;
    }
    .book-preview-overlay {
        padding: 10px;
        align-items: flex-end;
    }
    .book-preview-modal {
        grid-template-columns: 1fr;
        width: 100%;
        max-height: 92vh;
        border-radius: var(--radius-md) var(--radius-md) 0 0;
        overflow-y: auto;
    }
    .book-preview-media {
        min-height: 260px;
        padding: 18px 48px 18px 18px;
    }
    .book-preview-media img {
        max-height: 320px;
    }
    .book-preview-details {
        padding: 22px 18px 24px;
        overflow: visible;
    }
    .book-preview-details h3 {
        font-size: 1.45rem;
    }
    .preview-meta {
        grid-template-columns: 1fr;
    }
    .preview-actions {
        flex-direction: column;
        align-items: stretch;
    }
    .btn-preview-fullscreen {
        justify-content: center;
    }
    .hero-banner h2 {
        font-size: 2.2rem;
    }
    .hero-banner p {
        font-size: 1.05rem;
    }
    .admin-layout {
        grid-template-columns: 1fr;
    }
    .admin-sidebar {
        border-right: none;
        border-bottom: 3px solid var(--gold);
    }
    .admin-content {
        padding: 20px;
    }
}
