:root {
  --bg: #070d1f;
  --bg-elevated: rgba(9, 15, 36, 0.9);
  --bg-soft: rgba(255, 255, 255, 0.05);
  --bg-soft-2: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #eef2ff;
  --muted: rgba(238, 242, 255, 0.72);
  --accent: #6366f1;
  --accent-2: #8b5cf6;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --shadow-glow: 0 0 24px rgba(99, 102, 241, 0.35);
  --shadow-deep: 0 28px 60px rgba(0, 0, 0, 0.45);
  --auth-brand-bg-start: rgba(12, 24, 58, 0.98);
  --auth-brand-bg-end: rgba(10, 35, 88, 0.98);
  --auth-brand-text: #eef2ff;
  --auth-brand-muted: rgba(238, 242, 255, 0.72);
  --auth-brand-border: rgba(255, 255, 255, 0.08);
  --auth-brand-graphic-bg: rgba(255, 255, 255, 0.08);
  --auth-brand-graphic-border: rgba(255, 255, 255, 0.12);
  --popup-bg: color-mix(in srgb, var(--bg-elevated) 96%, var(--bg) 4%);
  --popup-border: var(--border);
  --toast-bg: rgba(8, 13, 31, 0.92);
  --toast-border: rgba(255, 255, 255, 0.08);
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --transition-standard: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --font-body: 'Inter', system-ui, sans-serif;
  --font-heading: 'Syne', var(--font-body);
  --font-mono: 'JetBrains Mono', monospace;
}

html[data-theme='light'] {
  --bg: #eef2ff;
  --bg-elevated: rgba(255, 255, 255, 0.9);
  --bg-soft: rgba(15, 23, 42, 0.04);
  --bg-soft-2: rgba(15, 23, 42, 0.08);
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.16);
  --text: #081024;
  --muted: rgba(8, 16, 36, 0.68);
  --shadow-deep: 0 28px 60px rgba(15, 23, 42, 0.14);
  --auth-brand-bg-start: rgba(229, 239, 255, 0.98);
  --auth-brand-bg-end: rgba(214, 229, 255, 0.98);
  --auth-brand-text: #081024;
  --auth-brand-muted: rgba(8, 16, 36, 0.72);
  --auth-brand-border: rgba(15, 23, 42, 0.08);
  --auth-brand-graphic-bg: rgba(15, 23, 42, 0.06);
  --auth-brand-graphic-border: rgba(15, 23, 42, 0.08);
  --popup-bg: rgba(255, 255, 255, 0.98);
  --popup-border: rgba(15, 23, 42, 0.1);
  --toast-bg: rgba(255, 255, 255, 0.98);
  --toast-border: rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 4.5rem;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 15px;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

/* layout: make footer sticky and main expand */
body {
  display: flex;
  flex-direction: column;
}

main#app {
  flex: 1 1 auto;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top, rgba(99, 102, 241, 0.22), transparent 34%), linear-gradient(180deg, var(--bg) 0%, var(--bg) 100%);
  pointer-events: none;
  z-index: -1;
}

html[data-theme='light'] body::before {
  background: radial-gradient(circle at top, rgba(99, 102, 241, 0.06), transparent 34%), linear-gradient(180deg, #f0f4ff 0%, #eef2ff 100%);
}

body, button, input, textarea, select {
  transition: var(--transition-standard);
}

/* Smooth scroll for all scrollable containers */
.mobile-menu,
.drawer,
.cart-drawer,
main,
.page,
.section,
[role="dialog"],
.modal-card {
  scroll-behavior: smooth;
}

/* Smooth scroll utility classes */
.smooth-scroll {
  scroll-behavior: smooth;
}

a {
  color: inherit;
  text-decoration: none;
}

button, input, textarea, select {
  font: inherit;
}

button {
  cursor: pointer;
}

img {
  max-width: 100%;
  display: block;
}

.bg-orb {
  position: fixed;
  inset: auto;
  border-radius: 999px;
  filter: blur(40px);
  opacity: 0.35;
  pointer-events: none;
}

.bg-orb-a {
  width: 22rem;
  height: 22rem;
  top: -8rem;
  right: -6rem;
  background: rgba(99, 102, 241, 0.55);
}

.bg-orb-b {
  width: 28rem;
  height: 28rem;
  bottom: -10rem;
  left: -9rem;
  background: rgba(14, 165, 233, 0.28);
}

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.06;
  background-image: linear-gradient(rgba(255, 255, 255, 0.5) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.5) 1px, transparent 1px);
  background-size: 72px 72px;
  mix-blend-mode: soft-light;
}

.glass {
  background: var(--bg-soft);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-deep);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  margin: 1rem;
  border-radius: 20px;
  background: color-mix(in srgb, var(--bg-elevated) 72%, var(--bg) 28%);
}

/* Header layout: left (logo), center (search + nav), right (actions) */
.topbar-left{display:flex;align-items:center;gap:0.75rem;min-width:0;flex:0 0 auto}
.topbar-center{display:flex;flex-direction:row;align-items:center;min-width:0;flex:1 1 auto;gap:1rem}
.topbar-right{display:flex;align-items:center;gap:0.75rem;flex:0 0 auto}

.site-logo{display:block;height:48px;width:48px;border-radius:50%;object-fit:cover;object-position:center}

.footer-logo{display:block;height:48px;width:48px;border-radius:50%;object-fit:cover;object-position:center;margin-right:0.6rem}

