/* ═══════════════════════════════════════════════════════════════
   MpookStore — Elegant Online Bookstore Design System
   Navy · White · Gold
   ═══════════════════════════════════════════════════════════════ */

/* ─── CSS Custom Properties ───────────────────────────────────── */
:root {
  /* Colors */
  --color-bg: #FFFFFF;
  --color-bg-secondary: #F8F6F2;
  --color-bg-tertiary: #EDE9E0;
  --color-border: #D0CBBD;
  --color-border-light: #E8E3DA;
  --color-text: #0F1111;
  --color-text-secondary: #565959;
  --color-text-muted: #888;
  --color-link: #1B2744;
  --color-link-hover: #C9A84C;
  --color-accent: #C9A84C;
  --color-accent-hover: #B8922A;
  --color-accent-dark: #9A7820;
  --color-btn-primary: #C9A84C;
  --color-btn-primary-hover: #B8922A;
  --color-btn-primary-border: #A87820;
  --color-btn-secondary: #1B2744;
  --color-btn-secondary-hover: #152035;
  --color-success: #067D62;
  --color-error: #CC0C39;
  --color-star: #C9A84C;
  --color-header-bg: #1B2744;
  --color-header-text: #FFFFFF;
  --color-footer-bg: #1B2744;
  --color-footer-light: #243358;

  /* Typography */
  --font-body: 'Inter', Arial, sans-serif;
  --font-heading: 'Outfit', 'Inter', Arial, sans-serif;
  --font-brand: 'Outfit', 'Inter', Arial, sans-serif;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Layout */
  --max-width: 1400px;
  --header-height: 70px;
  --border-radius: 4px;
  --border-radius-lg: 8px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.08);
  --shadow-md: 0 2px 5px rgba(0,0,0,0.1);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.12);
  --shadow-card: 0 2px 5px rgba(0,0,0,0.08), 0 0 1px rgba(0,0,0,0.1);
}

/* ─── Reset ───────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-text);
  background-color: var(--color-bg-secondary);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

img { max-width: 100%; display: block; }
a { color: var(--color-link); text-decoration: none; }
a:hover { color: var(--color-link-hover); text-decoration: underline; }
button { cursor: pointer; font-family: inherit; }
ul, ol { list-style: none; }
input, select, textarea { font-family: inherit; font-size: inherit; }

/* ─── Layout ──────────────────────────────────────────────────── */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-md);
}

.main-content {
  min-height: calc(100vh - var(--header-height) - 200px);
  padding-top: var(--space-md);
  padding-bottom: var(--space-2xl);
}

.site-header .container {
  padding-left: 0;
  padding-right: 0;
}

/* ─── Header ──────────────────────────────────────────────────── */
.site-header {
  background: var(--color-header-bg);
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--header-height);
  display: flex;
  align-items: center;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 0;
  width: 100%;
  padding: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
  padding: 6px var(--space-lg) 6px 0;
  border: 1px solid transparent;
  border-radius: var(--border-radius);
  margin-right: auto;
}

.logo:hover {
  border-color: #fff;
  text-decoration: none;
}

.logo-icon {
  font-size: 22px;
}

.logo-img {
  height: 72px;
  width: auto;
  border-radius: 8px;
  flex-shrink: 0;
}

.logo-text {
  font-family: var(--font-brand);
  font-size: 32px;
  font-weight: 700;
  color: var(--color-header-text);
  letter-spacing: 1px;
  text-transform: none;
}

.logo-accent {
  color: var(--color-accent);
}

/* Search */
.search-wrapper {
  flex: 1;
  max-width: 700px;
  position: relative;
}

.search-input {
  width: 100%;
  height: 40px;
  padding: 0 44px 0 14px;
  border: none;
  border-radius: var(--border-radius);
  font-size: 14px;
  background: #fff;
  color: var(--color-text);
  outline: none;
}

.search-input:focus {
  box-shadow: 0 0 0 3px var(--color-accent);
}

.search-icon {
  position: absolute;
  right: 0;
  top: 0;
  height: 40px;
  width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-accent);
  border-radius: 0 var(--border-radius) var(--border-radius) 0;
  font-size: 16px;
  pointer-events: none;
}

/* Search Results Dropdown */
.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 0 0 var(--border-radius) var(--border-radius);
  box-shadow: var(--shadow-lg);
  display: none;
  z-index: 100;
  max-height: 400px;
  overflow-y: auto;
}

.search-results.active {
  display: block;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  border-bottom: 1px solid var(--color-border-light);
}

