/* ============================================================
   Seconda Vita — stile principale
   Palette: sfondo #14120F | ambra #F5A623 | verde #2d7a6a | bianco #FFF
   Font: Cormorant Garamond (titoli) + Inter (corpo)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,600;1,400&family=Inter:wght@400;500;600&display=swap');

/* --- Variabili --- */
:root {
  --bg:        #14120F;
  --bg-card:   #1e1b17;
  --bg-input:  #252119;
  --amber:     #F5A623;
  --amber-dim: rgba(245, 166, 35, 0.15);
  --green:     #2d7a6a;
  --green-dim: rgba(45, 122, 106, 0.25);
  --white:     #FFFFFF;
  --gray:      #a09880;
  --gray-light:#ccc3b0;
  --border:    rgba(255,255,255,0.08);
  --radius:    8px;
  --radius-lg: 12px;
}

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

html { scroll-behavior: smooth; }

body {
  background-color: var(--bg);
  color: var(--white);
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--amber); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  line-height: 1.2;
}

img { max-width: 100%; display: block; }

/* --- Layout --- */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* --- Navbar --- */
.navbar {
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 100;
}

.navbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.navbar__logo {
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--white);
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  white-space: nowrap;
}
.navbar__logo span { color: var(--amber); }

.navbar__logo-img {
  height: 40px;
  width: auto;
  flex-shrink: 0;
  margin-right: 8px;
}

.navbar__links {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* --- Dropdown navbar --- */
.nav-dropdown {
  position: relative;
}

.nav-dropdown__trigger {
  background: none;
  letter-spacing: 0;
}

.nav-dropdown__menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  z-index: 200;
  overflow: hidden;
}

.nav-dropdown:hover .nav-dropdown__menu,
.nav-dropdown:focus-within .nav-dropdown__menu {
  display: block;
}

.nav-dropdown__item {
  display: block;
  padding: 10px 16px;
  font-size: 14px;
  color: var(--gray-light);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.nav-dropdown__item:hover {
  background: rgba(255,255,255,0.06);
  color: var(--white);
  text-decoration: none;
}
.nav-dropdown__item--danger { color: #e07070; }
.nav-dropdown__item--danger:hover { color: #ff9090; }

/* --- Bottoni --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s;
  text-decoration: none;
}
.btn:hover { opacity: 0.85; text-decoration: none; }

.btn--primary {
  background: var(--amber);
  color: var(--bg);
}
.btn--outline {
  background: transparent;
  color: var(--white);
  border: 1px solid var(--border);
}
.btn--outline:hover { border-color: var(--amber); color: var(--amber); }

.btn--ghost {
  background: transparent;
  color: var(--gray-light);
  padding: 9px 12px;
}
.btn--ghost:hover { color: var(--white); }

.btn--sm { padding: 6px 12px; font-size: 13px; }
.btn--full { width: 100%; justify-content: center; }

.btn--danger {
  background: transparent;
  color: #e05252;
  border: 1px solid rgba(224, 82, 82, 0.3);
}
.btn--danger:hover { background: rgba(224, 82, 82, 0.1); }

/* --- Hero --- */
.hero {
  padding: 80px 0 60px;
  text-align: center;
}

.hero__title {
  font-size: clamp(36px, 6vw, 60px);
  color: var(--white);
  margin-bottom: 16px;
}

.hero__sub {
  font-size: 17px;
  color: var(--gray-light);
  max-width: 560px;
  margin: 0 auto 36px;
}

/* --- Barra di ricerca --- */
.search-bar {
  display: flex;
  gap: 8px;
  max-width: 640px;
  margin: 0 auto 20px;
}

.search-bar__input {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--white);
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  padding: 12px 16px;
  outline: none;
  transition: border-color 0.15s;
}
.search-bar__input:focus { border-color: var(--amber); }
.search-bar__input::placeholder { color: var(--gray); }

/* --- Filtri categoria (pills) --- */
.category-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 48px;
}

.pill {
  padding: 5px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--gray-light);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}
.pill:hover, .pill--active {
  border-color: var(--amber);
  color: var(--amber);
  background: var(--amber-dim);
  text-decoration: none;
}

/* --- Sezione annunci --- */
.section {
  padding: 40px 0;
}

.section__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--green);
  padding-bottom: 10px;
}

.section__title {
  font-size: 24px;
  color: var(--white);
}

/* --- Grid card annunci --- */
.annunci-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: border-color 0.15s, transform 0.15s;
  text-decoration: none;
  display: block;
  color: inherit;
}
.card:hover {
  border-color: rgba(245, 166, 35, 0.3);
  transform: translateY(-2px);
  text-decoration: none;
}

.card__img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  background: var(--bg-input);
}

