:root {
  /* Palette Roma Imperiale */
  --color-bg: #fdfbf7;           /* Travertino */
  --color-surface: #ffffff;      /* Bianco Puro */
  --color-primary: #b84a39;      /* Terracotta */
  --color-primary-dark: #8e382b; /* Terracotta Scuro */
  --color-accent: #C5A059;       /* Oro Imperiale (leggermente più scuro per contrasto) */
  --color-text: #2d241e;         /* Marrone Notte (Autorità) */
  --color-muted: #7a6b63;        /* Pietra */
  --color-border: #C5A059;       /* Sabbia */
  --color-success: #3e7b5e;      /* Verde Liturgico */
  --color-warning: #b08d46;      /* Oro */
  --color-info: #4a6fa5;         /* Blu Polvere */

  /* Geometria Moderna e Autorevole */
  --radius-lg: 12px;             /* Design solido e istituzionale */
  --radius-md: 8px;
  --radius-sm: 4px;

  /* Ombre Calde */
  --shadow-soft: 0 18px 50px rgba(184, 74, 57, 0.08);
  --shadow-card: 0 12px 28px rgba(45, 36, 30, 0.12);

  /* Tipografia Moderna Sans Serif */
  --font-sans: 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
} /*

:root {
  --color-bg: #f6f4ff;
  --color-surface: #ffffff;
  --color-primary: #5c4ddf;
  --color-primary-dark: #4338ca;
  --color-accent: #f97316;
  --color-text: #2b2451;
  --color-muted: #6b6780;
  --color-border: #e2defa;
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-info: #2563eb;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --shadow-soft: 0 18px 50px rgba(92, 77, 223, 0.1);
  --shadow-card: 0 12px 28px rgba(43, 36, 81, 0.12);
} */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  /* font-family: "Manrope", system-ui, sans-serif;
  */
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

a:hover {
  color: var(--color-primary-dark);
}

.container {
  width: min(1200px, 92%);
  margin: 0 auto;
}

.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 18px 0;
  position: sticky;
  top: 0;
  z-index: 2000;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  width: clamp(44px, 7vw, 62px);
  height: auto;
  border-radius: 10px;
  object-fit: cover;
}

.brand-title {
  margin: 0;
  font-weight: 700;
  font-size: 1.1rem;
}

.brand-subtitle {
  margin: 4px 0 0;
  font-size: 0.85rem;
  color: var(--color-muted);
}

.header-links {
  display: flex;
  gap: 18px;
  font-weight: 600;
}

.hero {
  padding: 20px 0 20px;
}

.hero-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-soft);
}

.hero-card h1 {
  margin: 0 0 8px;
  font-size: clamp(1.36rem, 2.4vw, 1.92rem);
}

.hero-subtitle {
  margin: 0 0 22px;
  color: var(--color-muted);
}

.search-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.input-label {
  font-weight: 600;
  font-size: 0.95rem;
}

.input-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.input-row input {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  font-size: 1rem;
  outline: none;
  background: #fff;
}

.input-row input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(92, 77, 223, 0.15);
}

.primary-btn {
  padding: 14px 20px;
  border-radius: 999px;
  border: none;
  background: var(--color-primary);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.primary-btn:hover {
  background: var(--color-primary-dark);
  transform: translateY(-1px);
}

.filter-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-start;
}

.filter {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-label {
  font-weight: 600;
  font-size: 0.9rem;
}

.chip-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.chip {
  background: #f1efff;
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  border: 1px solid transparent;
}

.chip input {
  display: none;
}

.chip:has(input:checked) {
  border-color: var(--color-primary);
  background: rgba(92, 77, 223, 0.2);
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: var(--color-muted);
}

.checkbox input {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary);
}

.microcopy {
  margin: 0;
  font-size: 0.85rem;
  color: var(--color-muted);
}

.content {
  padding: 20px 0 50px;
}

#content-container {
  scroll-margin-top: 96px;
}