.search-result-item:hover {
  background: var(--color-bg-secondary);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-cover {
  width: 36px;
  height: 48px;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.search-result-cover span {
  font-size: 7px;
  color: rgba(255,255,255,0.9);
  text-align: center;
  padding: 2px;
  line-height: 1.2;
  font-weight: 600;
}

.search-result-info h4 {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  line-height: 1.3;
}

.search-result-info p {
  font-size: 12px;
  color: var(--color-text-secondary);
}

.search-no-results {
  padding: var(--space-md);
  color: var(--color-text-secondary);
  font-size: 13px;
  text-align: center;
}

/* Nav */
.main-nav {
  display: flex;
  gap: 2px;
}

.nav-link {
  color: var(--color-header-text);
  padding: var(--space-sm) var(--space-md);
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
  border-radius: var(--border-radius);
  white-space: nowrap;
}

.nav-link:hover {
  border-color: #fff;
  text-decoration: none;
  color: #fff;
}

/* Cart Button */
.cart-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--border-radius);
  padding: var(--space-sm) var(--space-lg);
  color: var(--color-header-text);
  font-size: 14px;
  font-weight: 700;
  position: relative;
  margin-left: auto;
  flex-shrink: 0;
}

.cart-toggle:hover {
  border-color: #fff;
}

.cart-icon {
  font-size: 22px;
}

.cart-badge {
  position: absolute;
  top: 0;
  right: 4px;
  background: var(--color-accent);
  color: var(--color-header-bg);
  font-size: 12px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.cart-badge[data-count="0"] {
  display: none;
}

/* Mobile Menu */
.mobile-menu-btn {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--border-radius);
  padding: 8px;
  cursor: pointer;
}

.mobile-menu-btn span {
  display: block;
  width: 20px;
  height: 2px;
  background: #fff;
  transition: transform 0.2s;
}

.mobile-menu-btn.open span:nth-child(1) { transform: rotate(45deg) translate(4px, 4px); }
.mobile-menu-btn.open span:nth-child(2) { opacity: 0; }
.mobile-menu-btn.open span:nth-child(3) { transform: rotate(-45deg) translate(4px, -4px); }

/* ─── Sub-header nav bar ──────────────────────────────────────── */
/* We'll add a thin nav bar below the header via JS if needed */

/* ─── Hero / Banner ───────────────────────────────────────────── */
.hero {
  background: linear-gradient(to bottom, rgba(27, 39, 68, 0.80), rgba(27, 39, 68, 0.92)),
              url('/images/hero-banner.png') center/cover no-repeat;
  padding: 60px 0;
  text-align: center;
  margin-bottom: var(--space-lg);
  position: relative;
}

.hero-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 var(--space-md);
  position: relative;
  z-index: 1;
}

.hero h1 {
  font-family: var(--font-brand);
  font-size: 38px;
  font-weight: 700;
  color: #FFFFFF;
  margin-bottom: var(--space-sm);
  line-height: 1.2;
  letter-spacing: 1px;
}

.hero-subtitle {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: var(--space-lg);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.hero-actions {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  margin-bottom: var(--space-xl);
  flex-wrap: wrap;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: var(--space-xl);
  flex-wrap: wrap;
}

.hero-stat {
  text-align: center;
}

.hero-stat-value {
  font-size: 24px;
  font-weight: 700;
  color: #FFFFFF;
}

.hero-stat-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* No particles or orbs in clean design */
.hero-particles, .hero-particle, .hero-orb, .hero-bg, .hero-badge, .hero-badge-dot { display: none; }
.gradient-text { color: inherit; }

/* ─── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 20px;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--border-radius-lg);
  border: 1px solid;
  cursor: pointer;
  transition: background 0.15s;
  text-decoration: none;
  line-height: 1.4;
}

.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(to bottom, #D9BC6E, #C9A84C);
  border-color: #9A7820 #8A6C16 #7A5E10;
  color: #1B2744;
}

.btn-primary:hover {
  background: linear-gradient(to bottom, #C9A84C, #B8922A);
  color: #1B2744;
}

.btn-secondary {
  background: linear-gradient(to bottom, #F7F8FA, #E7E9EC);
  border-color: #ADB1B8 #A2A6AC #8D9096;
  color: var(--color-text);
}

.btn-secondary:hover {
  background: linear-gradient(to bottom, #E7E9EC, #D9DCE1);
  color: var(--color-text);
}

.btn-sm {
  padding: 5px 12px;
  font-size: 13px;
}

.btn-add-to-cart {
  width: 100%;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 20px;
  border: 1px solid;
  background: linear-gradient(to bottom, #D9BC6E, #C9A84C);
  border-color: #9A7820 #8A6C16 #7A5E10;
  color: #1B2744;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-add-to-cart:hover {
  background: linear-gradient(to bottom, #C9A84C, #B8922A);
}

.btn-add-to-cart.in-cart {
  background: linear-gradient(to bottom, #F7F8FA, #E7E9EC);
  border-color: #ADB1B8;
  color: var(--color-success);
  cursor: default;
}

.btn-checkout {
  width: 100%;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--border-radius-lg);
  border: 1px solid #9A7820;
  background: linear-gradient(to bottom, #D9BC6E, #C9A84C);
  color: #1B2744;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 0;
  display: block;
  text-align: center;
  box-sizing: border-box;
}

.btn-checkout:hover {
  background: linear-gradient(to bottom, #C9A84C, #B8922A);
}

.btn-checkout:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ─── Section Headers ─────────────────────────────────────────── */
.section-header {
  margin-bottom: var(--space-lg);
}

.section-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-text);
}