.card__img-placeholder {
  width: 100%;
  aspect-ratio: 3/4;
  background: var(--bg-input);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray);
  font-size: 32px;
}

.card__body { padding: 14px; }

.card__title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 17px;
  color: var(--white);
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card__author {
  font-size: 12px;
  color: var(--gray);
  margin-bottom: 8px;
}

.card__price {
  font-family: 'Cormorant Garamond', serif;
  font-size: 20px;
  color: var(--amber);
  font-weight: 600;
}

.card__meta {
  font-size: 12px;
  color: var(--gray);
  margin-top: 4px;
}

/* --- Badge --- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.badge--green  { background: var(--green-dim); color: #5bbcaa; border: 1px solid var(--green); }
.badge--amber  { background: var(--amber-dim); color: var(--amber); border: 1px solid rgba(245,166,35,0.4); }
.badge--gray   { background: rgba(255,255,255,0.06); color: var(--gray); border: 1px solid var(--border); }

/* --- Pagina cerca (layout con filtri) --- */
.cerca-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 32px;
  align-items: start;
}

.filtri-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: sticky;
  top: 80px;
}

.filtri-sidebar h3 {
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 12px;
}

.filtri-sidebar .filter-group { margin-bottom: 20px; }

.filtri-sidebar label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--gray-light);
  cursor: pointer;
  padding: 4px 0;
}
.filtri-sidebar label:hover { color: var(--white); }

.filtri-sidebar input[type="radio"] { accent-color: var(--amber); }

.risultati-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  color: var(--gray);
  font-size: 14px;
}

/* --- Dettaglio annuncio --- */
.dettaglio-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: start;
  margin-top: 32px;
}

.foto-principale {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
}

.foto-thumbnails {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.foto-thumb {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: var(--radius);
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.15s;
  border: 2px solid transparent;
}
.foto-thumb:hover, .foto-thumb--active { opacity: 1; border-color: var(--amber); }

.dettaglio-info__title {
  font-size: 34px;
  margin-bottom: 6px;
}

.dettaglio-info__author { color: var(--gray-light); margin-bottom: 16px; }
.dettaglio-info__isbn   { font-size: 12px; color: var(--gray); margin-bottom: 16px; }

.dettaglio-info__badges { display: flex; gap: 8px; margin-bottom: 20px; }

.dettaglio-info__price {
  font-family: 'Cormorant Garamond', serif;
  font-size: 42px;
  color: var(--amber);
  font-weight: 600;
  margin-bottom: 24px;
}

/* --- Form contatto venditore --- */
.contatto-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.contatto-card h3 {
  font-size: 20px;
  margin-bottom: 16px;
  color: var(--white);
}

.contatto-card p.disclaimer {
  font-size: 12px;
  color: var(--gray);
  margin-top: 12px;
  text-align: center;
}

/* --- Form generico --- */
.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 560px;
  margin: 40px auto;
}

.form-card__title {
  font-size: 30px;
  margin-bottom: 6px;
}

.form-card__sub {
  color: var(--gray);
  font-size: 14px;
  margin-bottom: 24px;
}

.form-section-label {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--amber);
  margin: 24px 0 12px;
}

.form-divider {
  border: none;
  border-top: 1px solid var(--green);
  margin: 24px 0;
  opacity: 0.4;
}

.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-size: 13px;
  color: var(--gray-light);
  margin-bottom: 6px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--white);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  padding: 10px 14px;
  outline: none;
  transition: border-color 0.15s;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--amber);
}

.field input::placeholder,
.field textarea::placeholder { color: var(--gray); }

.field select option { background: var(--bg-card); }

.field__help {
  font-size: 12px;
  color: var(--gray);
  margin-top: 4px;
}

.field__error {
  font-size: 12px;
  color: #e05252;
  margin-top: 4px;
}

.field--row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Condizione — radio come bottoni --- */
.condizione-group {
  display: flex;
  gap: 8px;
}
.condizione-group input[type="radio"] { display: none; }
.condizione-group label {
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  cursor: pointer;
  color: var(--gray-light);
  transition: all 0.15s;
}
.condizione-group input[type="radio"]:checked + label {
  border-color: var(--green);
  color: #5bbcaa;
  background: var(--green-dim);
}

/* --- Upload foto --- */
.foto-upload-grid {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.foto-slot {
  width: 90px;
  height: 90px;
  border: 1.5px dashed rgba(245, 166, 35, 0.3);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--gray);
  font-size: 24px;
  position: relative;
  overflow: hidden;
  background: var(--bg-input);
  transition: border-color 0.15s;
}
.foto-slot:hover { border-color: var(--amber); }
.foto-slot--has-image { border-style: solid; border-color: var(--amber); cursor: zoom-in; }
.foto-slot--has-image .foto-slot__plus { display: none; }
.foto-slot input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
  z-index: 1;
}
.foto-slot__remove {
  display: none;
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 3;
  background: rgba(0,0,0,0.7);
  border: none;
  color: #fff;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  align-items: center;
  justify-content: center;
}
.foto-slot--has-image .foto-slot__remove { display: flex; }

