:root {
  --primary: #2c5f2e;
  --primary-light: #4a8c4d;
  --primary-dark: #1a3d1c;
  --secondary: #f5a623;
  --secondary-light: #ffc04a;
  --bg: #f8f6f0;
  --surface: #ffffff;
  --surface2: #f0ede6;
  --text: #2d2d2d;
  --text-light: #666;
  --text-muted: #999;
  --border: #e0d9cc;
  --danger: #d32f2f;
  --success: #388e3c;
  --warning: #f57c00;
  --info: #1565c0;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --transition: all 0.2s ease;
  /* Larghezze pagina */
  --page-sm:  640px;
  --page-md:  960px;
  --page-lg: 1200px;
  --page-xl: 1400px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-light); }
img { max-width: 100%; }

/* Layout */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }

/* Navbar */
.navbar {
  background: var(--primary);
  color: white;
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.nav-inner {
  display: flex;
  align-items: center;
  height: 64px;
  gap: 1.5rem;
}
.nav-brand {
  font-size: 1.4rem;
  font-weight: 700;
  color: white;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.nav-brand span { color: var(--secondary); }
.nav-links { display: flex; gap: 0.5rem; flex: 1; }
.nav-links a {
  color: rgba(255,255,255,0.85);
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  font-size: 0.9rem;
  transition: var(--transition);
}
.nav-links a:hover { background: rgba(255,255,255,0.15); color: white; }
.nav-links a.active { background: rgba(255,255,255,0.25); color: white; font-weight: 700; border-radius: 6px; }
.nav-search { flex: 1; max-width: 360px; }
.nav-search form { display: flex; }
.nav-search input {
  flex: 1;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px 0 0 6px;
  font-size: 0.9rem;
  outline: none;
}
.nav-search button {
  padding: 0.5rem 1rem;
  background: var(--secondary);
  border: none;
  border-radius: 0 6px 6px 0;
  cursor: pointer;
  font-size: 1rem;
}
.nav-actions { display: flex; align-items: center; gap: 0.5rem; }
.btn-nav {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
}
.btn-login { background: rgba(255,255,255,0.15); color: white; }
.btn-login:hover { background: rgba(255,255,255,0.25); color: white; }
.btn-register { background: var(--secondary); color: var(--primary-dark); }
.btn-register:hover { background: var(--secondary-light); }

/* User menu */
.user-menu { position: relative; }
.user-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
}
.user-btn:hover { background: rgba(255,255,255,0.25); }
.avatar-sm {
  width: 30px; height: 30px;
  background: var(--secondary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--primary-dark);
}
.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  overflow: hidden;
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}
.user-dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.user-dropdown a, .user-dropdown button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1rem;
  color: var(--text);
  font-size: 0.9rem;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}
.user-dropdown a:hover, .user-dropdown button:hover { background: var(--bg); }
.user-dropdown hr { border: none; border-top: 1px solid var(--border); margin: 0.3rem 0; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 1.4rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-light); color: white; }
.btn-secondary { background: var(--secondary); color: var(--primary-dark); }
.btn-secondary:hover { background: var(--secondary-light); }
.btn-outline { background: transparent; border: 2px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #b71c1c; }
.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.8rem; }
.btn-lg { padding: 0.9rem 2rem; font-size: 1rem; }
.btn-block { display: flex; width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* Cards */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header { padding: 1.2rem 1.5rem; border-bottom: 1px solid var(--border); }
.card-body { padding: 1.5rem; }
.card-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); background: var(--surface2); }