.section-title .accent {
  color: var(--color-text);
}

/* ─── Category Grid ───────────────────────────────────────────── */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-md);
}

.category-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 160px;
  padding: var(--space-lg) var(--space-md);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-lg);
  text-decoration: none;
  color: var(--color-text);
  transition: box-shadow 0.15s, border-color 0.15s;
}

.category-card:hover {
  box-shadow: var(--shadow-md);
  border-color: #bbb;
  text-decoration: none;
  color: var(--color-text);
}

.category-icon {
  margin-bottom: var(--space-sm);
  color: var(--color-text-secondary);
  transition: color 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.category-card:hover .category-icon {
  color: var(--color-accent-dark);
}

.category-name {
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 2px;
}

.category-count {
  font-size: 12px;
  color: var(--color-text-secondary);
}

/* Categories page grid */
.categories-page-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-md);
}

/* ─── Book Cards ──────────────────────────────────────────────── */
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-md);
}

.book-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  transition: box-shadow 0.15s;
  display: flex;
  flex-direction: column;
}

.book-card:hover {
  box-shadow: var(--shadow-lg);
}

.book-cover {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  padding: var(--space-md);
  text-decoration: none;
  position: relative;
}

.book-cover-title {
  color: rgba(255, 255, 255, 0.95);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  line-height: 1.3;
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
  max-width: 90%;
}

.placeholder-cover {
  background: #ffffff;
  width: 75%;
  height: 85%;
  border-radius: 2px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8%;
  box-sizing: border-box;
}

.placeholder-cover .book-cover-title {
  color: #111111 !important;
  text-shadow: none !important;
  width: 100%;
  max-width: 100%;
}

/* Cover images */
.book-cover-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  position: absolute;
  top: 0;
  left: 0;
  border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.book-detail-cover-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: var(--border-radius-lg);
}

.book-detail-cover {
  position: relative;
  overflow: hidden;
}

.book-info {
  padding: var(--space-md);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.book-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-link);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
}

.book-title:hover {
  color: var(--color-link-hover);
  text-decoration: underline;
}

.book-author {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-sm);
}

.book-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}

.book-format {
  font-size: 11px;
  color: var(--color-text-secondary);
  background: var(--color-bg-secondary);
  padding: 2px 8px;
  border-radius: 3px;
  font-weight: 500;
}

.book-price {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text);
}

.book-price-symbol {
  font-size: 13px;
  vertical-align: super;
}

.book-card-actions {
  padding: 0 var(--space-md) var(--space-md);
}

/* ─── Book Detail ─────────────────────────────────────────────── */
.book-detail {
  padding-top: var(--space-lg);
}

.book-detail-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: var(--space-xl);
  background: var(--color-bg);
  padding: var(--space-xl);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-lg);
}

.book-detail-cover {
  height: 400px;
  border-radius: var(--border-radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
}

.book-detail-cover .book-cover-title {
  font-size: 22px;
  font-weight: 700;
}

.book-detail-info {
  display: flex;
  flex-direction: column;
}

.book-detail-category {
  font-size: 12px;
  color: var(--color-link);
  text-transform: capitalize;
  margin-bottom: var(--space-sm);
}

.book-detail-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.3;
  margin-bottom: var(--space-sm);
}

.book-detail-author {
  font-size: 14px;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-lg);
}

.book-detail-author span {
  color: var(--color-link);
}

.book-detail-description {
  font-size: 14px;
  line-height: 1.6;
  color: var(--color-text);
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--color-border-light);
}

.book-detail-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--color-border-light);
}

.book-detail-meta-item .label {
  font-size: 12px;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.book-detail-meta-item .value {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
}

.book-detail-price-row {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  margin-top: auto;
}

.book-detail-price {
  font-size: 28px;
  font-weight: 700;
  color: var(--color-text);
}

.book-detail-add-btn {
  padding: 12px 40px;
  font-size: 14px;
}

/* Related section */
.related-section {
  margin-top: var(--space-2xl);
}

/* ─── All Books Page ──────────────────────────────────────────── */
.all-books-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
  gap: var(--space-md);
}

.all-books-header h1 {
  font-size: 22px;
  font-weight: 700;
}

.all-books-controls {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.filter-select,
.sort-select {
  padding: 6px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 13px;
  cursor: pointer;
}

.filter-select:focus,
.sort-select:focus {
  border-color: var(--color-accent);
  outline: none;
  box-shadow: 0 0 0 2px rgba(255, 153, 0, 0.2);
}

.books-count {
  font-size: 13px;
  color: var(--color-text-secondary);
}

/* Category filter pills */
.category-filter-pills {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-bottom: var(--space-lg);
}

.category-pill {
  padding: 6px 14px;
  font-size: 13px;
  border: 1px solid var(--color-border);
  border-radius: 20px;
  background: var(--color-bg);
  color: var(--color-text);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}

.category-pill:hover {
  background: var(--color-bg-tertiary);
  border-color: #bbb;
}

.category-pill.active {
  background: var(--color-header-bg);
  color: #fff;
  border-color: var(--color-header-bg);
}

/* ─── Category Page ───────────────────────────────────────────── */
.category-page-header {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
  padding: var(--space-lg);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-lg);
}

