/* ElleLost — Pannello Autorità — CSS */

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Poppins', system-ui, -apple-system, sans-serif;
  background: linear-gradient(135deg, #1a1a3e 0%, #2d1b5c 50%, #4b2882 100%);
  min-height: 100vh;
  color: #1a1a3e;
}

a { color: #B259F0; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ====== LOGIN ====== */
.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  background: #fff;
  border-radius: 24px;
  padding: 40px 36px;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  font-weight: 700;
  font-size: 18px;
  color: #1a1a3e;
}
.auth-brand img { width: 36px; height: 36px; }

.auth-card h1 {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.3px;
}

.auth-sub {
  color: #666;
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 28px;
}

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

.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #444;
}

.auth-form input, .auth-form select, .auth-form textarea {
  padding: 12px 14px;
  border: 1.5px solid #E0E0E0;
  border-radius: 12px;
  font-size: 15px;
  font-family: inherit;
  transition: border-color 0.2s;
}
.auth-form input:focus, .auth-form select:focus, .auth-form textarea:focus {
  outline: none;
  border-color: #B259F0;
}

.auth-form button {
  background: linear-gradient(135deg, #B259F0, #FF5E9C);
  color: #fff;
  border: none;
  padding: 14px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 8px;
  font-family: inherit;
  transition: transform 0.1s;
}
.auth-form button:hover:not(:disabled) { transform: translateY(-1px); }
.auth-form button:disabled { opacity: 0.6; cursor: not-allowed; }

.auth-forgot {
  text-align: center;
  font-size: 13px;
  margin-top: 6px;
  display: block;
}

.auth-error {
  background: #fff5f5;
  border: 1px solid #fed7d7;
  color: #c53030;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13.5px;
  margin-top: 14px;
}

.auth-success {
  background: #e8f5e9;
  border: 1px solid #a5d6a7;
  color: #1b5e20;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13.5px;
  margin-top: 14px;
}

.auth-footer {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid #eee;
  font-size: 12px;
  color: #777;
  line-height: 1.5;
}

/* ====== DASHBOARD ====== */
.dashboard-body { background: #f5f5fa; }

.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  color: #fff;
  background: linear-gradient(135deg, #1a1a3e 0%, #2d1b5c 50%, #4b2882 100%);
}

/* L'attributo HTML `hidden` imposta display:none, ma .loading-screen
   ha display:flex esplicito che vince per specificità. Forziamo
   display:none su qualsiasi elemento con attributo hidden, per il
   pannello autorità. Federico 11 mag 2026. */
[hidden] {
  display: none !important;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 18px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.dash-header {
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  padding: 14px 0;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.dash-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.dash-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #1a1a3e;
  font-weight: 700;
}
.dash-brand img { width: 36px; height: 36px; }
.dash-brand-text { font-size: 17px; font-weight: 800; line-height: 1; }
.dash-brand-tag { font-size: 11px; color: #888; font-weight: 500; margin-top: 2px; }

.dash-user { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.user-badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #fff;
}
.badge-comune { background: #1565C0; }
.badge-carabinieri { background: #C8102E; }
.badge-polizia_locale { background: #1B5E20; }
.badge-polizia_stato { background: #424242; }

.user-email { font-size: 13px; color: #666; }

.btn-ghost {
  background: transparent;
  border: 1.5px solid #ddd;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: #555;
  font-family: inherit;
}
.btn-ghost:hover { background: #f5f5fa; border-color: #B259F0; color: #B259F0; }

.dash-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 30px 20px 60px;
}

.dash-welcome {
  margin-bottom: 28px;
}
.dash-welcome h1 {
  margin: 0 0 4px;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #1a1a3e;
}
.dash-welcome h1 span { color: #B259F0; }
.dash-welcome p { color: #666; margin: 0; font-size: 14px; }

.dash-section {
  background: #fff;
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.dash-section h2 {
  margin: 0 0 16px;
  font-size: 19px;
  font-weight: 800;
  color: #1a1a3e;
  letter-spacing: -0.2px;
}

.dash-section-desc {
  color: #666;
  font-size: 14px;
  margin: -10px 0 18px;
  line-height: 1.5;
}

/* Stats grid */
.stats-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.stat-card {
  background: linear-gradient(135deg, #fafafa, #f0f0fa);
  padding: 18px;
  border-radius: 16px;
  border: 1px solid rgba(178, 89, 240, 0.08);
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 12px;
}

.stat-value {
  font-size: 30px;
  font-weight: 900;
  color: #1a1a3e;
  letter-spacing: -0.5px;
  line-height: 1;
}

.stat-label {
  font-size: 12.5px;
  color: #666;
  font-weight: 500;
  margin-top: 6px;
  line-height: 1.4;
}

/* Reports list */
.reports-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.report-row {
  display: grid;
  grid-template-columns: 110px 1fr 110px 140px;
  align-items: center;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 14px;
}
.report-row:last-child { border-bottom: none; }

.report-kind { font-size: 13px; color: #666; font-weight: 600; }

.report-title { font-weight: 600; color: #1a1a3e; }

.report-status {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 4px 10px;
  border-radius: 999px;
  text-align: center;
  width: fit-content;
}
.status-open, .status-searching { background: #fff3e0; color: #e65100; }
.status-resolved, .status-found { background: #e8f5e9; color: #1b5e20; }
.status-closed { background: #eeeeee; color: #555; }

.report-date { font-size: 12px; color: #888; text-align: right; }

@media (max-width: 720px) {
  .report-row {
    grid-template-columns: 1fr 1fr;
    grid-template-areas: 'kind status' 'title title' 'date date';
  }
  .report-kind { grid-area: kind; }
  .report-title { grid-area: title; }
  .report-status { grid-area: status; justify-self: end; }
  .report-date { grid-area: date; text-align: left; }
}

/* Alert form */
.alert-form { display: flex; flex-direction: column; gap: 16px; }
.alert-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #444;
}
.alert-form input, .alert-form textarea, .alert-form select {
  padding: 12px 14px;
  border: 1.5px solid #E0E0E0;
  border-radius: 12px;
  font-size: 14.5px;
  font-family: inherit;
}
.alert-form input:focus, .alert-form textarea:focus, .alert-form select:focus {
  outline: none;
  border-color: #B259F0;
}
.alert-form button {
  background: linear-gradient(135deg, #B259F0, #FF5E9C);
  color: #fff;
  border: none;
  padding: 13px;
  border-radius: 12px;
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.alert-form button:disabled { opacity: 0.6; cursor: not-allowed; }

#alertResult { margin-top: 14px; }

.info-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  font-size: 14px;
  color: #444;
}
.info-grid strong { color: #1a1a3e; }

.muted { color: #888; font-size: 13.5px; font-style: italic; }

/* ====== SHORTCUT CARDS (dashboard → sotto-pagine) ====== */
.shortcut-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.shortcut-card {
  display: grid;
  grid-template-columns: 56px 1fr 24px;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: linear-gradient(135deg, #fafafa, #f0f0fa);
  border-radius: 16px;
  border: 1px solid rgba(178, 89, 240, 0.1);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: transform 0.1s, border-color 0.15s, box-shadow 0.15s;
}
.shortcut-card:hover {
  transform: translateY(-2px);
  border-color: rgba(178, 89, 240, 0.35);
  box-shadow: 0 8px 20px rgba(178, 89, 240, 0.12);
  text-decoration: none;
}
.shortcut-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: #fff;
}
.shortcut-title { font-size: 16px; font-weight: 800; color: #1a1a3e; margin-bottom: 2px; }
.shortcut-desc { font-size: 13px; color: #666; line-height: 1.4; }
.shortcut-arrow {
  font-size: 24px;
  color: #B259F0;
  font-weight: 800;
}

/* Variante "Pubblica" — sfondo viola tenue per distinguerla da quella
   read-only "Esplora dati locali". Federico 11 mag 2026. */
.shortcut-card.publish-card {
  background: linear-gradient(135deg, #fff5fc, #f5edff);
  border-color: rgba(178, 89, 240, 0.25);
}
.shortcut-card.publish-card:hover {
  border-color: rgba(178, 89, 240, 0.55);
  box-shadow: 0 10px 24px rgba(178, 89, 240, 0.18);
}

/* ====== SOTTO-PAGINE: oggetti.html / persone.html ====== */

.filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-chip {
  background: #fff;
  border: 1.5px solid #e0e0e0;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13.5px;
  font-weight: 600;
  color: #555;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.filter-chip:hover { border-color: #B259F0; color: #B259F0; }
.filter-chip.active {
  background: linear-gradient(135deg, #B259F0, #FF5E9C);
  color: #fff;
  border-color: transparent;
}

.privacy-warn {
  background: #fff5e6;
  border-left: 4px solid #FFB54E;
  padding: 14px 18px;
  border-radius: 0 12px 12px 0;
  font-size: 14px;
  color: #6b4015;
  line-height: 1.55;
  margin-bottom: 18px;
}
.privacy-warn strong { color: #5a2e02; }

.items-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.item-card {
  display: grid;
  grid-template-columns: 80px 1fr 110px;
  align-items: center;
  gap: 16px;
  padding: 14px;
  background: #fafafa;
  border-radius: 14px;
  border: 1px solid #eee;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.item-card:hover { background: #f5f0fa; border-color: rgba(178,89,240,0.3); }
.item-card:active { transform: scale(0.997); }

.item-card.minor-warning {
  border-left: 4px solid #C8102E;
  background: #fffafa;
}

.item-thumb {
  width: 80px;
  height: 80px;
  border-radius: 12px;
  overflow: hidden;
  background: #f0f0fa;
  display: flex;
  align-items: center;
  justify-content: center;
}
.item-thumb img { width: 100%; height: 100%; object-fit: cover; }
.item-thumb-placeholder { font-size: 32px; }
.minor-blur { filter: blur(8px); }

.item-body { min-width: 0; }
.item-title {
  font-size: 15.5px;
  font-weight: 700;
  color: #1a1a3e;
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.item-meta {
  font-size: 13px;
  color: #666;
  margin-bottom: 8px;
}
.item-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: #555;
}
.item-stat { color: #777; }
.item-date {
  font-size: 12px;
  color: #888;
  text-align: right;
}

.minor-badge {
  background: #C8102E;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 999px;
}

@media (max-width: 720px) {
  .item-card {
    grid-template-columns: 70px 1fr;
    grid-template-areas: 'thumb body' 'thumb date';
  }
  .item-thumb { grid-area: thumb; width: 70px; height: 70px; }
  .item-body { grid-area: body; }
  .item-date { grid-area: date; text-align: left; }
}

/* ====== DETAIL DRAWER ====== */
.detail-drawer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  justify-content: flex-end;
}
.detail-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 26, 62, 0.5);
  backdrop-filter: blur(4px);
}
.detail-drawer-panel {
  position: relative;
  background: #fff;
  width: min(560px, 100vw);
  height: 100vh;
  overflow-y: auto;
  padding: 56px 28px 40px;
  box-shadow: -12px 0 40px rgba(0,0,0,0.2);
  animation: drawerSlide 0.25s ease-out;
}
@keyframes drawerSlide {
  from { transform: translateX(40px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.detail-close {
  position: absolute;
  top: 14px;
  right: 18px;
  background: transparent;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: #555;
  font-family: inherit;
  width: 36px;
  height: 36px;
  border-radius: 50%;
}
.detail-close:hover { background: #f0f0fa; color: #B259F0; }

.detail-drawer-panel h2 {
  margin: 0 0 4px;
  font-size: 24px;
  font-weight: 800;
  color: #1a1a3e;
}
.detail-drawer-panel h3 {
  margin: 20px 0 6px;
  font-size: 15px;
  font-weight: 800;
  color: #1a1a3e;
}

.detail-photos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.detail-photos img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 12px;
}

.sightings-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sighting-row {
  padding: 12px 14px;
  background: #f7f5fb;
  border-radius: 10px;
  font-size: 14px;
  color: #444;
}
.sighting-row strong { color: #1a1a3e; }

/* ====== BADGE "Pubblicato da autorità" ====== */
.authority-card {
  border-left: 4px solid #B259F0 !important;
  background: linear-gradient(135deg, #fafafa, #f5edff) !important;
}
.authority-pill {
  background: linear-gradient(135deg, #B259F0, #FF5E9C);
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.3px;
  padding: 3px 9px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.authority-banner {
  background: linear-gradient(135deg, #B259F0, #FF5E9C);
  color: #fff;
  padding: 10px 14px;
  border-radius: 12px;
  margin: 8px 0 14px;
  font-size: 13.5px;
  line-height: 1.45;
  box-shadow: 0 4px 12px rgba(178, 89, 240, 0.25);
}
.authority-banner strong { font-weight: 800; }
.authority-banner em { opacity: 0.92; font-style: normal; font-weight: 600; }

/* CTA "+ Pubblica" piccolo */
.btn-primary-mini {
  background: linear-gradient(135deg, #B259F0, #FF5E9C);
  color: #fff;
  border: none;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.1s, box-shadow 0.15s;
}
.btn-primary-mini:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(178, 89, 240, 0.3);
  text-decoration: none;
  color: #fff;
}
