/* ==============================================================
   Libros P2P — Design System
   Tema: Cálido, Acogedor y Amigable (Warm Paper & Terracotta)
   ============================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&family=Playfair+Display:ital,wght@0,600;0,700;1,600&display=swap');

/* ── Variables ────────────────────────────────────────────────── */
:root {
  --bg-0:         #FAF6F0; /* Crema cálido pergamino */
  --bg-1:         #FFFFFF; /* Blanco cálido purificado */
  --bg-2:         #F3ECE2; /* Tono papel suave */
  --bg-card:      #FFFFFF;
  --bg-card-2:    #FFFDF9;
  --bg-input:     #FFFFFF;
  --border:       #E8DFD5;
  --border-focus: #D97706;

  --amber:        #D97706; /* Terracota / Ámbar Cálido */
  --amber-light:  #F59E0B;
  --amber-dark:   #B45309;
  --purple:       #7E22CE; /* Púrpura cálido */
  --purple-dark:  #6B21A8;
  --teal:         #0D9488;
  --success:      #16A34A; /* Verde hoja fresco */
  --danger:       #DC2626;
  --warning:      #D97706;
  --info:         #2563EB;

  --text-1:       #292524; /* Café/Carbón cálido oscuro */
  --text-2:       #44403C; /* Café medio */
  --text-3:       #78716C; /* Café suave neutro */
  --text-4:       #A8A29E; /* Arena suave */

  --grad-hero:    linear-gradient(135deg, #FAF6F0 0%, #F4ECE1 50%, #FAF6F0 100%);
  --grad-amber:   linear-gradient(135deg, #E06D19, #D97706);
  --grad-purple:  linear-gradient(135deg, #9333EA, #7E22CE);
  --grad-card:    linear-gradient(145deg, #FFFFFF, #FAF6F0);
  --grad-glass:   linear-gradient(145deg, rgba(255,255,255,0.95), rgba(250,246,240,0.85));

  --shadow-sm:    0 2px 8px rgba(80, 50, 20, 0.05);
  --shadow-md:    0 6px 20px rgba(80, 50, 20, 0.07);
  --shadow-lg:    0 12px 36px rgba(80, 50, 20, 0.1);
  --shadow-glow:  0 0 30px rgba(217, 119, 6, 0.18);
  --shadow-card:  0 4px 18px rgba(80, 50, 20, 0.05), 0 1px 0 rgba(255,255,255,0.9) inset;

  --radius-xs:    6px;
  --radius-sm:    10px;
  --radius-md:    16px;
  --radius-lg:    24px;
  --radius-xl:    36px;
  --radius-full:  9999px;

  --transition:   0.2s cubic-bezier(0.4,0,0.2,1);
  --transition-slow: 0.4s cubic-bezier(0.4,0,0.2,1);

  --nav-h:        68px;
}

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

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
  background: var(--bg-0);
  color: var(--text-1);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: var(--amber); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--amber-dark); }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }

h1, h2, h3, h4 {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-1);
}

/* ── Scrollbar ─────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-0); }
::-webkit-scrollbar-thumb { background: #D6CBC0; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #B8A898; }

/* ── Layout ────────────────────────────────────────────────────── */
.container { max-width: 1240px; margin: 0 auto; padding: 0 24px; }
.page-content { padding-top: calc(var(--nav-h) + 32px); padding-bottom: 80px; min-height: 100vh; }

/* ── Navbar ────────────────────────────────────────────────────── */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: rgba(255, 253, 249, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  display: flex;
  align-items: center;
  box-shadow: 0 2px 12px rgba(80, 50, 20, 0.04);
}

.navbar .container {
  display: flex;
  align-items: center;
  gap: 24px;
  width: 100%;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-1) !important;
  white-space: nowrap;
}

.navbar-brand .brand-icon {
  width: 40px; height: 40px;
  background: var(--grad-amber);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.25);
  color: #ffffff;
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  margin-left: 16px;
}

.navbar-nav a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-2);
  transition: all var(--transition);
}