.category-page-icon {
  font-size: 48px;
}

.category-page-info h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
}

.category-page-info p {
  font-size: 14px;
  color: var(--color-text-secondary);
}

/* ─── Cart Page ───────────────────────────────────────────────── */
.cart-page {
  max-width: 900px;
}

.cart-page h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--color-border);
}

.cart-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-lg);
  margin-bottom: var(--space-md);
}

.cart-item-cover {
  width: 60px;
  height: 80px;
  border-radius: var(--border-radius);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.cart-item-cover span {
  color: rgba(255,255,255,0.9);
  font-size: 8px;
  font-weight: 600;
  text-align: center;
  padding: 4px;
  line-height: 1.2;
}

.cart-item-info {
  flex: 1;
  min-width: 0;
}

.cart-item-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-link);
  margin-bottom: 2px;
}

.cart-item-author {
  font-size: 12px;
  color: var(--color-text-secondary);
}

.cart-item-price {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text);
  flex-shrink: 0;
}

.cart-item-remove {
  background: none;
  border: none;
  color: var(--color-link);
  font-size: 14px;
  cursor: pointer;
  padding: var(--space-sm);
  flex-shrink: 0;
}

.cart-item-remove:hover {
  color: var(--color-error);
}

.cart-summary {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-lg);
  padding: var(--space-lg);
  margin-top: var(--space-lg);
}

.cart-summary-row {
  display: flex;
  justify-content: space-between;
  padding: var(--space-sm) 0;
  font-size: 14px;
}

.cart-summary-row.total {
  border-top: 1px solid var(--color-border);
  margin-top: var(--space-sm);
  padding-top: var(--space-md);
  font-size: 18px;
  font-weight: 700;
}

.cart-total-amount {
  color: var(--color-text);
}

.cart-empty {
  text-align: center;
  padding: var(--space-2xl);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-lg);
}

.cart-empty-icon {
  font-size: 48px;
  margin-bottom: var(--space-md);
  opacity: 0.5;
}

.cart-empty h2 {
  font-size: 18px;
  margin-bottom: var(--space-sm);
}

.cart-empty p {
  color: var(--color-text-secondary);
  margin-bottom: var(--space-lg);
}

/* ─── Cart Drawer ─────────────────────────────────────────────── */
.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

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

.cart-drawer {
  position: fixed;
  top: 0;
  right: -400px;
  width: 380px;
  max-width: 90vw;
  height: 100vh;
  background: var(--color-bg);
  z-index: 1200;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 12px rgba(0,0,0,0.15);
  transition: right 0.3s ease;
}

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

.cart-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--color-border);
}

.cart-drawer-header h2 {
  font-size: 18px;
  font-weight: 700;
}

.cart-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: 4px 8px;
}

.cart-close:hover {
  color: var(--color-text);
}

.cart-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-md);
}

.cart-drawer-empty {
  text-align: center;
  padding: var(--space-2xl) var(--space-md);
  color: var(--color-text-secondary);
}

.cart-drawer-empty-icon {
  font-size: 48px;
  margin-bottom: var(--space-md);
  opacity: 0.4;
}

.cart-drawer-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--color-border-light);
}

.cart-drawer-item-cover {
  width: 44px;
  height: 58px;
  border-radius: 3px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.cart-drawer-item-cover span {
  color: rgba(255,255,255,0.9);
  font-size: 7px;
  font-weight: 600;
  text-align: center;
  padding: 2px;
  line-height: 1.2;
}

.cart-drawer-item-info {
  flex: 1;
  min-width: 0;
}

.cart-drawer-item-title {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--color-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cart-drawer-item-price {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text);
  margin-top: 2px;
}

.cart-drawer-item-remove {
  background: none;
  border: none;
  color: var(--color-text-secondary);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  flex-shrink: 0;
}

.cart-drawer-item-remove:hover {
  color: var(--color-error);
}

.cart-drawer-footer {
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--color-border);
  background: var(--color-bg-secondary);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.cart-drawer-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-sm);
}

.cart-drawer-total-label {
  font-size: 14px;
  color: var(--color-text-secondary);
}

.cart-drawer-total-amount {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text);
}

/* ─── Toast Notifications ─────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: calc(var(--header-height) + var(--space-md));
  right: var(--space-md);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.toast {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-lg);
  padding: var(--space-md) var(--space-lg);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  color: var(--color-text);
  animation: toastIn 0.3s ease;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  max-width: 360px;
}

.toast.success {
  border-left: 4px solid var(--color-success);
}

.toast.error {
  border-left: 4px solid var(--color-error);
}

.toast.info {
  border-left: 4px solid var(--color-link);
}

.toast.exiting {
  animation: toastOut 0.3s ease forwards;
}

.toast-icon {
  font-size: 16px;
  flex-shrink: 0;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(20px); }
}

/* ─── Empty State ─────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: var(--space-2xl);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-lg);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: var(--space-md);
  opacity: 0.5;
}

.empty-state h2 {
  font-size: 18px;
  margin-bottom: var(--space-sm);
}

.empty-state p {
  color: var(--color-text-secondary);
  margin-bottom: var(--space-lg);
}

/* ─── Newsletter Section ──────────────────────────────────────── */
.newsletter-section {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-lg);
  padding: var(--space-xl);
  text-align: center;
  margin-top: var(--space-2xl);
}