.site-name {
  display: inline-flex;
  flex-direction: column;
  font-family: var(--font-heading);
  font-size: clamp(0.98rem, 1.5vw, 1.18rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  gap: 0.15rem;
}

.site-name strong {
  display: block;
  font-size: 1rem;
}

.site-name small {
  display: block;
  color: var(--muted);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.24em;
}

.header-search{display:flex;align-items:center;gap:0.5rem;flex:1 1 58%;min-width:220px;max-width:820px;width:auto}
.header-search input{min-width:0;padding:0.85rem 1rem;border-radius:999px;border:1px solid var(--border);background:transparent}
.topnav{flex:0 0 auto;white-space:nowrap;margin-left:1rem;display:flex;align-items:center;gap:1rem}
.topbar-center .topnav{margin-left:0.5rem}

/* compact nav link style */
.topnav a{padding:0.45rem 0.6rem;border-radius:8px;font-size:0.95rem}

/* right area spacing */
.topbar-right .icon-button{padding:0.45rem 0.6rem;border-radius:10px}

@media (max-width: 980px) {
  .topbar {padding-inline: 0.9rem}
  .header-search{flex:1 1 65%}
}

/* Strong mobile overrides appended to ensure precedence */
@media (max-width: 700px) {
  .topbar { padding: 0.5rem !important; margin: 0.6rem !important; }
  .topbar-left { gap: 0.5rem; }
  .topbar-center { order: 2; width: 100% !important; display: block !important; }
  .header-search { display: flex !important; width: calc(100% - 24px) !important; max-width: none !important; padding: 0.3rem 0 !important; box-shadow: none !important; }
  .header-search input { padding: 0.5rem 0.75rem !important; font-size: 0.95rem !important; }
  .header-search button { padding: 0.45rem 0.7rem !important; font-size: 0.9rem !important; }
  .topbar-right { order: 3; display: flex; gap: 0.5rem; justify-content: flex-end; }
  .topnav { display: none !important; }
  .nav-toggle { display: inline-flex !important; }
  .site-logo { height: 42px !important; }
  .site-name { max-width: none !important; font-size: 0.85rem; font-weight: 700; overflow: visible; text-overflow: clip; white-space: normal; }
  .site-name strong { font-size: 0.85rem; font-weight: 700; white-space: normal; overflow: visible; text-overflow: clip; }
  .site-name small { font-size: 0.58rem; white-space: normal; overflow: visible; text-overflow: clip; }
}

/* Extra aggressive overrides to ensure search doesn't expand beyond header on mobile */
@media (max-width: 700px) {
  .topbar-center { display: block !important; align-items: stretch !important; }
  .topbar-center .topnav { display: none !important; }
  .header-search { width: 100% !important; margin: 0 auto !important; padding: 0.25rem 0 !important; }
  .header-search input { flex: 1 1 auto !important; min-width: 0 !important; max-width: none !important; }
  .header-search button { white-space: nowrap !important; }
  /* ensure header elements stack vertically and the brand sits on its own line */
  .topbar-left { width: 100%; display: flex; justify-content: space-between; align-items: center; }
  .brand { flex: 0 0 auto; }
}


@media (max-width: 700px) {
  .topbar{flex-direction:column;align-items:stretch;gap:0.5rem;padding:0.6rem}
  .topbar-left, .topbar-right{display:flex;justify-content:space-between}
  .topbar-center{flex-direction:column;gap:0.5rem}
  .topnav{justify-content:center;margin-left:0;gap:0.6rem}
  .site-logo{height:42px}
  .site-name{font-size:0.85rem;font-weight:700;max-width:none !important;white-space:normal;overflow:visible;text-overflow:clip}
  .site-name strong{white-space:normal;overflow:visible;text-overflow:clip}
  .site-name small{white-space:normal;overflow:visible;text-overflow:clip}
}

/* reduce search size on light theme so nav fits beside auth */
html[data-theme='light'] .header-search{flex:1 1 36%;max-width:420px}

/* Very small phones - enhance header visibility */
@media (max-width: 430px) {
  .topbar { padding: 0.45rem !important; margin: 0.5rem !important; }
  .site-logo { height: 40px !important; }
  .site-name { font-size: 0.8rem !important; max-width: none !important; }
  .site-name strong { font-size: 0.8rem !important; font-weight: 700; white-space: normal; overflow: visible; text-overflow: clip; }
  .site-name small { font-size: 0.56rem !important; white-space: normal; overflow: visible; text-overflow: clip; }
}

/* put nav inline in right area */
.topbar-right .topnav{margin-left:0.75rem;gap:0.75rem}
.topbar-right .topnav a{padding:0.45rem 0.6rem}
.header-search input{flex:1;padding:0.85rem 1rem;border-radius:999px;border:1px solid var(--border);background:transparent}
.header-search button{padding:0.7rem 1rem;border-radius:999px;border:1px solid var(--border);background:var(--accent);color:#fff}
.topnav{display:flex;gap:1rem}
.topnav a{padding:0.4rem 0.75rem;border-radius:999px}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
}

.brand strong,
.section-title,
.hero-title,
.stat-value,
.detail-title {
  font-family: var(--font-heading);
  letter-spacing: -0.03em;
}

.brand strong {
  display: block;
  font-size: 1.15rem;
}

.brand small {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.24em;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: var(--shadow-glow);
  font-family: var(--font-heading);
  font-size: 1.1rem;
}

.topnav,
.topbar-actions,
.toolbar,
.filter-row,
.genre-tabs,
.card-actions,
.cart-controls,
.review-meta,
.order-head,
.page-actions,
.auth-inline,
.hero-stats,
.detail-meta,
.checkout-row,
.navbar-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.topnav a,
.pill,
.tab,
.ghost-button,
.icon-button,
.nav-link {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.8rem 1rem;
  background: transparent;
  color: var(--text);
}

.topnav a:hover,
.pill:hover,
.tab:hover,
.ghost-button:hover,
.icon-button:hover,
.nav-link:hover {
  border-color: var(--border-strong);
  background: var(--bg-soft-2);
  transform: translateY(-1px);
}

/* keep nav left-aligned within the center area */
.topbar-center .topnav{justify-content:flex-start}

@media (max-width: 880px) {
  .topbar-center{flex-direction:column;align-items:stretch;gap:0.5rem}
  .header-search{width:100%;max-width:none}
  .topbar-center .topnav{justify-content:center}
}

.icon-button {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.nav-toggle {
  display: none;
}

/* Mobile hamburger toggle styling */
.nav-toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.45rem 0.6rem;
  border-radius: 10px;
  font-size: 1.05rem;
}

.topbar-actions {
  flex-wrap: nowrap;
  margin-left: auto;
}

.auth-slot {
  flex-wrap: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35rem;
  height: 1.35rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
}

.auth-slot {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.auth-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
}

.avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  object-fit: cover;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.app-shell {
  width: 100%;
  max-width: none;
  padding: 0 clamp(1rem, 2.5vw, 2rem);
  margin: 0 auto 4rem;
}

.page {
  display: grid;
  gap: 1.2rem;
  animation: fade-in 0.35s ease both;
  width: 100%;
  max-width: none;
  margin: 0 auto;
  padding: 0 clamp(1rem, 2.5vw, 2rem);
}

.page.full-width {
  width: 100%;
  max-width: none;
  padding-inline: clamp(1rem, 2.5vw, 2rem);
}

.page.home-page > .hero,
.page.home-page > .section,
.page.home-page > .marquee,
.page.home-page > .toolbar,
.page.home-page > .filter-pill-row {
  width: min(100%, 1760px);
  margin-inline: auto;
}

.glass-card,
.hero,
.drawer,
.modal-card,
.panel {
  background: color-mix(in srgb, var(--bg-elevated) 94%, var(--bg) 6%);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-deep);
}

html[data-theme='light'] .glass-card,
html[data-theme='light'] .hero,
html[data-theme='light'] .drawer,
html[data-theme='light'] .modal-card,
html[data-theme='light'] .panel {
  background: rgba(255, 255, 255, 0.97);
}

.hero {
  display: grid;
  gap: 2rem;
  grid-template-columns: 1.1fr 0.9fr;
  padding: 2.5rem 2rem;
  border-radius: 28px;
  align-items: center;
}

.hero-title {
  font-size: clamp(2.2rem, 6vw, 4.6rem);
  line-height: 0.95;
  margin: 0;
}

.hero-copy {
  max-width: 52ch;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.65;
}

.hero-feature-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
}

@media (max-width: 1200px) {
  .hero-feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .hero-feature-grid {
    grid-template-columns: 1fr;
  }
}

/* Appealing scroll animations for featured books */
.hero-feature-grid {
  perspective: 1000px;
}

.hero-feature-grid .book-card {
  animation: book-scroll-in 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  transform-origin: center;
  transition: all 0.3s ease;
}

.hero-feature-grid .book-card:nth-child(1) {
  animation-delay: 0ms;
}

.hero-feature-grid .book-card:nth-child(2) {
  animation-delay: 100ms;
}

.hero-feature-grid .book-card:nth-child(3) {
  animation-delay: 200ms;
}

.hero-feature-grid .book-card:hover {
  transform: translateY(-8px) scale(1.02);
}

/* Keyframe animations */
@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes book-scroll-in {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes marquee {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(calc(-100% - 1rem));
  }
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(100px) scale(0.8);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

/* ========== SMOOTH SCROLL ANIMATIONS ========== */

/* Scroll progress bar */
.scroll-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  width: 0%;
  z-index: 100;
  box-shadow: 0 0 12px var(--shadow-glow);
  transition: width 0.1s ease-out;
  will-change: width;
}