.mobile-tabs {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.tab-btn {
  flex: 1;
  border-radius: 999px;
  padding: 10px 0;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  font-weight: 600;
  color: var(--color-muted);
  cursor: pointer;
}

.tab-btn.active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.content-grid {
  display: grid;
  gap: 18px;
}

.panel {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-header h2 {
  margin: 0;
}

.summary-tag {
  background: #f1efff;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-primary-dark);
}

.map {
  height: 360px;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.popup {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-family: "Manrope", system-ui, sans-serif;
  color: var(--color-text);
}

.popup-title {
  font-weight: 700;
  font-size: 0.95rem;
}

.popup-status {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.popup-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--color-muted);
}

.popup-row span:last-child {
  font-weight: 600;
  color: var(--color-text);
}

.results {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.result-card {
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

.result-card:hover,
.result-card.active {
  border-color: var(--color-primary);
  box-shadow: 0 8px 16px rgba(92, 77, 223, 0.12);
}

.result-title {
  font-weight: 700;
  font-size: 1rem;
}

.result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--color-muted);
  font-size: 0.9rem;
}

.result-detail-row {
  justify-content: space-between;
  gap: 16px;
}

.result-detail-row span:last-child {
  font-weight: 600;
  color: var(--color-text);
}


.popup-row span:last-child,
.result-detail-row span:last-child {
  overflow-wrap: anywhere;
  text-align: right;
}

.popup-row a,
.result-detail-row a {
  display: inline-block;
  max-width: 100%;
}


.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge.verified {
  background: rgba(16, 185, 129, 0.15);
  color: #047857;
}

.badge.community {
  background: rgba(245, 158, 11, 0.2);
  color: #92400e;
}

.status-pill {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-available {
  background: rgba(16, 185, 129, 0.2);
  color: #047857;
}

.status-not {
  background: rgba(239, 68, 68, 0.18);
  color: #b91c1c;
}

.status-unknown {
  background: rgba(37, 99, 235, 0.15);
  color: #1d4ed8;
}

.missing-location {
  font-size: 0.85rem;
  color: var(--color-muted);
  margin-top: 10px;
}

.site-footer {
  background: var(--color-surface);
  padding: 30px 0 20px;
  border-top: 1px solid var(--color-border);
}

.footer-grid {
  display: grid;
  gap: 20px;
}

.footer-grid h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.footer-bottom {
  margin-top: 20px;
  text-align: center;
  color: var(--color-muted);
  font-size: 0.85rem;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.modal.active {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 10, 40, 0.4);
}

.modal-card {
  position: relative;
  width: min(520px, 92%);
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  z-index: 2;
  box-shadow: var(--shadow-card);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  border: none;
  background: #f1efff;
  border-radius: 999px;
  width: 34px;
  height: 34px;
  font-size: 1.2rem;
  cursor: pointer;
}

.modal-content h3 {
  margin: 0 0 6px;
}

.modal-section {
  margin-top: 14px;
  padding: 12px;
  border-radius: var(--radius-md);
  background: #f8f7ff;
}

.alert-community {
  background: rgba(245, 158, 11, 0.15);
  color: #92400e;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-top: 10px;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 12px 18px;
  border-radius: 999px;
  border: none;
  background: var(--color-accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.toast-container {
  position: fixed;
  z-index: 3000;
  right: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--color-text);
  color: #fff;
  padding: 12px 16px;
  border-radius: 12px;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  max-width: 280px;
  font-size: 0.85rem;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.info {
  background: var(--color-text);
}

.toast.error {
  background: #b91c1c;
}

.toast.success {
  background: #047857;
}

@media (min-width: 900px) {
  .input-row {
    flex-direction: row;
  }

  .primary-btn {
    min-width: 140px;
  }

  .filter-row {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .content-grid {
    grid-template-columns: 1.1fr 0.9fr;
  }

  .mobile-tabs {
    display: none;
  }

  .map {
    height: 540px;
  }
}

@media (max-width: 899px) {
  body[data-view="map"] .list-panel {
    display: none;
  }

  body[data-view="list"] .map-panel {
    display: none;
  }
}