/* ─── Footer ──────────────────────────────────────────────────── */
.site-footer {
  background: var(--color-footer-bg);
  color: #DDD;
  padding-top: var(--space-2xl);
  margin-top: var(--space-2xl);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-xl);
  padding-bottom: var(--space-xl);
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: var(--space-md);
}

.footer-logo .logo-img {
  height: 90px;
  border-radius: 5px;
}

.footer-logo .logo-text {
  font-family: var(--font-brand);
  font-size: 28px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 3px;
  text-transform: uppercase;
}

.footer-about {
  font-size: 13px;
  line-height: 1.6;
  color: #999;
}

.footer-heading {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin-bottom: var(--space-md);
}

.footer-links li {
  margin-bottom: var(--space-sm);
}

.footer-links a {
  color: #DDD;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.footer-links a:hover {
  color: #fff;
  text-decoration: underline;
}

.footer-contact li {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 13px;
  color: #999;
}

.footer-social {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-md);
}

.social-link {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-footer-light);
  border-radius: var(--border-radius);
  color: #DDD;
  font-size: 16px;
}

.social-link:hover {
  background: #C9A84C;
  color: #1B2744;
  text-decoration: none;
}

.footer-bottom {
  border-top: 1px solid var(--color-footer-light);
  padding: var(--space-lg) 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #888;
}

/* ─── Scroll Animation (subtle) ───────────────────────────────── */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ─── Loading Skeleton ────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--color-bg-tertiary) 25%, var(--color-bg-secondary) 50%, var(--color-bg-tertiary) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--border-radius);
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ─── Page Transition ─────────────────────────────────────────── */
.page-transition {
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ─── Bump animation for cart badge ───────────────────────────── */
.bump {
  animation: bump 0.2s ease;
}

@keyframes bump {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* ─── Responsive ──────────────────────────────────────────────── */

/* Large Tablet (1024px) */
@media (max-width: 1024px) {
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .book-detail-grid {
    grid-template-columns: 240px 1fr;
    gap: var(--space-lg);
  }

  .books-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }

  .categories-page-grid {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  }
}

/* Tablet / Mobile (768px) */
@media (max-width: 768px) {
  /* ── Container ── */
  .container {
    padding: 0 var(--space-md);
  }

  /* ── Header ── */
  .site-header {
    height: auto;
    padding: var(--space-sm) 0;
  }

  .header-inner {
    flex-wrap: wrap;
    gap: var(--space-sm);
    padding: 0 var(--space-md);
  }

  /* Row 1: logo | cart | hamburger */
  .logo {
    order: 0;
    padding: 4px 0;
    margin-right: 0;
  }

  .logo-img {
    height: 44px;
  }

  .logo-text {
    font-size: 18px;
    letter-spacing: 1px;
  }

  .cart-toggle {
    order: 1;
    margin-left: auto;
    padding: var(--space-sm);
  }

  .mobile-menu-btn {
    display: flex;
    order: 2;
  }

  /* Row 2: search (full width, always visible on mobile) */
  .search-wrapper {
    order: 3;
    width: 100%;
    max-width: none;
    display: block;
  }

  /* Prevent iOS auto-zoom on input focus */
  .search-input {
    font-size: 16px;
  }

  /* Row 3: nav links (full width, shown when menu open) */
  .main-nav {
    display: none;
    flex-direction: column;
    width: 100%;
    order: 4;
    background: var(--color-footer-light);
    border-radius: var(--border-radius);
    overflow: hidden;
  }

  .main-nav.open {
    display: flex;
  }

  .nav-link {
    padding: var(--space-md);
    border-radius: 0;
    border: none;
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }

  .nav-link:last-child {
    border-bottom: none;
  }

  .nav-link:hover {
    background: rgba(255,255,255,0.1);
    border: none;
  }

  /* ── Hero ── */
  .hero {
    padding: var(--space-xl) 0;
  }

  .hero h1 {
    font-size: 26px;
  }

  .hero-subtitle {
    font-size: 14px;
  }

  .hero-actions {
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
  }

  .hero-actions .btn {
    width: 100%;
    max-width: 280px;
  }

  .hero-stats {
    gap: var(--space-md);
  }

  .hero-stat-value {
    font-size: 20px;
  }

  /* ── Books Grid ── */
  .books-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: var(--space-sm);
  }

  .book-cover {
    height: 160px;
  }

  /* ── Categories ── */
  .categories-grid,
  .categories-page-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  }

  /* ── Category Page Header ── */
  .category-page-header {
    flex-direction: column;
    text-align: center;
    gap: var(--space-md);
    padding: var(--space-md);
  }

  .category-page-icon {
    font-size: 36px;
  }

  .category-page-info h1 {
    font-size: 20px;
  }

  /* ── All Books ── */
  .all-books-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }

  .all-books-header h1 {
    font-size: 18px;
  }

  .all-books-controls {
    width: 100%;
    justify-content: flex-start;
  }

  .filter-select,
  .sort-select {
    flex: 1;
    font-size: 14px;
  }

  .category-filter-pills {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: var(--space-sm);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .category-filter-pills::-webkit-scrollbar {
    display: none;
  }

  /* ── Book Detail ── */
  .book-detail-grid {
    grid-template-columns: 1fr;
    padding: var(--space-md);
    gap: var(--space-md);
  }

  .book-detail-cover {
    height: 260px;
    max-width: 260px;
    margin: 0 auto;
  }

  .book-detail-title {
    font-size: 20px;
  }

  .book-detail-meta-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .book-detail-price-row {
    flex-wrap: wrap;
    gap: var(--space-md);
  }

  .book-detail-add-btn {
    width: 100%;
  }

  /* ── Cart Page ── */
  .cart-page h1 {
    font-size: 20px;
  }

  .cart-item {
    flex-wrap: wrap;
    gap: var(--space-sm);
  }

  /* ── Toast ── */
  .toast-container {
    left: var(--space-md);
    right: var(--space-md);
  }

  .toast {
    max-width: 100%;
  }

  /* ── Footer ── */
  .footer-grid {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }

  .footer-logo .logo-img {
    height: 70px;
  }

  .footer-logo .logo-text {
    font-size: 22px;
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
    gap: var(--space-sm);
  }
}

