/* ── Reset & Variables ──────────────────────────────────────────── */
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
:root{
  --indigo:#4f46e5;--indigo-d:#4338ca;--indigo-l:#eef2ff;
  --teal:#0d9488;--amber:#d97706;--rose:#e11d48;
  --gray-50:#f9fafb;--gray-100:#f3f4f6;--gray-200:#e5e7eb;
  --gray-400:#9ca3af;--gray-500:#6b7280;--gray-700:#374151;--gray-900:#111827;
  --white:#fff;--shadow:0 1px 3px rgba(0,0,0,.1),0 1px 2px rgba(0,0,0,.06);
  --shadow-lg:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -2px rgba(0,0,0,.05);
  --radius:8px;--radius-lg:12px;
  --font-body:'Inter',sans-serif;--font-display:'Playfair Display',serif;
}
html{scroll-behavior:smooth}
body{font-family:var(--font-body);color:var(--gray-900);background:var(--gray-50);line-height:1.6;font-size:16px}
a{color:inherit;text-decoration:none}
img{max-width:100%;display:block}
ul{list-style:none}

/* ── Layout ─────────────────────────────────────────────────────── */
.container{max-width:1280px;margin:0 auto;padding:0 1.5rem}
.section{padding:5rem 0}
.section-title{font-family:var(--font-display);font-size:1.75rem;font-weight:700;margin-bottom:.5rem}
.section-sub{color:var(--gray-500);margin-bottom:2rem}
.flex{display:flex}.grid{display:grid}
.items-center{align-items:center}.justify-between{justify-content:space-between}
.gap-4{gap:1rem}.gap-6{gap:1.5rem}

/* ── Flash ──────────────────────────────────────────────────────── */
.site-flash{position:fixed;top:1rem;right:1rem;z-index:9999;padding:.875rem 1.25rem;border-radius:var(--radius);
  font-size:.9rem;font-weight:500;max-width:360px;display:flex;align-items:center;gap:.75rem;
  box-shadow:var(--shadow-lg)}