.navbar-nav a:hover {
  color: var(--amber);
  background: rgba(217, 119, 6, 0.06);
}

.navbar-nav a.active {
  color: var(--amber);
  background: rgba(217, 119, 6, 0.1);
  font-weight: 700;
}

.navbar-spacer { flex: 1; }

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

/* Notif bell */
.notif-btn {
  position: relative;
  width: 42px; height: 42px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2);
  transition: all var(--transition);
  font-size: 1.15rem;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}
.notif-btn:hover { background: #FFFDF9; border-color: var(--amber); color: var(--amber); }

.notif-badge {
  position: absolute;
  top: -4px; right: -4px;
  min-width: 18px; height: 18px;
  background: var(--danger);
  border-radius: var(--radius-full);
  font-size: 0.65rem;
  font-weight: 700;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--bg-1);
}

/* User avatar dropdown */
.user-menu { position: relative; }

.user-avatar-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 14px 6px 6px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-1);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}
.user-avatar-btn:hover { border-color: var(--amber); background: #FFFDF9; }

.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--grad-purple);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  overflow: hidden;
  flex-shrink: 0;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 210px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: all var(--transition);
  z-index: 100;
}
.user-menu:hover .dropdown-menu,
.user-menu:focus-within .dropdown-menu {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.dropdown-menu a,
.dropdown-menu button {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-xs);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-2);
  transition: all var(--transition);
  background: none;
  border: none;
  text-align: left;
}
.dropdown-menu a:hover,
.dropdown-menu button:hover {
  background: rgba(217, 119, 6, 0.08);
  color: var(--amber-dark);
}
.dropdown-menu .divider {
  height: 1px;
  background: var(--border);
  margin: 6px 0;
}
.dropdown-menu .danger:hover { color: var(--danger); background: #FEF2F2; }

/* ── Buttons ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 24px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: 0.01em;
  line-height: 1;
}
.btn:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

.btn-primary {
  background: var(--grad-amber);
  color: #FFFFFF;
  box-shadow: 0 4px 14px rgba(217,119,6,0.25);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(217,119,6,0.38);
  color: #FFFFFF;
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--bg-1);
  color: var(--text-1);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { border-color: var(--amber); color: var(--amber); background: #FFFDF9; transform: translateY(-1px); }

.btn-purple {
  background: var(--grad-purple);
  color: #fff;
  box-shadow: 0 4px 14px rgba(147,51,234,0.25);
}
.btn-purple:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(147,51,234,0.38); color: #fff; }

.btn-success {
  background: var(--success);
  color: #fff;
  box-shadow: 0 4px 12px rgba(22,163,74,0.2);
}
.btn-success:hover { background: #15803d; color: #fff; transform: translateY(-1px); }

.btn-danger {
  background: #FEF2F2;
  color: var(--danger);
  border: 1px solid #FECACA;
}
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

.btn-sm { padding: 8px 16px; font-size: 0.82rem; }
.btn-lg { padding: 15px 34px; font-size: 1rem; }
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ── Cards ─────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: all var(--transition);
}
.card:hover { border-color: #D6CBC0; box-shadow: var(--shadow-md); }

.card-body { padding: 28px; }
.card-header { padding: 20px 28px; border-bottom: 1px solid var(--border); background: #FAF7F2; }
.card-footer { padding: 18px 28px; border-top: 1px solid var(--border); background: #FAF7F2; }

/* Book Cards */
.book-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all var(--transition-slow);
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: var(--shadow-card);
}

.book-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-md), var(--shadow-glow);
  border-color: var(--amber-light);
}

.book-cover-wrap {
  position: relative;
  aspect-ratio: 3/4;
  background: var(--bg-2);
  overflow: hidden;
}
.book-cover-wrap img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}
.book-card:hover .book-cover-wrap img { transform: scale(1.05); }

.book-cover-placeholder {
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 8px;
  color: var(--text-3);
  font-size: 3rem;
  background: #F3ECE2;
}
.book-cover-placeholder span { font-size: 0.78rem; font-family: 'Plus Jakarta Sans', sans-serif; color: var(--text-3); }