/* Small Mobile (480px) */
@media (max-width: 480px) {
  /* ── Container ── */
  .container {
    padding: 0 10px;
  }

  .header-inner {
    padding: 0 10px;
  }

  /* ── Logo ── */
  .logo-img {
    height: 36px;
  }

  .logo-text {
    font-size: 15px;
    letter-spacing: 1px;
  }

  /* ── Hero ── */
  .hero {
    padding: var(--space-lg) 0;
  }

  .hero h1 {
    font-size: 22px;
  }

  .hero-subtitle {
    font-size: 13px;
  }

  .hero-stat-value {
    font-size: 18px;
  }

  /* ── Books Grid ── */
  .books-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
  }

  .book-cover {
    height: 140px;
  }

  .book-cover-title {
    font-size: 12px;
  }

  .book-info {
    padding: var(--space-sm);
  }

  .book-title {
    font-size: 13px;
  }

  .book-price {
    font-size: 15px;
  }

  .btn-add-to-cart {
    font-size: 12px;
    padding: 6px 10px;
  }

  .book-card-actions {
    padding: 0 var(--space-sm) var(--space-sm);
  }

  /* ── Categories ── */
  .categories-grid,
  .categories-page-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* ── Book Detail ── */
  .book-detail-meta-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* ── Section Title ── */
  .section-title {
    font-size: 18px;
  }

  /* ── Footer ── */
  .footer-logo .logo-img {
    height: 55px;
  }

  .footer-logo .logo-text {
    font-size: 18px;
  }
}

/* ═══════════════════════════════════════════════════════════════
   AUTH & USER COMPONENTS
   Header actions, sign-in, user menu, auth pages, library
   ═══════════════════════════════════════════════════════════════ */

/* ─── Header Actions Container ────────────────────────────────── */
.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-shrink: 0;
}

/* ─── Sign In Button (Header) ─────────────────────────────────── */
.btn-header-signin {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: var(--border-radius);
  padding: var(--space-sm) var(--space-md);
  color: var(--color-header-text);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
  text-decoration: none;
  line-height: 1.4;
}

.btn-header-signin:hover {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  text-decoration: none;
}

.btn-header-signin .signin-icon {
  font-size: 16px;
  line-height: 1;
}

.btn-header-signin .signin-text {
  /* text label next to icon */
}

/* ─── User Menu ───────────────────────────────────────────────── */
.user-menu-wrapper {
  position: relative;
}

.user-menu-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: none;
  border: 1px solid transparent;
  border-radius: var(--border-radius);
  padding: 4px;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.user-menu-toggle:hover {
  border-color: rgba(255, 255, 255, 0.5);
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-accent), var(--color-accent-dark));
  color: var(--color-header-bg);
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  flex-shrink: 0;
  letter-spacing: 0;
  line-height: 1;
  user-select: none;
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 240px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 1100;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
  overflow: hidden;
}

.user-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.user-dropdown-header {
  padding: var(--space-md);
  border-bottom: 1px solid var(--color-border-light);
  background: var(--color-bg-secondary);
}

.user-dropdown-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.3;
}

.user-dropdown-email {
  font-size: 12px;
  color: var(--color-text-secondary);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-dropdown-menu {
  padding: var(--space-xs) 0;
}

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
  padding: 10px var(--space-md);
  background: none;
  border: none;
  color: var(--color-text);
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease;
  text-align: left;
}

.user-dropdown-item:hover {
  background: var(--color-bg-secondary);
  color: var(--color-text);
  text-decoration: none;
}