/* Fade-in animation for scroll-triggered elements */
.scroll-fade-in-trigger,
.scroll-fade-in {
  animation: scroll-fade-in 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes scroll-fade-in {
  from {
    opacity: 0;
    transform: translateY(32px);
    filter: blur(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

/* Enhanced text reveal animation for headings and paragraphs */
.scroll-fade-in h1,
.scroll-fade-in h2,
.scroll-fade-in h3,
.scroll-fade-in p {
  animation: text-reveal 0.85s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.scroll-fade-in h1 { animation-delay: 0ms; }
.scroll-fade-in h2 { animation-delay: 100ms; }
.scroll-fade-in h3 { animation-delay: 200ms; }
.scroll-fade-in p { animation-delay: 300ms; }

@keyframes text-reveal {
  from {
    opacity: 0;
    transform: translateY(32px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Highlight accent words in titles */
.hero-title span.accent,
.section-title span.accent,
p span.accent {
  color: var(--accent);
  font-weight: 600;
  transition: color 0.3s ease;
}

.hero-title span.accent:hover,
.section-title span.accent:hover,
p span.accent:hover {
  color: var(--accent-2);
}

/* Stagger animation for grid items */
.scroll-stagger-grid > * {
  animation: scroll-stagger 0.85s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes scroll-stagger {
  from {
    opacity: 0;
    transform: translateY(28px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Enhanced line-by-line text animation */
.text-lines {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.text-lines > * {
  animation: line-reveal 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes line-reveal {
  from {
    opacity: 0;
    transform: translateX(-12px) translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateX(0) translateY(0);
  }
}

/* Hide sections initially - only show when scrolled */
.section {
  opacity: 0;
}

.section.scroll-fade-in {
  opacity: 1;
}

/* Hero section shows immediately on load */
.hero {
  opacity: 1 !important;
}
.parallax {
  will-change: transform;
  transition: transform 0.3s ease-out;
}

/* Section label styling with "//" prefix */
.section-label {
  display: block;
  font-size: 0.85rem;
  font-family: var(--font-mono);
  color: var(--accent);
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  animation: section-label-reveal 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes section-label-reveal {
  from {
    opacity: 0;
    transform: translateX(-16px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Enhanced hero title with smooth reveal */
.hero-title {
  position: relative;
  overflow: hidden;
  animation: hero-title-reveal 1s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes hero-title-reveal {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Section titles with enhanced animation */
.section-title {
  position: relative;
  animation: title-reveal 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes title-reveal {
  from {
    opacity: 0;
    transform: translateY(32px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Smooth paragraph animations */
.section-copy {
  animation: paragraph-reveal 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes paragraph-reveal {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Apply fade-in to book cards in search results */
.book-card {
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.book-card:not(.hero-feature-grid .book-card).scroll-fade-in {
  animation: scroll-fade-in 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* Enhanced hover effect with smooth transition */
.book-card.scroll-fade-in:hover {
  transform: translateY(-12px) scale(1.02);
  box-shadow: 0 20px 40px rgba(99, 102, 241, 0.25);
}

/* Glass cards fade-in */
.glass-card.scroll-fade-in {
  animation: scroll-fade-in 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.glass-card.scroll-fade-in:hover {
  border-color: rgba(99, 102, 241, 0.3);
  box-shadow: 0 12px 32px rgba(99, 102, 241, 0.15);
}

/* Contact cards */
.contact-card.scroll-fade-in {
  animation: scroll-fade-in 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* Review cards */
.review-card.scroll-fade-in {
  animation: scroll-fade-in 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* Order items */
.order-item.scroll-fade-in {
  animation: scroll-fade-in 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* Hero sections with parallax */
.hero.parallax {
  animation: scroll-fade-in 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* Smooth sections */
.section.scroll-fade-in {
  animation: scroll-fade-in 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* Header hide on scroll down */
.topbar.header-hidden {
  transform: translateY(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Enhanced smooth scrolling with reduced motion support */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
    scroll-padding-top: 4.5rem;
  }
  
  * {
    scroll-behavior: smooth;
  }
}

/* Respect user's reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  
  .scroll-fade-in,
  .scroll-fade-in-trigger,
  .scroll-stagger,
  .parallax {
    animation: none !important;
    transform: none !important;
  }
  
  .topbar.header-hidden {
    transform: none;
  }
}

.hero-panel .book-card {
  padding: 0.85rem;
}

.section {
  width: 100%;
}

.section-wide {
  width: 100%;
}

/* Header search: centered and compact */
.topbar {
  flex-wrap: wrap;
}

.topbar-center {
  flex: 1 1 42rem;
  display: grid;
  place-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.header-search {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: min(100%, 42rem);
  padding: 0.72rem 0.95rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-elevated) 94%, var(--bg) 6%);
  border: 1px solid var(--border);
  box-shadow: none;
}

.header-search input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  padding: 0;
}

.header-search button {
  border: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  font-weight: 700;
  padding: 0.65rem 1rem;
  border-radius: 999px;
}

.header-search button:hover { transform: translateY(-2px); }

.topnav {
  justify-content: center;
}

@media (max-width: 860px) {
  .topnav {
    justify-content: flex-start;
  }
}

.hero-search-hint {
  .nav-toggle { display: inline-flex; margin-left: 0.5rem; }
  /* Hide the inline nav by default on narrow screens; reveal when menu opened */
  .topnav { display: none; }
  .topbar.menu-open .topnav {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 0.6rem 0.4rem;
    background: var(--bg-soft);
    border-radius: 12px;
    border: 1px solid var(--border);
  }
  /* JS-driven mobile view class to handle emulator quirks */
  .topbar.mobile-view .nav-toggle { display: inline-flex; }
  .topbar.mobile-view .topnav { display: none; }
  .topbar.mobile-view.menu-open .topnav { display: flex; }
  margin-top: 0.85rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.typewriter {
  color: var(--accent);
  text-shadow: var(--shadow-glow);
}

.hero-cta {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-top: 1.2rem;
}

.primary-button,
.secondary-button,
.danger-button,
.success-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 0.9rem 1.15rem;
  font-weight: 700;
}

.primary-button {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  box-shadow: var(--shadow-glow);
}

.secondary-button,
.ghost-button,
.icon-button {
  background: var(--bg-soft);
  border-color: var(--border);
  color: var(--text);
}

.popup-shell {
  background: var(--popup-bg);
  border: 1px solid var(--popup-border);
  border-radius: 28px;
  box-shadow: var(--shadow-deep);
  padding: 1.5rem;
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.contact-card {
  padding: 1.25rem;
  border-radius: 20px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
}

.danger-button {
  background: rgba(239, 68, 68, 0.14);
  color: #fecaca;
  border-color: rgba(239, 68, 68, 0.22);
}

.success-button {
  background: rgba(16, 185, 129, 0.14);
  color: #a7f3d0;
  border-color: rgba(16, 185, 129, 0.22);
}

.hero-panel {
  display: grid;
  gap: 1rem;
  align-content: start;
}

/* Profile page improvements */
.profile-shell {
  display: grid;
  grid-template-columns: 0.92fr 1.08fr;
  gap: 1.5rem;
  align-items: start;
}

.profile-summary {
  padding: 1.75rem;
  display: grid;
  gap: 1rem;
  align-content: start;
  position: sticky;
  top: 7.5rem;
}

.profile-avatar {
  width: 5.5rem;
  height: 5.5rem;
  border-radius: 24px;
  display: grid;
  place-items: center;
  font-family: var(--font-heading);
  font-size: 1.8rem;
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: var(--shadow-glow);
}

.profile-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.profile-note {
  padding: 1rem 1.1rem;
  border-radius: 18px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--muted);
  line-height: 1.65;
}

.profile-forms {
  display: grid;
  gap: 1rem;
}

.profile-form {
  display: grid;
  gap: 1rem;
}

.profile-form .text-input {
  padding: 1rem 1.05rem;
}

@media (max-width: 920px) {
  .profile-shell { grid-template-columns: 1fr; }
  .profile-summary { position: static; }
  .hero { padding: 1.5rem; grid-template-columns: 1fr; }
}

.hero-panel .glass-card {
  padding: 1rem;
  border-radius: 20px;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stat {
  padding: 1rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
}

.stat-value {
  font-size: 1.5rem;
  display: block;
}

.stat-label {
  color: var(--muted);
  font-size: 0.85rem;
}

.section {
  display: grid;
  gap: 1rem;
  padding: 1rem 0;
}

/* full-bleed sections that stretch edge-to-edge */
.section.full-bleed {
  width: 100vw;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  padding-left: 1rem;
  padding-right: 1rem;
}

/* Footer */
.site-footer {
  width: 100vw;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  margin-top: 2rem;
  margin-bottom: 0;
  padding: 2rem clamp(1rem, 2.5vw, 2rem);
  border-radius: 0;
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  align-items: start;
}
.footer-grid a { text-decoration: none; }
.footer-grid > * { text-align: left; }
.footer-links a:hover { color: var(--accent); }

@media (max-width: 820px) {
  .footer-grid { grid-template-columns: 1fr; }
  .auth-modal-panel.popup-shell { width: calc(100% - 2rem); left: 1rem; transform: none; }
}
.footer-links ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.5rem;
}
.footer-links a { color: var(--muted); }
.footer-contact .hint { margin: 0.25rem 0; }
.follow-socials a { display: inline-block; padding: 0.45rem 0.8rem; background: rgba(99, 102, 241, 0.08); border-radius: 6px; color: var(--accent); font-size: 0.9rem; transition: all 0.2s ease; text-decoration: none; margin: 0.25rem 0; border: 1px solid rgba(99, 102, 241, 0.2); }
.follow-socials a:hover { background: rgba(99, 102, 241, 0.15); transform: translateX(3px); border-color: rgba(99, 102, 241, 0.4); }
.footer-bottom { margin-top: 1.25rem; text-align: center; }

/* Auth modal styles */
.auth-modal { position: relative; }
.auth-modal-backdrop { position: fixed; inset: 0; background: rgba(2, 6, 23, 0.72); backdrop-filter: blur(8px); z-index: 80; }
.auth-modal-panel { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 90; width: min(760px, calc(100% - 2rem)); border-radius: 22px; }
.auth-modal .icon-button { position: absolute; right: 0.8rem; top: 0.8rem; }

/* Auth modal grid */
.auth-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
.auth-form-panel { display: flex; flex-direction: column; gap: 1rem; }
.auth-branding { display: flex; flex-direction: column; gap: 1rem; }
.auth-modal-panel.popup-shell { width: min(920px, calc(100% - 2rem)); }

.auth-modal-panel.auth-large { width: min(1040px, calc(100% - 2rem)); padding: 0; overflow: hidden; background: color-mix(in srgb, var(--bg-elevated) 96%, var(--bg) 4%); }
.auth-grid.auth-large { grid-template-columns: 1.02fr 0.98fr; align-items: stretch; gap: 0; }
.auth-branding.auth-large { padding: 3rem; color: var(--auth-brand-text); background: linear-gradient(145deg, var(--auth-brand-bg-start), var(--auth-brand-bg-end)); display:flex; flex-direction:column; justify-content:center; gap:1rem; border-right: 1px solid var(--auth-brand-border); }
.auth-branding.auth-large::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at top right, color-mix(in srgb, var(--accent) 28%, transparent), transparent 32%); pointer-events: none; }
.auth-branding.auth-large { position: relative; }
.auth-branding.auth-large .brand-mark { width:4.25rem; height:4.25rem; border-radius:16px; font-size:1.35rem; box-shadow: var(--shadow-glow); background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: white; display:grid; place-items:center; }
.auth-branding.auth-large .section-title { color: var(--auth-brand-text); font-size: clamp(1.8rem, 3.6vw, 2.8rem); }
.auth-branding.auth-large .section-copy { color: var(--auth-brand-muted); }
.auth-brand-row { display: flex; align-items: center; gap: 1rem; }
.auth-brand-name { display: block; font-size: 1.15rem; letter-spacing: 0.18em; text-transform: uppercase; }
.auth-brand-note { margin-top: 1.5rem; display: flex; gap: 1rem; align-items: center; }
.auth-brand-row img{background:#fff;padding:6px;border-radius:8px;border:1px solid rgba(0,0,0,0.06);box-shadow:0 6px 18px rgba(2,6,23,0.12);height:56px;object-fit:contain}
.auth-brand-name{font-size:1.2rem}
.auth-brand-graphic { width: 3rem; height: 3rem; border-radius: 14px; display: grid; place-items: center; background: var(--auth-brand-graphic-bg); border: 1px solid var(--auth-brand-graphic-border); color: var(--auth-brand-text); }
.auth-brand-copy { color: var(--auth-brand-muted); line-height: 1.6; }
.auth-form-panel.auth-large { background: var(--bg-elevated); color: var(--text); padding: 2.5rem; border-radius: 0; display:flex; flex-direction:column; gap:1rem; justify-content:center; border-left: 1px solid var(--border); }
.auth-form-panel.auth-large .text-input { background: var(--bg-soft); color: var(--text); border: 1px solid var(--border); box-shadow: none; }
.auth-form-panel.auth-large .text-input::placeholder { color: var(--muted); }
.auth-form-panel.auth-large .text-input:focus { border-color: rgba(99, 102, 241, 0.6); box-shadow: var(--shadow-glow); }
.auth-form-panel.auth-large .primary-button { width: 100%; border-radius: 14px; padding: 0.95rem 1rem; }
.auth-form-panel.auth-large .ghost-button { background: transparent; border-color: transparent; color: var(--muted); }
.auth-form-panel.auth-large .helper-text a { color: var(--accent); }
.auth-form-panel.auth-large .panel { background: var(--bg-soft); border-color: var(--border); }

@media (max-width: 920px) {
  .auth-modal-panel.auth-large { width: calc(100% - 2rem); left: 50%; top: 50%; transform: translate(-50%, -50%); }
  .auth-grid.auth-large { grid-template-columns: 1fr; }
  .auth-branding.auth-large { border-top-left-radius: 22px; border-top-right-radius: 22px; }
  .auth-form-panel.auth-large { border-bottom-left-radius: 22px; border-bottom-right-radius: 22px; border-left: 0; border-top: 1px solid var(--border); }
}

@media (max-width: 700px) {
  .auth-modal-panel.auth-large { width: calc(100% - 1.5rem) !important; padding: 0 !important; top: 50% !important; transform: translate(-50%, -50%) !important; left: 50% !important; max-height: 90vh !important; overflow-y: auto !important; }
  .auth-grid.auth-large { gap: 0.3rem !important; }
  .auth-branding.auth-large { padding: 0.9rem 1rem 0.8rem !important; gap: 0.5rem !important; }
  .auth-form-panel.auth-large { padding: 1rem 1rem 1.2rem !important; gap: 0.6rem !important; }
  .auth-header { gap: 0.4rem !important; }
  .auth-brand-row { gap: 0.4rem !important; }
  .auth-brand-row img { height: 40px !important; }
  .auth-brand-name { font-size: 0.95rem !important; }
  .auth-brand-copy { font-size: 0.75rem !important; line-height: 1.3 !important; }
  .auth-brand-note { display: none !important; }
  .auth-form-panel.auth-large .text-input { font-size: 0.85rem !important; padding: 0.45rem 0.6rem !important; margin-bottom: 0.3rem !important; }
  .auth-form-panel.auth-large .primary-button { padding: 0.55rem 0.7rem !important; font-size: 0.85rem !important; margin-top: 0.4rem !important; }
  .auth-form-panel.auth-large .ghost-button { font-size: 0.8rem !important; padding: 0.45rem 0.6rem !important; }
  .section-title { font-size: 1.2rem !important; margin: 0 0 0.3rem 0 !important; }
  .section-copy { font-size: 0.8rem !important; margin: 0 0 0.3rem 0 !important; line-height: 1.4 !important; }
  .helper-text { font-size: 0.8rem !important; margin-top: 0.4rem !important; }
}

/* Mobile menu backdrop - semi-transparent overlay */
.mobile-menu-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.5);
  backdrop-filter: blur(4px);
  z-index: 95;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-menu-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

/* Animated overlay hamburger menu */
.mobile-menu-overlay {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: min(75vw, 320px);
  z-index: 98;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow-deep);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.mobile-menu-overlay.is-open {
  transform: translateX(0);
}

.mobile-menu-overlay[aria-hidden='true'] {
  display: flex;
}

/* Menu header with title and close button */
.mobile-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-elevated) 94%, var(--bg) 6%);
}

.mobile-menu-header h2 {
  margin: 0;
  font-size: 1.2rem;
  font-family: var(--font-heading);
  letter-spacing: -0.03em;
}

.mobile-menu-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 8px;
  color: var(--accent);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.mobile-menu-close:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.4);
  transform: rotate(90deg) scale(1.08);
}

/* Menu content scrollable area */
.mobile-menu-content {
  flex: 1 1 auto;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 0.5rem 0;
}

.mobile-menu-content::-webkit-scrollbar {
  width: 4px;
}

.mobile-menu-content::-webkit-scrollbar-track {
  background: transparent;
}

.mobile-menu-content::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.3);
  border-radius: 2px;
}

.mobile-menu-content::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 0.5);
}

/* Menu section with items */
.mobile-menu-section {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.mobile-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 0.5rem 0;
}

/* Individual menu items */
.mobile-menu-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1rem;
  border: none;
  background: transparent;
  color: var(--text);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.mobile-menu-item:hover {
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-elevated) 92%);
  padding-left: 1.3rem;
  color: var(--accent);
}

.mobile-menu-item:active {
  background: color-mix(in srgb, var(--accent) 12%, var(--bg-elevated) 88%);
}

.mobile-menu-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  min-width: 1.8rem;
}

.mobile-menu-item .badge {
  margin-left: auto;
  font-size: 0.65rem;
}

.nav-toggle {
  display: none;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 1.4rem;
  padding: 0.5rem;
  cursor: pointer;
}

@media (max-width: 700px) {
  .nav-toggle { display: inline-flex !important; }
  .mobile-menu { top: 3.8rem; left: 0.8rem; right: 0.8rem; }
}

.section-copy {
  margin: 0;
  color: var(--muted);
  max-width: 72ch;
}

.marquee {
  overflow: hidden;
  padding: 1rem 0;
}

.marquee-track {
  display: flex;
  gap: 1rem;
  width: max-content;
  animation: marquee 28s linear infinite;
}

.marquee-item {
  padding: 0.75rem 1rem;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.toolbar,
.checkout-row,
.page-actions,
.filter-row {
  justify-content: space-between;
}

.search-input,
.text-input,
.textarea,
.select {
  width: 100%;
  padding: 0.95rem 1rem;
  border-radius: 16px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  outline: none;
}

.select {
  appearance: none;
  background: var(--bg-soft);
  color: var(--text);
}

html[data-theme='light'] .select {
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
}

.select option {
  background: var(--bg-elevated);
  color: var(--text);
}

html[data-theme='light'] .select option {
  background: #ffffff;
  color: #081024;
}

.search-input::placeholder,
.text-input::placeholder,
.textarea::placeholder {
  color: var(--muted);
}

.search-input:focus,
.text-input:focus,
.textarea:focus,
.select:focus {
  border-color: rgba(99, 102, 241, 0.5);
  box-shadow: var(--shadow-glow);
}

.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.book-card {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 0.9rem;
  padding: 1rem;
  border-radius: 24px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
}

.book-card:hover,
.mini-book:hover,
.review-card:hover,
.order-card:hover,
.wishlist-card:hover,
.drawer-item:hover {
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: var(--shadow-glow);
  transform: translateY(-4px);
}

.genre-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.07), rgba(255,255,255,0.035));
  color: var(--text);
}

html[data-theme='light'] .genre-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,252,0.95));
}

.genre-card h3 {
  margin: 0 0 0.5rem 0;
  color: var(--text);
}

.genre-card .genre-count,
.genre-card p {
  opacity: 0.8;
  margin: 0;
}

.book-cover,
.mini-cover,
.detail-cover {
  position: relative;
  border-radius: 22px;
  overflow: hidden;
  background: linear-gradient(145deg, rgba(99, 102, 241, 0.36), rgba(15, 23, 42, 0.9));
  border: 1px solid var(--border);
}

.book-cover {
  aspect-ratio: 3 / 4;
  display: grid;
  place-items: end start;
  padding: 1rem;
}

.cover-emoji {
  font-size: 2rem;
}

.cover-swatch {
  position: absolute;
  inset: auto 0 0 0;
  height: 48%;
  opacity: 0.8;
}

.book-badge,
.sale-badge,
.status-badge,
.genre-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  border-radius: 999px;
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 700;
}

.book-badge,
.sale-badge {
  position: absolute;
  top: 0.85rem;
  left: 0.85rem;
  background: rgba(99, 102, 241, 0.16);
  color: #c7d2fe;
  border: 1px solid rgba(99, 102, 241, 0.24);
}

.book-title,
.mini-title,
.wishlist-title,
.order-title,
.detail-title,
.review-author {
  margin: 0;
  font-family: var(--font-heading);
  letter-spacing: -0.03em;
}

.book-meta,
.mini-meta,
.muted,
.detail-subtitle,
.review-date,
.review-body,
.order-meta,
.helper-text {
  color: var(--muted);
}

.price-row,
.mini-price,
.detail-price {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}

.price,
.detail-price strong,
.mini-price strong {
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.price-old {
  color: var(--muted);
  text-decoration: line-through;
}

.rating-line,
.rating-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.5rem;
  align-items: center;
}

.rating-bar {
  height: 0.55rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.rating-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--accent), #22d3ee);
}

.card-actions,
.detail-actions {
  justify-content: space-between;
}

.pill,
.tab {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
}

.pill.is-active,
.tab.is-active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(139, 92, 246, 0.25));
  border-color: rgba(99, 102, 241, 0.45);
  box-shadow: var(--shadow-glow);
}

.genre-card.is-active {
  border-color: rgba(99, 102, 241, 0.5);
  box-shadow: var(--shadow-glow);
}

.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.skeleton {
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 24px;
  min-height: 12rem;
}

.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.4s infinite;
}

.book-detail,
.profile-grid,
.checkout-grid,
.auth-grid,
.orders-grid,
.wishlist-grid {
  display: grid;
  gap: 1rem;
}

.book-detail,
.profile-grid,
.checkout-grid,
.auth-grid {
  grid-template-columns: 1.1fr 0.9fr;
}

.panel,
.modal-card,
.drawer,
.review-card,
.order-card,
.wishlist-card {
  border-radius: 24px;
}

.panel,
.review-card,
.order-card,
.wishlist-card,
.drawer-item {
  padding: 1rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
}

.detail-cover {
  min-height: 26rem;
  display: grid;
  place-items: center;
}

.detail-cover .cover-emoji {
  font-size: clamp(3rem, 9vw, 6rem);
}

.detail-header,
.order-head,
.auth-header,
.profile-head {
  display: grid;
  gap: 0.5rem;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 0.65fr;
  gap: 1rem;
}

.rating-summary {
  display: grid;
  gap: 0.75rem;
}

.review-card {
  display: grid;
  gap: 0.75rem;
}

.review-avatar,
.order-thumb,
.wishlist-thumb,
.drawer-thumb {
  width: 3rem;
  height: 3rem;
  border-radius: 14px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.06);
}

.drawer {
  position: fixed;
  top: 5.5rem;
  right: 0;
  bottom: 0;
  width: min(28rem, calc(100vw - 0.5rem));
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 1rem;
  padding: 1rem;
  z-index: 60;
  border-top-left-radius: 22px;
}

.drawer.is-open {
  transform: translateX(0);
}

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.48);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: var(--transition-standard);
  z-index: 35;
}

.drawer-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

body.has-drawer-open {
  overflow: hidden;
}

.drawer-head,
.drawer-foot,
.cart-row,
.wishlist-row,
.order-item,
.empty-state,
.toast,
.auth-row,
.review-form,
.profile-form,
.checkout-form {
  display: grid;
  gap: 0.75rem;
}

.drawer-body {
  overflow: auto;
  display: grid;
  gap: 0.75rem;
  padding-right: 0.25rem;
}

.drawer-item,
.cart-row,
.wishlist-row,
.order-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.75rem;
  border-radius: 18px;
}

.drawer-qty {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.qty-button {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-soft-2);
  color: var(--text);
}

.toast {
  min-width: min(24rem, calc(100vw - 2rem));
  padding: 0.95rem 1rem;
  border-radius: 18px;
  background: var(--toast-bg);
  border: 1px solid var(--toast-border);
  box-shadow: var(--shadow-deep);
  animation: toast-in 0.25s ease both;
}

.toast.success {
  border-color: rgba(16, 185, 129, 0.28);
}

.toast.error {
  border-color: rgba(239, 68, 68, 0.28);
}

.toasts {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  display: grid;
  gap: 0.75rem;
  z-index: 80;
  justify-items: end;
}

.star-input {
  display: inline-flex;
  gap: 0.25rem;
}

.star-input button {
  background: transparent;
  border: 0;
  color: rgba(255, 255, 255, 0.3);
  font-size: 1.35rem;
}

.star-input button.is-active {
  color: #fbbf24;
  text-shadow: 0 0 18px rgba(251, 191, 36, 0.35);
}

.chart {
  display: grid;
  gap: 0.6rem;
}

.chart-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.6rem;
  align-items: center;
}

.empty-state {
  padding: 2rem;
  text-align: center;
  justify-items: center;
  border-radius: 24px;
  background: var(--bg-soft);
  border: 1px dashed var(--border-strong);
}

.table-list {
  display: grid;
  gap: 0.8rem;
}

.mini-book,
.detail-book,
.wishlist-card,
.order-card {
  display: grid;
  gap: 0.75rem;
}

.mini-book {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.mini-cover {
  width: 5rem;
  height: 6.5rem;
}

.mini-cover .cover-emoji {
  font-size: 1.4rem;
}

.filter-pill-row {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
}

.page-number {
  min-width: 2.4rem;
  height: 2.4rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
}

.page-number.is-active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: var(--shadow-glow);
  color: white;
}

.hint {
  color: var(--muted);
  font-size: 0.9rem;
}

.error-text {
  color: #fecaca;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shimmer {
  100% {
    transform: translateX(100%);
  }
}

@keyframes marquee {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 980px) {
  .hero,
  .book-detail,
  .profile-grid,
  .checkout-grid,
  .auth-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    grid-template-columns: 1fr;
    justify-items: stretch;
    align-items: stretch;
  }

  .topbar-left,
  .topbar-right {
    justify-self: stretch;
    justify-content: flex-start;
  }

  .topbar-right {
    justify-content: flex-end;
  }

  .header-search {
    width: 100%;
    min-width: 0;
    max-width: none;
  }

  .topnav {
    width: 100%;
    padding: 0.5rem;
    border-radius: 16px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    justify-content: center;
  }

  .topnav a {
    border-radius: 12px;
  }

  .hero-stats {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .topbar {
    margin: 0.75rem;
    padding: 0.9rem;
  }

  .site-logo {
    height: 48px;
  }

  .app-shell {
    width: min(100vw - 1rem, 1400px);
  }

  .hero {
    padding: 1.2rem;
  }

  .books-grid {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  }

  .drawer {
    top: auto;
    right: 0.5rem;
    left: 0.5rem;
    bottom: 0.5rem;
    width: auto;
    transform: translateY(calc(100% + 1rem));
  }

  .drawer.is-open {
    transform: translateY(0);
  }
}

/* Mobile-specific header/search overrides (high specificity) */
@media (max-width: 700px) {
  .header-search {
    width: 100% !important;
    max-width: none !important;
    padding: 0.28rem 0 !important;
    gap: 0.4rem !important;
    order: 2;
    background: color-mix(in srgb, var(--bg-elevated) 96%, var(--bg) 4%);
    border-radius: 999px;
    border: 1px solid var(--border);
  }
  .header-search input {
    padding: 0.56rem 0.85rem !important;
    font-size: 0.95rem !important;
  }
  .header-search button {
    padding: 0.48rem 0.72rem !important;
    font-size: 0.92rem !important;
    min-width: 60px;
  }
  /* Reduce site name to prevent overlap; keep logo visible */
  .site-name { font-size: 0.95rem; max-width: 10ch; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  @media (max-width: 420px) {
    .site-name { display: none; }
  }
}

/* Very narrow screens (target: 430x932 device) */
@media (max-width: 430px) {
  .site-logo { height: 38px !important; }
  .site-name { display: inline-flex !important; font-size: 0.85rem; max-width: 95px; line-height: 1.1; flex-direction: column; gap: 0.05rem; }
  .site-name strong { font-size: 0.85rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .site-name small { font-size: 0.58rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar {
    display: grid !important;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand actions"
      "search search";
    align-items: center;
    gap: 0.25rem 0.5rem !important;
    margin: 0.4rem !important;
    padding: 0.35rem !important;
    border-radius: 14px;
  }
  .topbar-left { grid-area: brand; width: 100%; gap: 0.4rem; justify-content: flex-start; }
  .topbar-center { grid-area: search; width: 100% !important; display: block !important; }
  .topbar-right { grid-area: actions; width: auto; display: flex; align-items: center; gap: 0.35rem; justify-content: flex-end; }
  .site-logo { height: 32px !important; }
  .site-name { display: none !important; }
  .nav-toggle { display: inline-flex !important; padding: 0.34rem 0.45rem !important; }
  /* compact search row */
  .header-search {
    width: 100% !important;
    margin: 0 !important;
    padding: 0.28rem 0.45rem !important;
    gap: 0.35rem !important;
    min-height: 42px;
  }
  .header-search input { padding: 0.38rem 0.5rem !important; font-size: 0.9rem !important; }
  .header-search button { padding: 0.36rem 0.58rem !important; font-size: 0.86rem !important; min-width: 54px; }
  .topnav { display: none !important; }
  .auth-slot { display:flex; gap:0.3rem; }
}

/* Floating mobile hamburger and mobile-only search icon */
.mobile-search-toggle { display: none; background: transparent; border: none; font-size: 1.15rem; padding: 0.3rem; cursor: pointer; }
.nav-toggle { background: var(--accent); color: #fff; border: none; border-radius: 10px; cursor: pointer; }

@media (max-width: 700px) {
  /* Mobile header: show brand (logo + name), search, theme; hide cart and auth */
  .topbar-left > .brand { display: flex !important; gap: 0.12rem; align-items: center; flex: 0 1 auto; }
  .site-logo { height: 28px !important; width: auto !important; }
  .site-name { display: inline-flex !important; font-size: 0.6rem; line-height: 1.1; max-width: 42px; flex-direction: column; gap: 0; }
  .site-name strong { font-size: 0.6rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .site-name small { font-size: 0.42rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-search-toggle { display: inline-flex !important; align-items: center; justify-content: center; color: var(--muted); padding: 0.4rem; }
  #theme-toggle { display: inline-flex !important; }
  #cart-button { display: none !important; }
  .topbar-right { display: flex !important; gap: 0.3rem; align-items: center; }
  .auth-slot { display: none !important; }
  .topbar-center { display: none !important; }
  .topnav { display: none !important; }
  .nav-toggle { display: inline-flex !important; padding: 0.35rem 0.5rem !important; position: static !important; background: var(--bg-soft) !important; border: 1px solid var(--border) !important; }
  /* Mobile hamburger button - integrated into header, not floating */
  #mobile-hamburger { display: inline-flex !important; position: static !important; width: auto !important; height: auto !important; border-radius: 10px !important; padding: 0.35rem 0.5rem !important; font-size: 1.05rem !important; background: var(--bg-soft) !important; border: 1px solid var(--border) !important; box-shadow: none !important; opacity: 1 !important; margin: 0 !important; }
  /* hide full search input by default on mobile; open when toggled */
  .header-search { display: none !important; }
  .topbar-center { display: none !important; }
  body.mobile-search-open .topbar-center { display: flex !important; width: 100% !important; order: 2; }
  body.mobile-search-open .header-search { display: flex !important; width: 100% !important; }
}

/* Mobile menu overlay - links fade in */
.mobile-menu { transition: opacity 220ms ease, transform 220ms ease; }
.mobile-menu.is-open { opacity: 1; transform: translateY(0); }
.mobile-menu-nav a { opacity: 0; transform: translateY(6px); display: inline-block; transition: opacity 260ms ease, transform 260ms ease; }
.mobile-menu.is-open .mobile-menu-nav a { opacity: 1; transform: translateY(0); }


/* Account dropdown and mobile navigation panel */
.account-menu {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.account-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
}

.account-trigger-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.05;
}

.account-trigger-label {
  font-weight: 700;
  font-size: 0.92rem;
}

.account-trigger-sub {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.account-caret {
  color: var(--muted);
  font-size: 0.9rem;
}

.account-avatar {
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-weight: 800;
  font-size: 0.82rem;
  box-shadow: var(--shadow-glow);
}

.account-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  min-width: 13rem;
  padding: 0.6rem;
  border-radius: 16px;
  background: var(--popup-bg);
  border: 1px solid var(--popup-border);
  box-shadow: var(--shadow-deep);
  display: none;
  z-index: 70;
}

.account-dropdown.is-open {
  display: grid;
  gap: 0.45rem;
}

.account-dropdown a,
.account-dropdown button {
  width: 100%;
  justify-content: flex-start;
}

.account-dropdown a {
  padding: 0.7rem 0.8rem;
  border-radius: 12px;
  color: var(--text);
  background: var(--bg-soft);
  border: 1px solid var(--border);
}

.account-dropdown a:hover,
.account-dropdown button:hover {
  transform: none;
}

.mobile-menu {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99;
  margin: 0;
  padding: 0.7rem;
  border-radius: 0;
  background: var(--bg);
  border: none;
  box-shadow: none;
  display: none;
  overflow-y: auto;
}

.mobile-menu.is-open {
  display: grid;
  gap: 0.7rem;
  padding-top: 5.5rem;
}

.mobile-menu-nav,
.mobile-menu-actions {
  display: grid;
  gap: 0.55rem;
  padding: 0 1rem;
}

.mobile-menu-nav a,
.mobile-menu-actions .icon-button,
.mobile-menu-actions .ghost-button,
.mobile-menu-actions .primary-button {
  width: 100%;
  justify-content: flex-start;
}

.mobile-menu-nav a {
  padding: 0.8rem 0.9rem;
  border-radius: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
}

.mobile-account-card {
  display: grid;
  gap: 0.55rem;
  padding-top: 0.25rem;
}

.mobile-account-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.2rem 0.1rem 0.4rem;
}

.mobile-account-name {
  font-weight: 700;
}

.mobile-account-role {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

@media (max-width: 700px) {
  .primary-button, .secondary-button, .ghost-button { font-size: 0.85rem !important; padding: 0.5rem 0.85rem !important; }
  .account-trigger-copy { display: none; }
  .account-dropdown { right: 0; left: auto; }
  .mobile-menu { margin: 0 0.6rem 0.6rem; }
}/ *   = = = = = = = = = =   I M P R O V E D   F O O T E R   S E C T I O N   = = = = = = = = = =   * / 
 
 . s o c i a l - i c o n s   { 
 
     d i s p l a y :   f l e x ; 
 
     g a p :   0 . 7 5 r e m ; 
 
     f l e x - w r a p :   w r a p ; 
 
 } 
 
 
 
 . s o c i a l - i c o n   { 
 
     d i s p l a y :   i n l i n e - f l e x ; 
 
     a l i g n - i t e m s :   c e n t e r ; 
 
     j u s t i f y - c o n t e n t :   c e n t e r ; 
 
     w i d t h :   2 . 7 5 r e m ; 
 
     h e i g h t :   2 . 7 5 r e m ; 
 
     b o r d e r - r a d i u s :   1 2 p x ; 
 
     b a c k g r o u n d :   r g b a ( 9 9 ,   1 0 2 ,   2 4 1 ,   0 . 0 8 ) ; 
 
     b o r d e r :   1 p x   s o l i d   r g b a ( 9 9 ,   1 0 2 ,   2 4 1 ,   0 . 1 8 ) ; 
 
     c o l o r :   v a r ( - - a c c e n t ) ; 
 
     t r a n s i t i o n :   a l l   0 . 3 s   c u b i c - b e z i e r ( 0 . 3 4 ,   1 . 5 6 ,   0 . 6 4 ,   1 ) ; 
 
     t e x t - d e c o r a t i o n :   n o n e ; 
 
 } 
 
 
 
 . s o c i a l - i c o n   s v g   { 
 
     w i d t h :   1 . 3 5 r e m ; 
 
     h e i g h t :   1 . 3 5 r e m ; 
 
 } 
 
 
 
 . s o c i a l - i c o n : h o v e r   { 
 
     b a c k g r o u n d :   r g b a ( 9 9 ,   1 0 2 ,   2 4 1 ,   0 . 1 5 ) ; 
 
     b o r d e r - c o l o r :   r g b a ( 9 9 ,   1 0 2 ,   2 4 1 ,   0 . 3 5 ) ; 
 
     t r a n s f o r m :   t r a n s l a t e Y ( - 4 p x )   s c a l e ( 1 . 0 8 ) ; 
 
     b o x - s h a d o w :   0   1 2 p x   2 4 p x   r g b a ( 9 9 ,   1 0 2 ,   2 4 1 ,   0 . 2 ) ; 
 
 } 
 
 
 
 . f o o t e r - s o c i a l s   { 
 
     m a r g i n - t o p :   1 r e m ; 
 
 } 
 
 
 
 . n e w s l e t t e r - f o r m   { 
 
     d i s p l a y :   f l e x ; 
 
     g a p :   0 . 5 r e m ; 
 
     m a r g i n - t o p :   0 . 7 5 r e m ; 
 
 } 
 
 
 
 . n e w s l e t t e r - f o r m   i n p u t   { 
 
     f l e x :   1 ; 
 
     p a d d i n g :   0 . 6 5 r e m   0 . 9 5 r e m   ! i m p o r t a n t ; 
 
     b o r d e r - r a d i u s :   1 2 p x ; 
 
     b a c k g r o u n d :   v a r ( - - b g - s o f t )   ! i m p o r t a n t ; 
 
     b o r d e r :   1 p x   s o l i d   v a r ( - - b o r d e r )   ! i m p o r t a n t ; 
 
     c o l o r :   v a r ( - - t e x t ) ; 
 
 } 
 
 
 
 . n e w s l e t t e r - f o r m   i n p u t : : p l a c e h o l d e r   { 
 
     c o l o r :   v a r ( - - m u t e d ) ; 
 
 } 
 
 
 
 . n e w s l e t t e r - f o r m   b u t t o n   { 
 
     p a d d i n g :   0 . 6 5 r e m   1 . 2 r e m ; 
 
     b o r d e r - r a d i u s :   1 2 p x ; 
 
     b a c k g r o u n d :   l i n e a r - g r a d i e n t ( 1 3 5 d e g ,   v a r ( - - a c c e n t ) ,   v a r ( - - a c c e n t - 2 ) ) ; 
 
     b o r d e r :   0 ; 
 
     c o l o r :   w h i t e ; 
 
     f o n t - w e i g h t :   6 0 0 ; 
 
     c u r s o r :   p o i n t e r ; 
 
     t r a n s i t i o n :   a l l   0 . 2 s   e a s e ; 
 
 } 
 
 
 
 . n e w s l e t t e r - f o r m   b u t t o n : h o v e r   { 
 
     t r a n s f o r m :   t r a n s l a t e Y ( - 2 p x ) ; 
 
     b o x - s h a d o w :   v a r ( - - s h a d o w - g l o w ) ; 
 
 } 
 
 
 
 / *   I m p r o v e d   f o o t e r   g r i d   l a y o u t   * / 
 
 . f o o t e r - g r i d   { 
 
     d i s p l a y :   g r i d ; 
 
     g r i d - t e m p l a t e - c o l u m n s :   r e p e a t ( a u t o - f i t ,   m i n m a x ( 2 6 0 p x ,   1 f r ) ) ; 
 
     g a p :   2 r e m ; 
 
     a l i g n - i t e m s :   s t a r t ; 
 
     m a r g i n - b o t t o m :   1 . 5 r e m ; 
 
 } 
 
 
 
 . f o o t e r - n e w s l e t t e r   { 
 
     g r i d - c o l u m n :   s p a n   1 ; 
 
 } 
 
 
 
 . f o o t e r - c o n t a c t   { 
 
     g r i d - c o l u m n :   s p a n   1 ; 
 
 } 
 
 
 
 . f o o t e r - l i n k s   h 4 , 
 
 . f o o t e r - c o n t a c t   h 4 , 
 
 . f o o t e r - n e w s l e t t e r   h 4   { 
 
     m a r g i n :   0   0   0 . 8 5 r e m   0 ; 
 
     f o n t - s i z e :   1 . 0 5 r e m ; 
 
     c o l o r :   v a r ( - - t e x t ) ; 
 
     f o n t - w e i g h t :   6 0 0 ; 
 
 } 
 
 
 
 . f o o t e r - l i n k s   a   { 
 
     c o l o r :   v a r ( - - m u t e d ) ; 
 
     t e x t - d e c o r a t i o n :   n o n e ; 
 
     t r a n s i t i o n :   a l l   0 . 2 s   e a s e ; 
 
     d i s p l a y :   i n l i n e - f l e x ; 
 
     a l i g n - i t e m s :   c e n t e r ; 
 
     g a p :   0 . 4 r e m ; 
 
 } 
 
 
 
 . f o o t e r - l i n k s   a : h o v e r   { 
 
     c o l o r :   v a r ( - - a c c e n t ) ; 
 
     t r a n s f o r m :   t r a n s l a t e X ( 3 p x ) ; 
 
 } 
 
 
 
 . f o o t e r - b o t t o m   { 
 
     m a r g i n - t o p :   2 r e m ; 
 
     p a d d i n g - t o p :   1 . 5 r e m ; 
 
     b o r d e r - t o p :   1 p x   s o l i d   v a r ( - - b o r d e r ) ; 
 
     t e x t - a l i g n :   c e n t e r ; 
 
 } 
 
 
 
 @ m e d i a   ( m a x - w i d t h :   8 2 0 p x )   { 
 
     . f o o t e r - g r i d   { 
 
         g r i d - t e m p l a t e - c o l u m n s :   1 f r ; 
 
         g a p :   1 . 5 r e m ; 
 
     } 
 
 
 
     . s o c i a l - i c o n s   { 
 
         j u s t i f y - c o n t e n t :   f l e x - s t a r t ; 
 
     } 
 
 
 
     . n e w s l e t t e r - f o r m   { 
 
         f l e x - d i r e c t i o n :   c o l u m n ; 
 
     } 
 
 
 
     . n e w s l e t t e r - f o r m   b u t t o n   { 
 
         w i d t h :   1 0 0 % ; 
 
     } 
 
 } 
 
 /* ========== IMPROVED FOOTER SECTION ========== */
.social-icons {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.social-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 12px;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.18);
  color: var(--accent);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-decoration: none;
  font-size: 1.4rem;
  font-weight: 600;
}

.social-icon svg {
  width: 1.35rem;
  height: 1.35rem;
}

.social-icon:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.35);
  transform: translateY(-4px) scale(1.08);
  box-shadow: 0 12px 24px rgba(99, 102, 241, 0.2);
}

.footer-socials {
  margin-top: 1rem;
}

.newsletter-form {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.newsletter-form input {
  flex: 1;
  padding: 0.65rem 0.95rem !important;
  border-radius: 12px;
  background: var(--bg-soft) !important;
  border: 1px solid var(--border) !important;
  color: var(--text);
}

.newsletter-form input::placeholder {
  color: var(--muted);
}

.newsletter-form button {
  padding: 0.65rem 1.2rem;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: 0;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.newsletter-form button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

/* Improved footer grid layout */
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 2rem;
  align-items: start;
  margin-bottom: 1.5rem;
}

.footer-newsletter {
  grid-column: span 1;
}

.footer-contact {
  grid-column: span 1;
}

.footer-links h4,
.footer-contact h4,
.footer-newsletter h4 {
  margin: 0 0 0.85rem 0;
  font-size: 1.05rem;
  color: var(--text);
  font-weight: 600;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.footer-links a:hover {
  color: var(--accent);
  transform: translateX(3px);
}

.footer-bottom {
  margin-top: 2rem;
  padding: 1.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
  background: transparent;
  border-radius: 0;
  border: none;
}

.footer-bottom .muted {
  font-size: 0.9rem;
  line-height: 1.7;
  letter-spacing: 0.3px;
  color: var(--muted);
  white-space: normal;
}

.footer-bottom .footer-brand {
  display: inline;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0.25rem;
  font-size: 0.95rem;
}

@media (max-width: 820px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .social-icons {
    justify-content: flex-start;
  }

  .newsletter-form {
    flex-direction: column;
  }

  .newsletter-form button {
    width: 100%;
  }
}

/* Admin Orders Styles */
.admin-orders-grid {
  display: grid;
  gap: 1rem;
}

.admin-order-row {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  transition: all 0.3s ease;
}

.admin-order-row:hover {
  border-color: var(--accent);
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.15);
}

.admin-order-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.admin-order-head > div:first-child strong {
  display: block;
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.admin-order-head > div:last-child {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
}

.admin-order-head > div:last-child strong {
  font-size: 1.1rem;
  color: var(--accent);
}

.status-select {
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.status-select:hover,
.status-select:focus {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--bg-soft) 80%, var(--accent) 20%);
}

.admin-order-items {
  background: var(--bg-soft);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.mini-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.mini-item:last-child {
  border-bottom: none;
}

.mini-item span:first-child {
  color: var(--muted);
  flex: 1;
}

.mini-item span:last-child {
  color: var(--accent);
  font-weight: 600;
}

.admin-order-footer {
  font-size: 0.8rem;
  color: var(--muted);
}

@media (max-width: 700px) {
  .admin-order-row {
    padding: 1rem;
  }

  .admin-order-head {
    flex-direction: column;
  }

  .admin-order-head > div:last-child {
    align-items: flex-start;
    width: 100%;
  }

  .status-select {
    width: 100%;
  }
}

/* Accessibility: Respect user's motion preferences for performance & accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  /* Disable animations for scroll-triggered elements */
  .scroll-fade-in,
  .scroll-fade-in-trigger,
  .scroll-stagger-grid > * {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
  }

  .scroll-fade-in h1,
  .scroll-fade-in h2,
  .scroll-fade-in h3,
  .scroll-fade-in p {
    animation: none !important;
    animation-delay: 0 !important;
    opacity: 1 !important;
    transform: none !important;
  }

  /* Disable text-lines animation */
  .text-lines > * {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }

  /* Disable other animations */
  .fade-in-animation {
    animation: none !important;
  }

  .book-card {
    transition: none !important;
  }

  .book-card:hover {
    transform: none !important;
  }

  .hero-feature-grid .book-card:hover {
    transform: none !important;
  }

  /* Keep progress bar but without animation */
  .scroll-progress-bar {
    transition: none !important;
  }

  /* Disable toast animations */
  .toast {
    animation: none !important;
  }
}