.site-flash--success{background:#d1fae5;color:#065f46;border:1px solid #6ee7b7}
.site-flash--error{background:#fee2e2;color:#991b1b;border:1px solid #fca5a5}
.site-flash--info{background:#dbeafe;color:#1e40af;border:1px solid #93c5fd}
.flash-close{margin-left:auto;background:none;border:none;cursor:pointer;font-size:1.1rem;opacity:.6}
.flash-close:hover{opacity:1}

/* ── Header ─────────────────────────────────────────────────────── */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  position: relative;
  z-index: 100;
  box-shadow: var(--shadow);
}
.site-header .container{display:flex;align-items:center;gap:2rem;height:64px}
.site-logo{font-family:var(--font-display);font-size:1.4rem;font-weight:700;
  color:var(--indigo);display:flex;align-items:center;gap:.5rem;white-space:nowrap}
.site-logo i{font-size:1.5rem}
.site-nav{display:flex;gap:.25rem;flex:1}
.site-nav a{padding:.4rem .75rem;border-radius:6px;font-size:.9rem;font-weight:500;
  color:var(--gray-700);transition:all .15s}
.site-nav a:hover,.site-nav a.active{background:var(--indigo-l);color:var(--indigo)}
.header-actions{display:flex;align-items:center;gap:.5rem;margin-left:auto}
.header-search{position:relative;display:flex;align-items:center}
.header-search input{padding:.45rem 2.5rem .45rem .85rem;border:1px solid var(--gray-200);
  border-radius:20px;font-size:.875rem;width:220px;background:var(--gray-50);
  transition:width .2s,border-color .2s}
.header-search input:focus{outline:none;border-color:var(--indigo);width:280px;background:var(--white)}
.header-search button{position:absolute;right:.6rem;background:none;border:none;
  color:var(--gray-400);cursor:pointer;font-size:.85rem}
.search-dropdown{position:absolute;top:calc(100%+6px);left:0;right:0;background:var(--white);
  border:1px solid var(--gray-200);border-radius:var(--radius);box-shadow:var(--shadow-lg);
  display:none;z-index:200;overflow:hidden;max-height:320px;overflow-y:auto}
.search-dropdown.open{display:block}
.search-item{display:flex;align-items:center;gap:.75rem;padding:.6rem .875rem;
  cursor:pointer;transition:background .1s;border-bottom:1px solid var(--gray-100)}
.search-item:hover{background:var(--indigo-l)}
.search-item:last-child{border-bottom:none}
.search-item img{width:32px;height:46px;object-fit:cover;border-radius:3px;flex-shrink:0}
.search-item-icon{width:32px;height:46px;background:var(--gray-100);border-radius:3px;
  display:flex;align-items:center;justify-content:center;color:var(--gray-400);flex-shrink:0}
.search-item-name{font-size:.85rem;font-weight:600;color:var(--gray-900)}
.search-item-sub{font-size:.75rem;color:var(--gray-500)}
.btn-header{padding:.4rem .8rem;border-radius:6px;font-size:.85rem;font-weight:500;
  color:var(--gray-700);transition:all .15s;border:1px solid transparent;cursor:pointer;
  display:inline-flex;align-items:center;gap:.35rem}
.btn-header:hover{background:var(--gray-100)}
.btn-header--primary{background:var(--indigo);color:var(--white);border-color:var(--indigo)}
.btn-header--primary:hover{background:var(--indigo-d);color:var(--white)}
.btn-header--admin{background:var(--gray-900);color:var(--white)}
.btn-header--admin:hover{background:var(--gray-700);color:var(--white)}
.nav-toggle{display:none;background:none;border:none;font-size:1.3rem;cursor:pointer;color:var(--gray-700)}

/* ── Hero ───────────────────────────────────────────────────────── */
.hero{background:linear-gradient(135deg,#312e81 0%,#4f46e5 50%,#7c3aed 100%);
  padding:5rem 0 4rem;text-align:center;color:var(--white);position:relative;overflow:hidden}
.hero::before{content:'';position:absolute;inset:0;
  background:url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E")}
.hero-content{position:relative;z-index:1}
.hero h1{font-family:var(--font-display);font-size:clamp(2rem,5vw,3.5rem);
  font-weight:700;line-height:1.15;margin-bottom:1rem;
  text-shadow:0 2px 4px rgba(0,0,0,.3)}
.hero p{font-size:1.125rem;opacity:.9;max-width:560px;margin:0 auto 2.5rem}
.hero-search{display:flex;max-width:560px;margin:0 auto 3rem;
  background:rgba(255,255,255,.12);backdrop-filter:blur(8px);
  border:1px solid rgba(255,255,255,.25);border-radius:50px;overflow:hidden;padding:4px}
.hero-search input{flex:1;border:none;background:transparent;color:var(--white);
  padding:.75rem 1.25rem;font-size:1rem;outline:none}
.hero-search input::placeholder{color:rgba(255,255,255,.7)}
.hero-search button{background:var(--white);color:var(--indigo);border:none;
  padding:.75rem 1.75rem;border-radius:44px;font-weight:600;cursor:pointer;
  font-size:.95rem;transition:all .15s;white-space:nowrap}
.hero-search button:hover{background:var(--indigo-l)}
.hero-stats{display:flex;justify-content:center;gap:3rem;flex-wrap:wrap}
.hero-stat-num{font-size:2rem;font-weight:700;font-family:var(--font-display)}
.hero-stat-label{font-size:.875rem;opacity:.8;margin-top:.15rem}

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn{display:inline-flex;align-items:center;gap:.4rem;padding:.6rem 1.25rem;
  border-radius:var(--radius);font-weight:500;font-size:.9rem;
  cursor:pointer;transition:all .15s;border:none;text-decoration:none}
.btn-primary{background:var(--indigo);color:var(--white)}
.btn-primary:hover{background:var(--indigo-d);color:var(--white)}
.btn-secondary{background:var(--gray-100);color:var(--gray-700);border:1px solid var(--gray-200)}
.btn-secondary:hover{background:var(--gray-200)}
.btn-outline{background:transparent;color:var(--indigo);border:1px solid var(--indigo)}
.btn-outline:hover{background:var(--indigo-l)}
.btn-danger{background:#fee2e2;color:var(--rose);border:1px solid #fecaca}
.btn-danger:hover{background:var(--rose);color:var(--white)}
.btn-sm{padding:.35rem .75rem;font-size:.8rem}
.btn-lg{padding:.875rem 2rem;font-size:1rem}
.btn:disabled{opacity:.5;cursor:not-allowed}

/* ── Book Cards ──────────────────────────────────────────────────── */
.books-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:1.5rem}
.book-card{background:var(--white);border-radius:var(--radius-lg);
  box-shadow:var(--shadow);overflow:hidden;transition:transform .2s,box-shadow .2s;
  display:flex;flex-direction:column}
.book-card:hover{transform:translateY(-4px);box-shadow:var(--shadow-lg)}
.book-cover{aspect-ratio:2/3;overflow:hidden;background:var(--gray-100);position:relative}
.book-cover img{width:100%;height:100%;object-fit:cover;transition:transform .3s}
.book-card:hover .book-cover img{transform:scale(1.04)}
.book-badge{position:absolute;top:.5rem;left:.5rem;background:var(--indigo);color:var(--white);
  font-size:.65rem;font-weight:600;padding:.2rem .5rem;border-radius:4px;text-transform:uppercase}
.book-overlay{position:absolute;inset:0;background:rgba(0,0,0,.7);
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.5rem;
  opacity:0;transition:opacity .2s}
.book-card:hover .book-overlay{opacity:1}
.book-overlay a{display:flex;align-items:center;gap:.4rem;padding:.5rem 1rem;
  border-radius:6px;font-size:.8rem;font-weight:600;text-decoration:none}
.book-overlay .btn-read{background:var(--white);color:var(--indigo)}
.book-overlay .btn-dl{background:rgba(255,255,255,.15);color:var(--white);border:1px solid rgba(255,255,255,.4)}
.book-body{padding:.875rem;flex:1;display:flex;flex-direction:column;gap:.25rem}
.book-title{font-weight:600;font-size:.9rem;line-height:1.3;
  display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.book-author{font-size:.78rem;color:var(--gray-500)}
.book-meta{display:flex;align-items:center;gap:.5rem;margin-top:auto;padding-top:.5rem;flex-wrap:wrap}
.book-cat{font-size:.7rem;background:var(--indigo-l);color:var(--indigo);
  padding:.15rem .45rem;border-radius:4px;font-weight:500}
.book-dl-count{font-size:.72rem;color:var(--gray-400);margin-left:auto}
.no-cover{width:100%;height:100%;display:flex;align-items:center;justify-content:center;
  background:linear-gradient(135deg,var(--indigo-l),#c7d2fe);color:var(--indigo);font-size:3rem}

/* ── Category cards ─────────────────────────────────────────────── */
.cats-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(140px,1fr));gap:1rem}
.cat-card{background:var(--white);border-radius:var(--radius);padding:1.25rem .75rem;
  text-align:center;box-shadow:var(--shadow);transition:all .2s;border-top:3px solid var(--indigo);cursor:pointer}
.cat-card:hover{transform:translateY(-3px);box-shadow:var(--shadow-lg)}
.cat-card i{font-size:1.75rem;color:var(--indigo);margin-bottom:.5rem}
.cat-card span{display:block;font-size:.85rem;font-weight:600;color:var(--gray-700)}
.cat-count{font-size:.72rem;color:var(--gray-400);margin-top:.2rem}

/* ── Section headers ────────────────────────────────────────────── */
.sec-header{display:flex;align-items:flex-end;justify-content:space-between;margin-bottom:1.75rem;flex-wrap:wrap;gap:.5rem}
.sec-header-left h2{font-family:var(--font-display);font-size:1.5rem;font-weight:700}
.sec-header-left p{color:var(--gray-500);font-size:.875rem;margin-top:.15rem}
.view-all{font-size:.875rem;color:var(--indigo);font-weight:500;
  display:flex;align-items:center;gap:.3rem}
.view-all:hover{color:var(--indigo-d)}

/* ── Book detail page ───────────────────────────────────────────── */
.book-detail{padding:3rem 0}
.book-detail-grid{display:grid;grid-template-columns:240px 1fr;gap:3rem;align-items:start}
.book-detail-cover{border-radius:var(--radius-lg);overflow:hidden;box-shadow:var(--shadow-lg)}
.book-detail-cover img{width:100%;aspect-ratio:2/3;object-fit:cover}
.book-detail-title{font-family:var(--font-display);font-size:2rem;font-weight:700;line-height:1.2;margin-bottom:.5rem}
.book-detail-author{font-size:1.1rem;color:var(--gray-500);margin-bottom:1.5rem}
.book-detail-meta{display:flex;flex-wrap:wrap;gap:.75rem;margin-bottom:2rem}
.book-meta-item{background:var(--gray-100);padding:.35rem .75rem;border-radius:6px;font-size:.85rem;color:var(--gray-700)}
.book-detail-actions{display:flex;gap:.75rem;flex-wrap:wrap;margin-bottom:2rem}
.book-detail-desc{font-size:.95rem;line-height:1.75;color:var(--gray-700)}
.book-detail-desc h3{font-size:1.1rem;font-weight:600;margin-bottom:.75rem}
.ratings{display:flex;align-items:center;gap:.5rem;margin-bottom:1.5rem}
.stars{color:var(--amber);font-size:1.1rem}
.rating-num{font-size:.9rem;color:var(--gray-500)}

/* ── Search & Browse ────────────────────────────────────────────── */
.search-header{background:linear-gradient(135deg,#312e81,#4f46e5);color:var(--white);padding:3rem 0}
.search-header h1{font-family:var(--font-display);font-size:1.75rem;margin-bottom:1rem}
.search-form-lg{display:flex;gap:.5rem;max-width:600px}
.search-form-lg input{flex:1;padding:.75rem 1rem;border:1px solid rgba(255,255,255,.25);
  background:rgba(255,255,255,.12);color:var(--white);border-radius:var(--radius);font-size:1rem}
.search-form-lg input::placeholder{color:rgba(255,255,255,.6)}
.search-form-lg input:focus{outline:none;border-color:var(--white)}
.search-form-lg button{padding:.75rem 1.5rem;background:var(--white);color:var(--indigo);
  border:none;border-radius:var(--radius);font-weight:600;cursor:pointer}
.filters-bar{background:var(--white);border-bottom:1px solid var(--gray-200);padding:1rem 0;
  position:sticky;top:64px;z-index:50}
.filters-inner{display:flex;gap:.75rem;align-items:center;flex-wrap:wrap}
.filter-select{padding:.4rem .75rem;border:1px solid var(--gray-200);border-radius:6px;
  font-size:.875rem;color:var(--gray-700);background:var(--white);cursor:pointer}
.filter-select:focus{outline:none;border-color:var(--indigo)}
.results-count{margin-left:auto;font-size:.875rem;color:var(--gray-500)}

/* ── Pagination ─────────────────────────────────────────────────── */
.pagination{display:flex;justify-content:center;gap:.35rem;padding:2rem 0;flex-wrap:wrap}
.page-btn{padding:.45rem .85rem;border-radius:6px;font-size:.875rem;font-weight:500;
  color:var(--gray-700);background:var(--white);border:1px solid var(--gray-200);cursor:pointer;transition:all .15s}
.page-btn:hover{background:var(--indigo-l);border-color:var(--indigo);color:var(--indigo)}
.page-btn.active{background:var(--indigo);color:var(--white);border-color:var(--indigo)}
.page-btn:disabled{opacity:.4;cursor:not-allowed}

/* ── Auth Forms ─────────────────────────────────────────────────── */
.auth-wrap{min-height:calc(100vh - 64px);display:flex;align-items:center;
  justify-content:center;padding:2rem;background:var(--gray-50)}
.auth-card{background:var(--white);border-radius:var(--radius-lg);box-shadow:var(--shadow-lg);
  padding:2.5rem;width:100%;max-width:440px}
.auth-logo{text-align:center;margin-bottom:2rem}
.auth-logo i{font-size:2.5rem;color:var(--indigo)}
.auth-logo h1{font-family:var(--font-display);font-size:1.5rem;margin-top:.5rem}
.auth-logo p{color:var(--gray-500);font-size:.875rem}
.form-group{margin-bottom:1.25rem}
.form-label{display:block;font-size:.875rem;font-weight:500;color:var(--gray-700);margin-bottom:.4rem}
.form-control{width:100%;padding:.65rem .875rem;border:1px solid var(--gray-200);
  border-radius:var(--radius);font-size:.9rem;color:var(--gray-900);background:var(--white);
  transition:border-color .15s}
.form-control:focus{outline:none;border-color:var(--indigo);box-shadow:0 0 0 3px rgba(79,70,229,.1)}
.form-control.is-invalid{border-color:var(--rose)}
.form-hint{font-size:.78rem;color:var(--gray-500);margin-top:.3rem}
.form-error{font-size:.78rem;color:var(--rose);margin-top:.3rem}
.form-check{display:flex;align-items:center;gap:.5rem;font-size:.875rem}
.auth-footer{text-align:center;margin-top:1.5rem;font-size:.875rem;color:var(--gray-500)}
.auth-footer a{color:var(--indigo);font-weight:500}
.password-toggle{position:relative}
.password-toggle .form-control{padding-right:2.5rem}
.password-toggle .toggle-btn{position:absolute;right:.75rem;top:50%;transform:translateY(-50%);
  background:none;border:none;color:var(--gray-400);cursor:pointer}

/* ── Reader ─────────────────────────────────────────────────────── */
.reader-wrap{max-width:720px;margin:0 auto;padding:2rem 1.5rem}
.reader-controls{display:flex;justify-content:space-between;align-items:center;
  padding:1rem;background:var(--white);border-radius:var(--radius);
  box-shadow:var(--shadow);margin-bottom:2rem;flex-wrap:wrap;gap:.5rem;
  position:sticky;top:64px;z-index:50}
.reader-font-controls{display:flex;align-items:center;gap:.5rem}
.reader-font-btn{padding:.3rem .6rem;background:var(--gray-100);border:1px solid var(--gray-200);
  border-radius:4px;cursor:pointer;font-size:.85rem;transition:all .15s}
.reader-font-btn:hover{background:var(--indigo-l);border-color:var(--indigo)}
.reader-content{background:var(--white);border-radius:var(--radius-lg);
  padding:3rem 3.5rem;box-shadow:var(--shadow);font-size:1.1rem;line-height:1.9;
  color:#1e293b}
.reader-content h1,.reader-content h2,.reader-content h3{
  font-family:var(--font-display);margin:2rem 0 .75rem;color:var(--gray-900)}
.reader-content p{margin-bottom:1.25rem}
.reader-content blockquote{border-left:4px solid var(--indigo);padding:.5rem 0 .5rem 1.25rem;
  color:var(--gray-500);font-style:italic;margin:1.5rem 0}
.reader-theme-sepia{background:#f5f0e8 !important;color:#433422 !important}
.reader-theme-dark{background:#1e293b !important;color:#e2e8f0 !important}

/* ── Newsletter ─────────────────────────────────────────────────── */
.newsletter-section { background: var(--indigo); padding: 4rem 0; margin-bottom: 4rem; }
.newsletter-wrap { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 2rem; }
.newsletter-text { color: #fff; max-width: 500px; }
.newsletter-text h3 { font-size: 1.75rem; font-weight: 800; margin-bottom: 0.5rem; color: #fff; }
.newsletter-text p { font-size: 1rem; opacity: 0.9; color: #fff; margin:0; line-height: 1.5; }
.newsletter-form { display: flex; gap: 0.5rem; flex-grow: 1; max-width: 450px; }
.newsletter-form input { flex-grow: 1; padding: 1rem 1.5rem; border-radius: 10px; border: none; font-size: 1rem; }
.newsletter-form input:focus { outline:none; box-shadow: 0 0 0 3px rgba(255,255,255,0.3); }
.newsletter-form button { background: #111827; color: #fff; border: none; padding: 1rem 2rem; border-radius: 10px; font-weight: 700; cursor: pointer; transition: background 0.2s; white-space: nowrap; }
.newsletter-form button:hover { background: #1f2937; }

/* ── Footer ─────────────────────────────────────────────────────── */
.site-footer { background: #f9fafb; border-top: 1px solid #e5e7eb; padding: 0 0 2rem; margin-top: 5rem; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 3rem; margin-bottom: 3rem; }
.footer-brand { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; color: var(--indigo); display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1.5rem; }
.footer-brand img { height: 40px; width: auto; }
.footer-brand i { color: var(--indigo); }
.footer-desc { font-size: 0.875rem; line-height: 1.7; color: #6b7280; max-width: 320px; margin-bottom: 2rem; }
.footer-social { display: flex; gap: 1.25rem; }
.footer-social a { color: #9ca3af; font-size: 1.25rem; transition: color 0.15s; }
.footer-social a:hover { color: var(--indigo); }
.footer-col h4 { font-size: 1rem; font-weight: 600; color: #111827; margin-bottom: 1.5rem; text-transform: uppercase; letter-spacing: 0.05em; }
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col ul li { margin-bottom: 0.75rem; }
.footer-col ul a { font-size: 0.875rem; color: #6b7280; text-decoration: none; transition: color 0.15s; }
.footer-col ul a:hover { color: var(--indigo); }
.footer-bottom { border-top: 1px solid #e5e7eb; padding-top: 2rem; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; }
.footer-bottom p, .footer-bottom span { color: #9ca3af; font-size: 0.875rem; }

/* Typography Enhancements */
h1, h2, h3, h4 { letter-spacing: -0.02em; }
p { color: var(--gray-700); }

/* Custom Scrollbar */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--gray-100); }
::-webkit-scrollbar-thumb { background: var(--gray-400); border-radius: 5px; border: 2px solid var(--gray-100); }
::-webkit-scrollbar-thumb:hover { background: var(--gray-500); }

/* ── Ad units ───────────────────────────────────────────────────── */
.ad-unit{text-align:center;padding:1rem 0;overflow:hidden}
.ad-unit.ad-header{border-bottom:1px solid var(--gray-200);background:var(--white)}
.ad-unit.ad-sidebar{margin-bottom:1.5rem}

/* ── Additional Touch-ups ────────────────────────────────────────── */
.btn-back-to-top { position: fixed; bottom: 2rem; right: 2rem; width: 50px; height: 50px; background: var(--indigo); color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.25rem; cursor: pointer; box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); transition: all 0.3s ease; opacity: 0; visibility: hidden; z-index: 1000; border: none; }
.btn-back-to-top.show { opacity: 1; visibility: visible; transform: translateY(0); }
.btn-back-to-top:hover { background: var(--indigo-d); transform: translateY(-5px); }


/* ── Auth Button Visibility Logic ───────────────────────────────── */
/* 1. Default Desktop View */
.desktop-auth { 
  display: flex; 
  align-items: center; 
  gap: .5rem; 
}

/* 2. Hide mobile buttons strictly on screens wider than 768px */
@media (min-width: 769px) {
  .nav-mobile-auth { 
    display: none !important; 
  }
}

/* 3. Mobile View overrides (screens smaller than 768px) */
@media (max-width: 768px) {
  /* Hide standard buttons in the header */
  .desktop-auth { 
    display: none !important; 
  }
  
  /* Show buttons inside the mobile dropdown */
  .nav-mobile-auth { 
    display: flex !important; 
    flex-direction: column; 
    gap: .25rem; 
    margin-top: .5rem;
  }
  
  .nav-divider { 
    height: 1px; 
    background: var(--gray-200); 
    margin: .5rem 0; 
  }
  
  .nav-mobile-auth a {
    display: flex !important;
    align-items: center;
    gap: .75rem;
    padding: .75rem 1rem !important;
  }
  
  .nav-mobile-auth i {
    color: var(--gray-500);
    width: 20px;
    text-align: center;
  }
  
  .nav-mobile-auth .mobile-btn-primary {
    background: var(--indigo) !important;
    color: var(--white) !important;
    justify-content: center;
    margin-top: .75rem;
    border-radius: var(--radius) !important;
  }
  
  .nav-mobile-auth .mobile-btn-primary i {
    color: var(--white);
  }
  
  .nav-mobile-auth .mobile-btn-primary:hover {
    background: var(--indigo-d) !important;
  }
}


/* ── Responsive ─────────────────────────────────────────────────── */
@media(max-width:1024px){
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media(max-width:768px){
  .site-nav {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--white);
    border-top: 1px solid var(--gray-200); /* Adds visual separation */
    border-bottom: 1px solid var(--gray-200);
    flex-direction: column;
    padding: 1rem;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    z-index: 1000; /* CRITICAL: Forces menu above all other content */
  }
  
  .site-nav.open {
    display: flex;
  }
  
  .nav-toggle {
    display: block;
  }

  .header-search input{width:160px}
  .header-search input:focus{width:200px}
  .book-detail-grid{grid-template-columns:1fr}
  .book-detail-cover{max-width:220px;margin:0 auto}
  .reader-content{padding:1.5rem}
  .hero h1{font-size:1.75rem}
  .hero-stats{gap:1.5rem}
  
  /* Footer & Newsletter Mobile Fixes */
  .footer-grid { grid-template-columns: 1fr; gap: 2.5rem; text-align: center; }
  .footer-brand { justify-content: center; }
  .footer-desc { margin: 0 auto 1.5rem; }
  .footer-social { justify-content: center; }
  .footer-bottom { flex-direction: column; justify-content: center; text-align: center; }
  
  .newsletter-wrap { flex-direction: column; text-align: center; }
  .newsletter-text { max-width: 100%; }
  .newsletter-form { flex-direction: column; max-width: 100%; width: 100%; }
  .newsletter-form input, .newsletter-form button { width: 100%; }
}

@media(max-width:480px){
  .books-grid{grid-template-columns:repeat(2,1fr);gap:1rem}
  .hero-search{flex-direction:column;border-radius:var(--radius-lg);padding:.5rem}
  .hero-search input{text-align:center}
}