.user-dropdown-item .dropdown-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  opacity: 0.7;
}

.user-dropdown-divider {
  height: 1px;
  background: var(--color-border-light);
  margin: var(--space-xs) 0;
}

.user-dropdown-item--danger {
  color: var(--color-error);
}

.user-dropdown-item--danger:hover {
  background: #FEF2F2;
  color: var(--color-error);
}

/* ─── Nav Auth Link ───────────────────────────────────────────── */
.nav-link-auth {
  color: var(--color-header-text);
  padding: var(--space-sm) var(--space-md);
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
  border-radius: var(--border-radius);
  white-space: nowrap;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.nav-link-auth:hover {
  border-color: #fff;
  text-decoration: none;
  color: #fff;
}

.nav-link-auth.active {
  color: var(--color-accent);
  border-color: rgba(201, 168, 76, 0.3);
}

.nav-link-auth.active:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

/* ─── Auth Pages ──────────────────────────────────────────────── */
.auth-page {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: calc(100vh - var(--header-height) - 200px);
  padding: var(--space-2xl) var(--space-md);
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-lg);
  padding: 40px;
  box-shadow: var(--shadow-card);
}

/* ─── Auth Forms ──────────────────────────────────────────────── */
.auth-form-title {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-xs);
  line-height: 1.3;
}

.auth-form-subtitle {
  font-size: 14px;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-xl);
  line-height: 1.5;
}

.auth-form-group {
  margin-bottom: var(--space-lg);
}

.auth-form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.auth-form-input-wrapper {
  position: relative;
}

.auth-form-input {
  display: block;
  width: 100%;
  height: 44px;
  padding: 0 14px;
  font-size: 14px;
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-form-input::placeholder {
  color: var(--color-text-muted);
}

.auth-form-input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.15);
}

.auth-form-input.error {
  border-color: var(--color-error);
  box-shadow: 0 0 0 3px rgba(204, 12, 57, 0.1);
}

.auth-form-input.error:focus {
  border-color: var(--color-error);
  box-shadow: 0 0 0 3px rgba(204, 12, 57, 0.15);
}

.auth-form-error {
  display: block;
  font-size: 12px;
  color: var(--color-error);
  margin-top: 4px;
  line-height: 1.4;
}

/* Password visibility toggle */
.auth-password-toggle {
  position: absolute;
  right: 1px;
  top: 1px;
  bottom: 1px;
  width: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 16px;
  cursor: pointer;
  border-radius: 0 var(--border-radius) var(--border-radius) 0;
  transition: color 0.2s ease;
}

.auth-password-toggle:hover {
  color: var(--color-text-secondary);
}

.auth-form-input[type="password"] ~ .auth-password-toggle,
.auth-form-input[type="text"] ~ .auth-password-toggle {
  /* Ensure it sits within the input visually */
}

.auth-form-input-wrapper .auth-form-input {
  padding-right: 44px;
}

/* Submit button */
.auth-form-submit {
  display: block;
  width: 100%;
  height: 44px;
  padding: 0 var(--space-lg);
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--border-radius-lg);
  border: 1px solid;
  cursor: pointer;
  background: linear-gradient(to bottom, #D9BC6E, #C9A84C);
  border-color: #9A7820 #8A6C16 #7A5E10;
  color: #1B2744;
  transition: background 0.15s ease, opacity 0.2s ease;
  margin-top: var(--space-lg);
}

.auth-form-submit:hover {
  background: linear-gradient(to bottom, #C9A84C, #B8922A);
}

.auth-form-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.auth-form-submit:disabled:hover {
  background: linear-gradient(to bottom, #D9BC6E, #C9A84C);
}

/* Footer links below form */
.auth-form-footer {
  text-align: center;
  margin-top: var(--space-lg);
  font-size: 14px;
  color: var(--color-text-secondary);
}

.auth-form-footer a {
  color: var(--color-link);
  font-weight: 500;
  text-decoration: none;
}

.auth-form-footer a:hover {
  color: var(--color-link-hover);
  text-decoration: underline;
}

/* General auth error banner (e.g. "Invalid credentials") */
.auth-error-banner {
  background: #FEF2F2;
  border: 1px solid rgba(204, 12, 57, 0.2);
  border-radius: var(--border-radius);
  padding: var(--space-sm) var(--space-md);
  margin-bottom: var(--space-lg);
  font-size: 13px;
  color: var(--color-error);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.auth-error-banner .error-icon {
  font-size: 16px;
  flex-shrink: 0;
}

/* ─── Library Page ────────────────────────────────────────────── */
.library-page {
  max-width: var(--max-width);
}

.library-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
  gap: var(--space-md);
}

.library-header h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--color-text);
}

.library-book-count {
  font-size: 14px;
  color: var(--color-text-secondary);
  font-weight: 400;
}

.library-book-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  transition: box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
  position: relative;
}

.library-book-card:hover {
  box-shadow: var(--shadow-lg);
}

.library-book-card .book-cover {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  padding: var(--space-md);
  text-decoration: none;
  position: relative;
}