/* Book cards */
.books-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1.5rem; }
.book-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}
.book-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.book-img {
  aspect-ratio: 3/4;
  background: linear-gradient(135deg, #e8e0d0, #d4c9b5);
  overflow: hidden;
  position: relative;
}
.book-img img { width: 100%; height: 100%; object-fit: cover; }
.book-img-placeholder {
  width: 100%; height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 3rem;
  gap: 0.5rem;
}
.book-img-placeholder small { font-size: 0.7rem; }
.book-condition {
  position: absolute;
  bottom: 6px;
  left: 6px;
  padding: 3px 7px;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  box-shadow: 0 1px 4px rgba(0,0,0,0.18);
  pointer-events: none;
}
.cond-come-nuovo  { background: #b8860b; color: white; }
.cond-ottimo      { background: #2e7d32; color: white; }
.cond-buono       { background: #1565c0; color: white; }
.cond-discreto    { background: #e65100; color: white; }
.cond-accettabile { background: #5d4037; color: white; }
.book-info { padding: 1rem; }
.book-title { font-weight: 700; font-size: 0.95rem; line-height: 1.3; margin-bottom: 0.2rem; color: var(--text); }
.book-author { font-size: 0.82rem; color: var(--text-light); margin-bottom: 0.5rem; }
.book-price { font-size: 1.15rem; font-weight: 800; color: var(--primary); }
.book-price-orig { font-size: 0.8rem; color: var(--text-muted); text-decoration: line-through; margin-left: 0.4rem; }
.book-seller { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.4rem; }
.risparmio-badge { display:inline-block; background:#fff8e1; color:#b8860b; border:1px solid #ffe082; border-radius:4px; font-size:0.72rem; font-weight:700; padding:2px 7px; margin-top:0.3rem; }
.book-seller .badge-partner { color: var(--secondary); font-weight: 700; }
.wishlist-btn {
  position: absolute;
  top: 8px;
  left: 8px;
  background: white;
  border: none;
  border-radius: 50%;
  width: 32px; height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  font-size: 1rem;
  transition: transform 0.2s;
}
.wishlist-btn:hover { transform: scale(1.15); }
.wishlist-btn.active { color: #e53935; }

/* Forms */
.form-group { margin-bottom: 1.2rem; }
.form-label { display: block; font-weight: 600; margin-bottom: 0.4rem; font-size: 0.9rem; color: var(--text); }
.form-control {
  width: 100%;
  padding: 0.65rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  background: white;
  color: var(--text);
  transition: border-color 0.2s;
  outline: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(44,95,46,0.1); }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23666' fill='none' stroke-width='1.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 1rem center; padding-right: 2.5rem; }
textarea.form-control { resize: vertical; min-height: 120px; }
.form-hint { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.3rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }

/* Alerts */
.alert { padding: 0.9rem 1.2rem; border-radius: 8px; margin-bottom: 1rem; font-size: 0.9rem; display: flex; align-items: center; gap: 0.5rem; }
.alert-success { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }
.alert-error { background: #ffebee; color: #c62828; border: 1px solid #ef9a9a; }
.alert-warning { background: #fff8e1; color: #e65100; border: 1px solid #ffcc02; }
.alert-info { background: #e3f2fd; color: #1565c0; border: 1px solid #90caf9; }

/* Badges */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.badge-green { background: #e8f5e9; color: #2e7d32; }
.badge-blue { background: #e3f2fd; color: #1565c0; }
.badge-orange { background: #fff3e0; color: #e65100; }
.badge-red { background: #ffebee; color: #c62828; }
.badge-gray { background: #f5f5f5; color: #757575; }
.badge-gold { background: #fff8e1; color: #f57f17; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th { padding: 0.8rem 1rem; text-align: left; font-weight: 700; background: var(--surface2); color: var(--text-light); border-bottom: 2px solid var(--border); }
td { padding: 0.8rem 1rem; border-bottom: 1px solid var(--border); }
tr:hover td { background: var(--bg); }

/* Stars */
.stars { color: var(--secondary); font-size: 1rem; letter-spacing: 1px; }
.stars-sm { font-size: 0.85rem; }

/* Tabs */
.tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 1.5rem; gap: 0; }
.tab-btn {
  padding: 0.8rem 1.5rem;
  border: none;
  background: none;
  color: var(--text-light);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
}
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-btn:hover { color: var(--primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Stats cards */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; }
.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 1.2rem 1.5rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.stat-icon { font-size: 1.8rem; }
.stat-value { font-size: 1.8rem; font-weight: 800; color: var(--primary); }
.stat-label { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s;
}
.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}
.modal {
  background: white;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.96) translateY(8px);
  transition: transform 0.2s ease;
}
.modal-overlay.show .modal {
  transform: scale(1) translateY(0);
}
.modal-header { padding: 1.2rem 1.5rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-title { font-size: 1.1rem; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--text-muted); line-height: 1; }
.modal-body { padding: 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); display: flex; gap: 0.7rem; justify-content: flex-end; }

/* Sidebar layout */
.layout-sidebar { display: grid; grid-template-columns: 280px 1fr; gap: 2rem; align-items: start; }
.sidebar { background: white; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; position: sticky; top: 80px; }
.sidebar-header { padding: 1.2rem 1.5rem; background: var(--primary); color: white; font-weight: 700; }
.sidebar-nav a, .sidebar-nav button {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.8rem 1.5rem;
  color: var(--text);
  font-size: 0.9rem;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
  border-left: 3px solid transparent;
}
.sidebar-nav a:hover, .sidebar-nav button:hover { background: var(--bg); }
.sidebar-nav a.active, .sidebar-nav button.active { background: #e8f5e9; color: var(--primary); border-left-color: var(--primary); font-weight: 700; }
.sidebar-nav hr { border: none; border-top: 1px solid var(--border); margin: 0.3rem 0; }

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: center; gap: 0.4rem; margin-top: 2rem; flex-wrap: wrap; }
.page-btn {
  padding: 0.5rem 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: white;
  cursor: pointer;
  font-size: 0.85rem;
  transition: var(--transition);
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, var(--primary-light) 100%);
  color: white;
  padding: 2.2rem 0 2rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(ellipse at center, rgba(255,255,255,0.05) 0%, transparent 60%);
}
.hero-title { font-size: 2rem; font-weight: 800; margin-bottom: 0.4rem; line-height: 1.2; }
.hero-title span { color: var(--secondary); }
.hero-sub { font-size: 1rem; font-weight: 600; opacity: 0.9; max-width: 700px; margin: 0 auto 1rem; }
.hero-search { max-width: 560px; margin: 0 auto; display: flex; gap: 0; box-shadow: var(--shadow-lg); border-radius: 10px; overflow: hidden; }
.hero-search input { flex: 1; padding: 0.7rem 1.2rem; border: none; font-size: 0.95rem; outline: none; }
.hero-search button { padding: 0.7rem 1.5rem; background: var(--secondary); border: none; font-size: 0.95rem; font-weight: 700; cursor: pointer; color: var(--primary-dark); transition: background 0.2s; }
.hero-search button:hover { background: var(--secondary-light); }

/* Footer */
footer { background: var(--primary-dark); color: rgba(255,255,255,0.7); padding: 3rem 0 1.5rem; margin-top: 4rem; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 2rem; margin-bottom: 2rem; }
.footer-brand { font-size: 1.4rem; font-weight: 800; color: white; margin-bottom: 0.8rem; }
.footer-brand span { color: var(--secondary); }
.footer-col h4 { color: white; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 1rem; }
.footer-col a { display: block; margin-bottom: 0.5rem; font-size: 0.85rem; color: rgba(255,255,255,0.6); }
.footer-col a:hover { color: white; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.1); padding-top: 1.5rem; text-align: center; font-size: 0.82rem; }

/* Page header */
.page-header { background: white; padding: 2rem 0; border-bottom: 1px solid var(--border); margin-bottom: 2rem; }
.page-header h1 { font-size: 1.8rem; font-weight: 800; }

/* Filter bar */
.filter-bar { background: white; border-radius: var(--radius); padding: 1.2rem 1.5rem; box-shadow: var(--shadow); margin-bottom: 1.5rem; display: flex; flex-wrap: wrap; gap: 0.8rem; align-items: center; }
.filter-bar select, .filter-bar input { padding: 0.5rem 0.8rem; border: 1.5px solid var(--border); border-radius: 6px; font-size: 0.85rem; outline: none; }
.filter-bar select:focus, .filter-bar input:focus { border-color: var(--primary); }

/* Empty state */
.empty-state { text-align: center; padding: 4rem 2rem; color: var(--text-muted); }
.empty-state .icon { font-size: 4rem; margin-bottom: 1rem; }
.empty-state h3 { font-size: 1.3rem; color: var(--text-light); margin-bottom: 0.5rem; }

/* Loading */
.spinner {
  width: 40px; height: 40px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 2rem auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Tag colors for conditions */
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 5px; font-size: 0.75rem; font-weight: 600; }

/* Toast notifications */
.toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999; display: flex; flex-direction: column; gap: 0.5rem; }
.toast {
  background: white;
  border-radius: 8px;
  padding: 0.8rem 1.2rem;
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  min-width: 260px;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  animation: slideIn 0.3s ease;
  border-left: 4px solid var(--primary);
}
.toast.toast-success { border-color: var(--success); }
.toast.toast-error { border-color: var(--danger); }
.toast.toast-warning { border-color: var(--warning); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Image upload */
.img-upload-area {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s;
}
.img-upload-area:hover, .img-upload-area.drag { border-color: var(--primary); background: #f0f8f0; }
.img-preview { max-width: 200px; max-height: 200px; border-radius: 6px; margin-top: 1rem; }

/* Admin specific */
.admin-layout { display: grid; grid-template-columns: 240px 1fr; min-height: calc(100vh - 64px); }
.admin-sidebar { background: var(--primary-dark); color: white; }
.admin-sidebar-header { padding: 1.5rem; border-bottom: 1px solid rgba(255,255,255,0.1); font-weight: 700; font-size: 1rem; }
.admin-nav a, .admin-nav button {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.9rem 1.5rem;
  color: rgba(255,255,255,0.7);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.15s;
  border-left: 3px solid transparent;
}
.admin-nav a:hover, .admin-nav button:hover { background: rgba(255,255,255,0.08); color: white; }
.admin-nav a.active, .admin-nav button.active { background: rgba(255,255,255,0.12); color: white; border-left-color: var(--secondary); }
.admin-nav .nav-section { padding: 0.5rem 1.5rem; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1.5px; color: rgba(255,255,255,0.4); margin-top: 0.5rem; }
.admin-main { padding: 2rem; overflow-x: hidden; }
.admin-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }

/* Nav categories dropdown */
.nav-cat-wrap { position: relative; }
.nav-cat-btn {
  color: rgba(255,255,255,0.85);
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  font-size: 0.9rem;
  background: none;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.nav-cat-btn:hover, .nav-cat-btn.open { background: rgba(255,255,255,0.15); color: white; }
.nav-cat-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 220px;
  max-height: 420px;
  overflow-y: auto;
  z-index: 1100;
  border: 1px solid var(--border);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}
.nav-cat-dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.nav-cat-dropdown a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1rem;
  color: var(--text);
  font-size: 0.88rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
  gap: 0.5rem;
}
.nav-cat-dropdown a:last-child { border-bottom: none; }
.nav-cat-dropdown a:hover { background: var(--bg); color: var(--primary); }
.nav-cat-dropdown a .cat-count { font-size: 0.72rem; color: var(--text-muted); background: var(--bg); padding: 2px 7px; border-radius: 10px; flex-shrink: 0; }
.nav-cat-dropdown a .cat-name { flex: 1; }

/* Annunci grid */
.annunci-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1rem; }
.annuncio-item { display: flex; gap: 1rem; background: white; border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; transition: box-shadow 0.2s, border-color 0.2s; }
.annuncio-item:hover { box-shadow: var(--shadow); border-color: var(--primary-light); }
.annuncio-img { width: 72px; height: 96px; flex-shrink: 0; border-radius: 6px; overflow: hidden; background: var(--bg); position: relative; }
.annuncio-img img { width: 100%; height: 100%; object-fit: cover; }
.annuncio-img-ph { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 2rem; }
.annuncio-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.annuncio-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; }
.annuncio-titolo { font-weight: 700; font-size: 0.95rem; line-height: 1.3; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.annuncio-autore { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.1rem; }
.annuncio-prezzo { font-size: 1.1rem; font-weight: 800; color: var(--primary); white-space: nowrap; }
.annuncio-meta { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.annuncio-cond { font-size: 0.75rem; font-weight: 600; border: 1px solid; border-radius: 20px; padding: 0.15rem 0.6rem; }
.annuncio-cat { font-size: 0.75rem; background: var(--surface2); color: var(--text-muted); border-radius: 20px; padding: 0.15rem 0.6rem; }
.annuncio-footer { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 0.3rem; border-top: 1px solid var(--border); }
.annuncio-venditore { font-size: 0.78rem; color: var(--text-muted); }
.annuncio-data { font-size: 0.72rem; color: var(--text-muted); }

/* Responsive — tablet (≤ 768px) */
@media (max-width: 768px) {
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .layout-sidebar { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar { display: none; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .hero-title { font-size: 2rem; }
  .nav-search { display: none; }
  .books-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .adozioni-home-grid { grid-template-columns: 1fr !important; }
  .annunci-grid { grid-template-columns: 1fr; }
  .annuncio-titolo { max-width: 140px; }
}

/* Responsive — mobile piccolo (≤ 480px) */
@media (max-width: 480px) {
  .container { padding: 0 0.75rem; }
  .nav-inner { gap: 0.5rem; }
  .nav-brand { font-size: 1.1rem; }
  .hero { padding: 1.5rem 0; }
  .hero-title { font-size: 1.5rem; }
  .hero-sub { font-size: 0.88rem; }
  .modal { border-radius: 8px; }
  .modal-body { padding: 1rem; }
  .modal-header { padding: 0.9rem 1rem; }
  .modal-footer { padding: 0.75rem 1rem; flex-wrap: wrap; }
  .modal-footer .btn { flex: 1; justify-content: center; }
  .books-grid { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr; }
  .tabs { overflow-x: auto; }
  .tab-btn { padding: 0.7rem 1rem; font-size: 0.82rem; white-space: nowrap; }
  .page-header h1 { font-size: 1.4rem; }
  .btn-lg { padding: 0.75rem 1.4rem; font-size: 0.9rem; }
  .card-body { padding: 1rem; }
}

/* Utility */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.p-2 { padding: 1rem; }
.fw-bold { font-weight: 700; }
.hidden { display: none !important; }
.w-100 { width: 100%; }
.section { padding: 3rem 0; }
.section-title { font-size: 1.6rem; font-weight: 800; margin-bottom: 0.3rem; }
.section-sub { color: var(--text-muted); margin-bottom: 2rem; }