.book-badge {
  position: absolute;
  top: 10px; left: 10px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.badge-new    { background: #DCFCE7; color: #15803D; border: 1px solid #BBF7D0; }
.badge-good   { background: #FEF3C7; color: #B45309; border: 1px solid #FDE68A; }
.badge-fair   { background: #DBEAFE; color: #1D4ED8; border: 1px solid #BFDBFE; }
.badge-poor   { background: #FEE2E2; color: #B91C1C; border: 1px solid #FECACA; }

.book-info { padding: 18px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.book-title { font-size: 1rem; font-weight: 700; color: var(--text-1); line-height: 1.35; }
.book-author { font-size: 0.85rem; color: var(--text-3); }
.book-genre-tag {
  display: inline-flex; align-items: center;
  padding: 4px 12px;
  background: #F3E8FF;
  border: 1px solid #E9D5FF;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  color: var(--purple);
  font-weight: 600;
  width: fit-content;
}

.book-owner {
  display: flex; align-items: center; gap: 8px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.book-owner-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--grad-purple);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.65rem; font-weight: 700; color: #fff;
  overflow: hidden; flex-shrink: 0;
}
.book-owner-name { font-size: 0.8rem; font-weight: 600; color: var(--text-2); }
.book-owner-city { font-size: 0.75rem; color: var(--text-3); }

/* ── Forms ─────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 0.88rem; font-weight: 600; color: var(--text-1); }
.form-label .required { color: var(--danger); margin-left: 3px; }

.form-control {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-1);
  font-size: 0.92rem;
  transition: all var(--transition);
  outline: none;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.02);
}
.form-control::placeholder { color: var(--text-4); }
.form-control:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 3.5px rgba(217,119,6,0.15);
  background: #FFFFFF;
}
.form-control:focus-visible { outline: none; }

select.form-control { cursor: pointer; }

textarea.form-control { resize: vertical; min-height: 110px; }

.form-hint { font-size: 0.8rem; color: var(--text-3); }

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

.form-stack { display: flex; flex-direction: column; gap: 20px; }

/* File input */
.file-upload-wrapper { position: relative; }
.file-upload-label {
  display: flex; align-items: center; gap: 14px;
  padding: 18px;
  border: 2px dashed #D6CBC0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-2);
  font-size: 0.9rem;
  background: #FAF7F2;
}
.file-upload-label:hover { border-color: var(--amber); color: var(--amber); background: #FFFDF9; }
.file-upload-label .upload-icon { font-size: 1.6rem; }

input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
}

/* Star rating (interactive) */
.star-rating-input {
  display: flex;
  flex-direction: row-reverse;
  gap: 6px;
}
.star-rating-input input { display: none; }
.star-rating-input label {
  font-size: 2rem;
  color: #D6CBC0;
  cursor: pointer;
  transition: color var(--transition);
}
.star-rating-input input:checked ~ label,
.star-rating-input label:hover,
.star-rating-input label:hover ~ label { color: var(--amber); }

/* ── Alerts / Flash messages ──────────────────────────────────── */
.alert {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 500;
  border-left: 4px solid;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  animation: slideDown 0.3s ease;
}
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

.alert-icon { flex-shrink: 0; margin-top: 1px; font-size: 1.1rem; }
.alert-close {
  margin-left: auto;
  background: none; border: none;
  color: inherit; opacity: 0.6;
  cursor: pointer; font-size: 1.2rem;
  padding: 0; line-height: 1;
  transition: opacity var(--transition);
  flex-shrink: 0;
}
.alert-close:hover { opacity: 1; }

.alert-success { background: #F0FDF4; border-color: var(--success); color: #166534; }
.alert-error   { background: #FEF2F2; border-color: var(--danger);  color: #991B1B; }
.alert-warning { background: #FFFBEB; border-color: var(--warning); color: #92400E; }
.alert-info    { background: #EFF6FF; border-color: var(--info);    color: #1E40AF; }

/* ── Badges ────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-success { background: #DCFCE7; color: #15803D; border: 1px solid #BBF7D0; }
.badge-warning { background: #FEF3C7; color: #B45309; border: 1px solid #FDE68A; }
.badge-danger  { background: #FEE2E2; color: #B91C1C; border: 1px solid #FECACA; }
.badge-info    { background: #DBEAFE; color: #1D4ED8; border: 1px solid #BFDBFE; }
.badge-muted   { background: #F3ECE2; color: #78716C; border: 1px solid #E8DFD5; }
.badge-purple  { background: #F3E8FF; color: #7E22CE; border: 1px solid #E9D5FF; }
.badge-teal    { background: #CCFBF1; color: #0F766E; border: 1px solid #99F6E4; }

/* ── Stars display ──────────────────────────────────────────────── */
.stars-display { display: inline-flex; gap: 3px; }
.star-filled { color: var(--amber); }
.star-empty  { color: #D6CBC0; }

/* ── Avatar helpers ─────────────────────────────────────────────── */
.avatar {
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  overflow: hidden;
}
.avatar-placeholder {
  background: var(--grad-purple);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700;
  border-radius: 50%;
  flex-shrink: 0;
}
.avatar-sm { width: 34px; height: 34px; font-size: 0.8rem; }
.avatar-md { width: 50px; height: 50px; font-size: 1.1rem; }
.avatar-lg { width: 84px; height: 84px; font-size: 1.6rem; }
.avatar-xl { width: 124px; height: 124px; font-size: 2.2rem; }

/* ── Section headers ──────────────────────────────────────────── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 32px;
  gap: 16px;
}
.section-title { font-size: 1.8rem; font-weight: 700; color: var(--text-1); }
.section-title span { color: var(--amber); }
.section-sub { font-size: 0.95rem; color: var(--text-3); margin-top: 4px; }

/* ── Grid layouts ─────────────────────────────────────────────── */
.books-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 24px; }
.books-grid-3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 28px; }

/* ── Pagination ───────────────────────────────────────────────── */
.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; margin-top: 44px;
}
.page-link {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-2);
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: all var(--transition);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}
.page-link:hover { border-color: var(--amber); color: var(--amber); background: #FFFDF9; }
.page-link.active { background: var(--amber); color: #ffffff; border-color: var(--amber); font-weight: 700; }
.page-link.disabled { opacity: 0.4; pointer-events: none; }

/* ── Empty state ──────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 80px 24px;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.empty-state-icon { font-size: 4.5rem; opacity: 0.6; }
.empty-state h3 { font-size: 1.4rem; color: var(--text-1); }
.empty-state p { color: var(--text-3); max-width: 420px; }

/* ── Divider ──────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 24px 0; }

/* ── Stat cards ───────────────────────────────────────────────── */
.home-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  max-width: 800px;
  margin: 0 auto;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px 18px;
  text-align: center;
  transition: all var(--transition);
  box-shadow: var(--shadow-card);
  word-break: break-word;
  overflow: hidden;
}
.stat-card:hover { border-color: var(--amber); transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-number { font-size: clamp(2.2rem, 5vw, 2.8rem); font-weight: 700; font-family: 'Playfair Display', serif; color: var(--amber); line-height: 1.1; }
.stat-label { font-size: 0.88rem; font-weight: 600; color: var(--text-3); margin-top: 6px; line-height: 1.3; }

/* ── Table responsive wrapper ──────────────────────────────────── */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 20px;
  border-radius: var(--radius-sm);
}

/* ── Hero section ─────────────────────────────────────────────── */
.hero {
  min-height: 540px;
  display: flex; align-items: center;
  background: var(--grad-hero);
  position: relative;
  overflow: hidden;
  padding: calc(var(--nav-h) + 60px) 0 80px;
  border-bottom: 1px solid var(--border);
}
.hero::before {
  content: '';
  position: absolute;
  width: 650px; height: 650px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(224,109,25,0.1) 0%, transparent 70%);
  top: -100px; right: -100px;
  pointer-events: none;
}
.hero::after {
  content: '';
  position: absolute;
  width: 450px; height: 450px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(147,51,234,0.06) 0%, transparent 70%);
  bottom: -80px; left: 15%;
  pointer-events: none;
}
.hero .container { position: relative; z-index: 1; }
.hero-content { max-width: 640px; }

.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 16px;
  background: #FEF3C7;
  border: 1px solid #FDE68A;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--amber-dark);
  margin-bottom: 22px;
}

.hero h1 {
  font-size: clamp(2.4rem, 5.5vw, 3.4rem);
  line-height: 1.15;
  margin-bottom: 20px;
  color: var(--text-1);
}
.hero h1 .highlight {
  color: var(--amber);
  background: var(--grad-amber);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p { font-size: 1.15rem; color: var(--text-2); margin-bottom: 36px; max-width: 520px; line-height: 1.7; }

.hero-actions { display: flex; gap: 16px; flex-wrap: wrap; }

/* ── How it works ─────────────────────────────────────────────── */
.step-card {
  text-align: center;
  padding: 36px 28px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  transition: all var(--transition);
}
.step-card:hover { transform: translateY(-4px); border-color: var(--amber); box-shadow: var(--shadow-md); }
.step-number {
  width: 54px; height: 54px;
  background: var(--grad-amber);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0 auto 18px;
  box-shadow: 0 4px 16px rgba(217,119,6,0.3);
}
.step-card h3 { font-size: 1.2rem; margin-bottom: 10px; color: var(--text-1); }
.step-card p { font-size: 0.9rem; color: var(--text-3); }

/* ── Exchange timeline ────────────────────────────────────────── */
.exchange-status-bar {
  display: flex; align-items: center;
  gap: 0;
  margin-bottom: 32px;
  overflow-x: auto;
  padding-bottom: 8px;
}
.status-step { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.status-dot {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg-card);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem;
  color: var(--text-3);
  transition: all var(--transition);
}
.status-dot.done { background: var(--success); border-color: var(--success); color: #fff; }
.status-dot.current { background: var(--amber); border-color: var(--amber); color: #fff; box-shadow: 0 0 0 4px rgba(217,119,6,0.2); }
.status-line { width: 44px; height: 2px; background: var(--border); flex-shrink: 0; }
.status-line.done { background: var(--success); }
.status-label { font-size: 0.75rem; font-weight: 600; color: var(--text-3); margin-top: 4px; }

/* ── Notifications ────────────────────────────────────────────── */
.notif-item {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 18px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: #FAF6F0; }
.notif-item.unread { background: #FEF3C7; border-left: 3px solid var(--amber); }
.notif-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--amber); flex-shrink: 0; margin-top: 6px; }
.notif-text { font-size: 0.9rem; color: var(--text-2); line-height: 1.5; }
.notif-time { font-size: 0.78rem; color: var(--text-3); margin-top: 4px; }
.notif-link { color: var(--amber); font-weight: 600; }

/* ── Footer ────────────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  background: #F3ECE2;
  padding: 40px 0;
  margin-top: 80px;
  text-align: center;
  font-size: 0.88rem;
  color: var(--text-3);
}
footer a { color: var(--amber-dark); font-weight: 600; }

/* ── Utilities ─────────────────────────────────────────────────── */
.text-amber   { color: var(--amber); }
.text-muted   { color: var(--text-3); }
.text-danger  { color: var(--danger); }
.text-success { color: var(--success); }
.text-center  { text-align: center; }
.text-sm      { font-size: 0.88rem; }
.text-xs      { font-size: 0.78rem; }
.fw-bold      { font-weight: 700; }
.d-flex       { display: flex; }
.align-center { align-items: center; }
.gap-8        { gap: 8px; }
.gap-12       { gap: 12px; }
.gap-16       { gap: 16px; }
.mt-8         { margin-top: 8px; }
.mt-16        { margin-top: 16px; }
.mt-24        { margin-top: 24px; }
.mt-32        { margin-top: 32px; }
.mb-8         { margin-bottom: 8px; }
.mb-16        { margin-bottom: 16px; }
.mb-24        { margin-bottom: 24px; }
.mb-32        { margin-bottom: 32px; }

/* ── Filter bar ────────────────────────────────────────────────── */
.filter-bar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px 28px;
  margin-bottom: 36px;
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 18px;
  box-shadow: var(--shadow-card);
}
.filter-bar .form-group { flex: 1; min-width: 170px; }
.filter-bar .btn { align-self: flex-end; flex-shrink: 0; height: 44px; }

/* ── Profile page ─────────────────────────────────────────────── */
.profile-hero {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  display: flex;
  align-items: center;
  gap: 32px;
  margin-bottom: 36px;
  box-shadow: var(--shadow-card);
}
.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 20px;
}
.profile-stat { text-align: center; background: #FAF6F0; padding: 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.profile-stat-num { font-size: 1.6rem; font-weight: 700; color: var(--amber); font-family: 'Playfair Display', serif; }
.profile-stat-lbl { font-size: 0.78rem; font-weight: 600; color: var(--text-3); }

/* ── Responsive Media Queries ───────────────────────────────────── */
@media (max-width: 768px) {
  .home-stats-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .container { padding: 0 16px; }
  .navbar-nav { display: none; }
  .form-row { grid-template-columns: 1fr; }
  .hero h1 { font-size: 2.1rem; }
  .hero-actions { flex-direction: column; }
  .hero-actions .btn { width: 100%; text-align: center; }
  .books-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }
  .profile-hero { flex-direction: column; text-align: center; }
  .filter-bar { flex-direction: column; align-items: stretch; padding: 18px; }
  .filter-bar .form-group { width: 100%; min-width: 0; }
  .section-header { flex-direction: column; align-items: flex-start; gap: 12px; }
}

@media (max-width: 480px) {
  .user-avatar-btn span:not(.user-avatar) { display: none; }
  .books-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat-card { padding: 20px 14px; }
  .stat-card .stat-number { font-size: 2.2rem; }
  .stat-card .stat-label { font-size: 0.82rem; word-break: break-word; }
  .hero { padding-top: calc(var(--nav-h) + 20px); min-height: auto; }
}

/* ── Loading animation ────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, #F4ECE1 25%, #FAF6F0 50%, #F4ECE1 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── Image preview ────────────────────────────────────────────── */
.img-preview-wrap {
  position: relative;
  display: inline-block;
  margin-top: 10px;
}
.img-preview-wrap img {
  height: 120px;
  width: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  object-fit: cover;
}

/* ── Two-col detail layout ────────────────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 32px;
  align-items: start;
}
@media (max-width: 860px) { .detail-grid { grid-template-columns: 1fr; } }

.detail-cover {
  border-radius: var(--radius-md);
  overflow: hidden;
  aspect-ratio: 3/4;
  background: #F3ECE2;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}
.detail-cover img { width: 100%; height: 100%; object-fit: cover; }

/* ── Metadata list ────────────────────────────────────────────── */
.meta-list { display: flex; flex-direction: column; gap: 12px; }
.meta-item { display: flex; align-items: baseline; gap: 10px; font-size: 0.9rem; }
.meta-key { color: var(--text-3); min-width: 120px; flex-shrink: 0; font-weight: 500; }
.meta-val { color: var(--text-1); font-weight: 600; }

/* ── Leaflet Map Marker Styles ─────────────────────────────────── */
.custom-book-marker {
  background: transparent !important;
  border: none !important;
}
.book-marker-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--amber, #D97706);
  color: #ffffff;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  border: 2px solid #ffffff;
  white-space: nowrap;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transform: translate(-50%, -50%);
  transition: transform 0.2s ease, background 0.2s ease;
}
.book-marker-pill:hover {
  background: #B45309;
  transform: translate(-50%, -54%) scale(1.06);
}