.library-book-card .book-info {
  padding: var(--space-md);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.library-book-card .book-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-link);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
}

.library-book-card .book-author {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-sm);
}

.library-book-actions {
  padding: 0 var(--space-md) var(--space-md);
}

.library-download-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 20px;
  border: 1px solid;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
  background: linear-gradient(to bottom, #0A9E7A, #067D62);
  border-color: #056B54 #04574A #044A3F;
  color: #fff;
}

.library-download-btn:hover {
  background: linear-gradient(to bottom, #067D62, #056B54);
  text-decoration: none;
  color: #fff;
}

.library-download-btn:disabled {
  opacity: 0.7;
  cursor: wait;
}

.library-download-btn .download-icon {
  font-size: 14px;
}

/* Library empty state */
.library-empty {
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-lg);
}

.library-empty-icon {
  font-size: 48px;
  margin-bottom: var(--space-md);
  opacity: 0.4;
}

.library-empty h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-sm);
}

.library-empty p {
  font-size: 14px;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-lg);
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.library-empty .btn {
  /* uses existing .btn + .btn-primary classes */
}

/* Owned badge — overlays on book cards */
.library-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  background: rgba(6, 125, 98, 0.92);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 3px;
  z-index: 2;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  line-height: 1;
  backdrop-filter: blur(4px);
}

.library-badge .badge-icon {
  font-size: 12px;
}

/* ─── Responsive — Auth & User Components ─────────────────────── */

/* Tablet / Mobile (768px) */
@media (max-width: 768px) {
  /* ── Header Actions ── */
  .header-actions {
    gap: 4px;
  }

  /* ── Sign In Button — icon only on mobile ── */
  .btn-header-signin .signin-text {
    display: none;
  }

  .btn-header-signin {
    padding: var(--space-sm);
    gap: 0;
  }

  .btn-header-signin .signin-icon {
    font-size: 18px;
  }

  /* ── User Menu ── */
  .user-avatar {
    width: 30px;
    height: 30px;
    font-size: 13px;
  }

  .user-dropdown {
    position: fixed;
    top: auto;
    right: var(--space-md);
    left: var(--space-md);
    bottom: auto;
    min-width: 0;
    width: auto;
    max-width: none;
  }

  /* ── Auth Page ── */
  .auth-page {
    padding: var(--space-lg) var(--space-md);
    align-items: flex-start;
  }

  .auth-card {
    padding: var(--space-lg);
    border-radius: var(--border-radius);
    box-shadow: none;
    border-left: none;
    border-right: none;
    border-radius: 0;
    max-width: none;
  }

  .auth-form-title {
    font-size: 20px;
  }

  /* ── Library Page ── */
  .library-header h1 {
    font-size: 20px;
  }

  .library-book-card .book-cover {
    height: 160px;
  }

  .library-empty {
    padding: var(--space-xl) var(--space-md);
  }
}

/* Small Mobile (480px) */
@media (max-width: 480px) {
  .auth-page {
    padding: var(--space-md) 0;
  }

  .auth-card {
    padding: var(--space-lg) var(--space-md);
  }

  .auth-form-title {
    font-size: 18px;
  }

  .auth-form-subtitle {
    font-size: 13px;
  }

  .library-book-card .book-cover {
    height: 140px;
  }

  .library-download-btn {
    font-size: 12px;
    padding: 6px 10px;
  }

  .library-book-actions {
    padding: 0 var(--space-sm) var(--space-sm);
  }
}

/* ─── Auth Card Header & Icon ─────────────────────────────────── */
.auth-card-header {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.auth-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-bg-secondary);
  margin: 0 auto var(--space-md);
  border: 1px solid var(--color-border-light);
}

/* ─── Password Input Wrapper ──────────────────────────────────── */
.auth-input-wrapper {
  position: relative;
}

.auth-input-wrapper .auth-form-input {
  padding-right: 44px;
}

.auth-input-wrapper .auth-password-toggle {
  position: absolute;
  right: 1px;
  top: 1px;
  bottom: 1px;
}

/* ─── Password Strength Indicator ─────────────────────────────── */
.auth-password-strength {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 500;
  min-height: 18px;
}

.strength-weak {
  color: var(--color-error);
}

.strength-medium {
  color: #D4880F;
}

.strength-strong {
  color: var(--color-success);
}

/* ─── Library Owned Badge ─────────────────────────────────────── */
.library-owned-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(6, 125, 98, 0.9);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  backdrop-filter: blur(4px);
  z-index: 2;
  letter-spacing: 0.3px;
}

/* ─── Library Date ────────────────────────────────────────────── */
.library-date {
  font-size: 11px;
  color: var(--color-text-muted);
}

/* ─── Auth Error Banner (reused) ──────────────────────────────── */
.auth-form-error {
  background: rgba(204, 12, 57, 0.06);
  border: 1px solid rgba(204, 12, 57, 0.15);
  border-radius: var(--border-radius);
  padding: 10px 14px;
  margin-bottom: var(--space-md);
  font-size: 13px;
  color: var(--color-error);
  line-height: 1.4;
}