/* --- Miei annunci --- */
.annunci-list { display: flex; flex-direction: column; gap: 12px; }

.annuncio-row {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.annuncio-row__img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: var(--radius);
  flex-shrink: 0;
  background: var(--bg-input);
}

.annuncio-row__info { flex: 1; min-width: 0; }

.annuncio-row__title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.annuncio-row__meta { font-size: 12px; color: var(--gray); margin-top: 2px; }

.annuncio-row__price {
  font-family: 'Cormorant Garamond', serif;
  font-size: 20px;
  color: var(--amber);
  flex-shrink: 0;
}

.annuncio-row__actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* --- Tab bar --- */
.tab-bar {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.tab {
  padding: 10px 20px;
  font-size: 14px;
  color: var(--gray);
  cursor: pointer;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.15s;
}
.tab:hover { color: var(--white); text-decoration: none; }
.tab--active { color: var(--amber); border-bottom-color: var(--amber); }

/* --- Toast notifications --- */
.toast-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 380px;
  width: calc(100% - 48px);
}
.toast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 24px rgba(0,0,0,0.5);
  transition: opacity 0.3s ease;
  opacity: 1;
}
.toast--success { background: var(--green-dim); border: 1px solid var(--green); color: #5bbcaa; }
.toast--error   { background: rgba(224,82,82,0.1); border: 1px solid rgba(224,82,82,0.3); color: #e05252; }
.toast__close {
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  opacity: 0.6;
  font-size: 16px;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
}
.toast__close:hover { opacity: 1; }

/* --- Breadcrumb --- */
.breadcrumb {
  font-size: 13px;
  color: var(--gray);
  margin-bottom: 24px;
}
.breadcrumb a { color: var(--gray); }
.breadcrumb a:hover { color: var(--white); }

/* --- Footer --- */
.footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  margin-top: 80px;
  color: var(--gray);
  font-size: 13px;
}
.footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

/* --- Vuoto / nessun risultato --- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray);
}
.empty-state__icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h3 { font-size: 22px; color: var(--gray-light); margin-bottom: 8px; }

/* --- Lista revisione importazione --- */
.lista-revisione { display: flex; flex-direction: column; gap: 12px; }

.lista-revisione__riga {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  transition: opacity 0.2s, border-color 0.2s;
}
.lista-revisione__riga:has(input[type="checkbox"]:checked) {
  border-color: rgba(245, 166, 35, 0.25);
}

.lista-revisione__check {
  padding-top: 6px;
  flex-shrink: 0;
}
.lista-revisione__check input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--amber);
  cursor: pointer;
}

.lista-revisione__campi { flex: 1; min-width: 0; }
.lista-revisione__campi .field--row { margin-bottom: 0; }
.lista-revisione__campi .field { margin-bottom: 8px; }
.lista-revisione__campi label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--gray); }

/* --- Responsive --- */
@media (max-width: 768px) {
  .cerca-layout { grid-template-columns: 1fr; }
  .filtri-sidebar { position: static; }
  .dettaglio-layout { grid-template-columns: 1fr; }
  .annunci-grid { grid-template-columns: repeat(2, 1fr); }
  .annuncio-row__actions { flex-direction: column; }
  .navbar__links .btn--outline { display: none; }
  .field--row { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .annunci-grid { grid-template-columns: 1fr; }
  .search-bar { flex-direction: column; }
  .hero { padding: 48px 0 32px; }
}

/* --- Richieste libro --- */
.richieste-list { display: flex; flex-direction: column; gap: 12px; }

.richiesta-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  transition: border-color 0.2s;
}
.richiesta-card:hover { border-color: rgba(245,166,35,0.3); }
.richiesta-card--trovato { opacity: 0.55; }

.richiesta-card__body { flex: 1; min-width: 0; }
.richiesta-card__titolo { font-size: 17px; margin-bottom: 2px; }
.richiesta-card__meta { color: var(--gray); font-size: 13px; margin-bottom: 8px; }
.richiesta-card__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.richiesta-card__data { color: var(--gray); font-size: 12px; }
.richiesta-card__action { flex-shrink: 0; }

.tag {
  display: inline-block;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(255,255,255,0.07);
  color: var(--gray-light);
}
.tag--green {
  background: var(--green-dim);
  color: #4caf93;
}

@media (max-width: 580px) {
  .richiesta-card { flex-direction: column; align-items: flex-start; }
  .richiesta-card__action { width: 100%; }
  .richiesta-card__action .btn { width: 100%; text-align: center; }
}
