/* ═══════════════════════════════════════════════════════════════════════════════
   Sulla Soglia — admin-giovani CSS
   Estratto da admin-giovani.html (Sprint 10 Fase A, 2026-04-18).
   Carica dopo admin.css. Dark mode via [data-theme="dark"].
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Utility */
.hidden {
  display: none !important;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
  border-bottom: 2px solid #e8e8e4;
}
.tab-btn {
  padding: 8px 18px;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: #888;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: all 0.15s;
  font-family: inherit;
}
.tab-btn:hover {
  color: #2c2c2a;
}
.tab-btn.active {
  color: #b53a1e;
  border-bottom-color: #b53a1e;
  font-weight: 600;
}
.tab-panel {
  display: none;
}
.tab-panel.active {
  display: block;
}

/* Dashboard grid */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}

/* Scelte dinamiche (dilemmi) */
.scelta-row {
  display: grid;
  grid-template-columns: 50px 1fr 1fr auto;
  gap: 8px;
  margin-bottom: 8px;
  align-items: start;
}
.scelta-row input,
.scelta-row textarea {
  width: 100%;
}
.scelta-row textarea {
  min-height: 40px;
}
.scelta-row .scelta-lettera {
  text-align: center;
}
.btn-remove-scelta {
  padding: 6px 10px;
  border: 1px solid #ddd;
  background: white;
  border-radius: 6px;
  cursor: pointer;
  color: #a32d2d;
  font-size: 14px;
}
.btn-remove-scelta:hover {
  background: #fcebeb;
}

/* Confronti: avanzamento stato inline */
.confronto-advance-btn {
  margin-top: 8px;
}
.confronto-quartiere {
  color: #888;
}

/* Patto version */
.patto-current {
  background: white;
  border-radius: 10px;
  border: 2px solid #b53a1e;
  padding: 20px;
  margin-bottom: 16px;
}
.patto-current h3 {
  font-size: 1rem;
  color: #b53a1e;
  margin-bottom: 8px;
}
.patto-current .patto-text {
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  color: #333;
}
.patto-current .patto-meta {
  font-size: 11px;
  color: #888;
  margin-top: 10px;
}
.patto-history-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 10px;
  color: #888;
}
.patto-empty {
  margin-bottom: 16px;
}

/* Keys table */
.key-label {
  font-weight: 600;
}
.key-ruolo {
  font-size: 11px;
  color: #888;
  text-transform: uppercase;
}
.key-access {
  font-size: 11px;
  color: #aaa;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
}
.modal-overlay.is-hidden {
  display: none;
}
.modal {
  background: white;
  border-radius: 12px;
  padding: 24px;
  width: 560px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}
.modal.modal--sm {
  width: 420px;
}
.modal h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid #f0efeb;
}
.modal-close {
  float: right;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #888;
  padding: 0 4px;
}
.modal-close:hover {
  color: #2c2c2a;
}

/* Checkbox inline */
.checkbox-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}
.checkbox-inline input {
  width: auto;
}

/* Stato filter width (contributi) */
.stato-filter {
  min-width: 130px;
}

/* Confirm text (contributo modal) */
.confirm-text {
  font-size: 14px;
  color: #444;
  margin-bottom: 16px;
}

/* Form actions: elimina a destra */
.btn-del-aligned {
  margin-left: auto;
}
.btn-add-scelta-spaced {
  margin-top: 8px;
}

/* Dark mode overrides for giovani-specific elements */
[data-theme='dark'] .tab-btn:hover {
  color: #e8e4dc;
}
[data-theme='dark'] .tab-btn.active {
  color: #d4785f;
  border-bottom-color: #d4785f;
}
[data-theme='dark'] .tabs {
  border-bottom-color: #3c3830;
}
[data-theme='dark'] .patto-current {
  background: #2b2720;
  border-color: #d4785f;
}
[data-theme='dark'] .patto-current h3 {
  color: #d4785f;
}
[data-theme='dark'] .patto-current .patto-text {
  color: #c8c4bc;
}
[data-theme='dark'] .scelta-row .btn-remove-scelta {
  background: #2b2720;
  border-color: #3c3830;
}
[data-theme='dark'] .modal {
  background: #2b2720;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}
[data-theme='dark'] .modal h3 {
  border-bottom-color: #3c3830;
  color: #e8e4dc;
}
[data-theme='dark'] .modal-close {
  color: #9a9690;
}
[data-theme='dark'] .modal-close:hover {
  color: #e8e4dc;
}
[data-theme='dark'] .confronto-quartiere {
  color: #9a9690;
}
[data-theme='dark'] .patto-history-title {
  color: #9a9690;
}
@media (max-width: 768px) {
  .dash-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .scelta-row {
    grid-template-columns: 40px 1fr;
  }
  .scelta-row textarea {
    grid-column: 2;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   TAB CACCE (Laboratorio Mappa-Caccia v2)
   ═══════════════════════════════════════════════════════════════════════════ */

.cacce-detail-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 0.75rem;
  margin-bottom: 1rem;
}
.cacce-detail-toolbar h2 {
  margin: 0;
  flex: 1;
  min-width: 200px;
}

.cacce-section {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
}
.cacce-section:first-of-type {
  border-top: none;
  padding-top: 0;
}
.cacce-section h3 {
  margin: 0;
  font-size: 1rem;
}

.section-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.section-count {
  font-weight: normal;
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

/* Info grid (dt/dd) */
.cacce-info-grid {
  display: grid;
  grid-template-columns: minmax(140px, max-content) 1fr;
  gap: 0.5rem 1rem;
  margin: 0;
  padding: 0.75rem 1rem;
  background: var(--color-bg);
  border-radius: var(--radius);
}
.cacce-info-grid dt {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  align-self: start;
}
.cacce-info-grid dd {
  margin: 0;
  font-size: 0.9rem;
  color: var(--color-text);
  word-break: break-word;
}

/* Helpers */
.color-swatch {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  vertical-align: middle;
}
.muted-small {
  color: var(--color-text-muted);
  font-size: 0.8rem;
  line-height: 1.4;
}
.clip-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.danger-text {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-left: 3px solid #dc2626;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  line-height: 1.5;
}
[data-theme='dark'] .danger-text {
  background: rgba(220, 38, 38, 0.1);
  border-color: rgba(220, 38, 38, 0.3);
  border-left-color: #ef4444;
}

/* Form helpers */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.form-divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 1rem 0;
}
.form-hint {
  display: block;
  font-size: 0.78rem;
  color: var(--color-text-muted);
  margin-top: 0.25rem;
  font-style: italic;
}

.dilemma-fields {
  background: rgba(192, 68, 40, 0.04);
  border: 1px solid rgba(192, 68, 40, 0.15);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin: 0.75rem 0;
}
[data-theme='dark'] .dilemma-fields {
  background: rgba(192, 68, 40, 0.08);
  border-color: rgba(192, 68, 40, 0.25);
}
.dilemma-fields h4 {
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
  color: var(--color-primary);
}

.foto-preview {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
  text-align: center;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.foto-preview code {
  font-family: monospace;
  font-size: 0.78rem;
  background: var(--color-bg-card);
  padding: 2px 6px;
  border-radius: 3px;
}

.foto-thumb {
  display: inline-block;
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
}
.foto-thumb--empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  font-size: 0.8rem;
}
.foto-preview-img {
  display: block;
  max-width: 100%;
  max-height: 320px;
  width: auto;
  height: auto;
  margin: 0 auto 0.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  object-fit: contain;
}

/* Badge stato caccia */
.badge-progettazione {
  background: #e0e7ff;
  color: #3730a3;
}
.badge-pronta {
  background: #dbeafe;
  color: #1e40af;
}
.badge-in_corso {
  background: #fef3c7;
  color: #92400e;
}
.badge-conclusa {
  background: #d1fae5;
  color: #065f46;
}
.badge-archiviata {
  background: #f3f4f6;
  color: #4b5563;
}
[data-theme='dark'] .badge-progettazione {
  background: rgba(99, 102, 241, 0.18);
  color: #a5b4fc;
}
[data-theme='dark'] .badge-pronta {
  background: rgba(59, 130, 246, 0.18);
  color: #93c5fd;
}
[data-theme='dark'] .badge-in_corso {
  background: rgba(245, 158, 11, 0.18);
  color: #fcd34d;
}
[data-theme='dark'] .badge-conclusa {
  background: rgba(16, 185, 129, 0.18);
  color: #6ee7b7;
}
[data-theme='dark'] .badge-archiviata {
  background: rgba(156, 163, 175, 0.18);
  color: #9ca3af;
}

/* Badge tipo indizio */
.badge-fisico {
  background: #f3e8ff;
  color: #6b21a8;
}
.badge-verbale {
  background: #ffedd5;
  color: #9a3412;
}
.badge-dilemma {
  background: #fee2e2;
  color: #991b1b;
}
.badge-hub_scambio {
  background: #e0f2fe;
  color: #0369a1;
}
.badge-foto_luogo_da_mostrare,
.badge-foto_selfie_testimone,
.badge-foto_soglia_comune {
  background: #ecfdf5;
  color: #047857;
}
[data-theme='dark'] .badge-fisico {
  background: rgba(168, 85, 247, 0.18);
  color: #d8b4fe;
}
[data-theme='dark'] .badge-verbale {
  background: rgba(249, 115, 22, 0.18);
  color: #fdba74;
}
[data-theme='dark'] .badge-dilemma {
  background: rgba(239, 68, 68, 0.18);
  color: #fca5a5;
}
[data-theme='dark'] .badge-hub_scambio {
  background: rgba(14, 165, 233, 0.18);
  color: #7dd3fc;
}
[data-theme='dark'] .badge-foto_luogo_da_mostrare,
[data-theme='dark'] .badge-foto_selfie_testimone,
[data-theme='dark'] .badge-foto_soglia_comune {
  background: rgba(16, 185, 129, 0.18);
  color: #6ee7b7;
}

/* Badge stato foto/liberatoria */
.badge-bozza {
  background: #f3f4f6;
  color: #4b5563;
}
.badge-approvata {
  background: #dbeafe;
  color: #1e40af;
}
.badge-pubblicata,
.badge-attiva {
  background: #d1fae5;
  color: #065f46;
}
.badge-rimossa,
.badge-ritirata {
  background: #fee2e2;
  color: #991b1b;
}
[data-theme='dark'] .badge-bozza {
  background: rgba(156, 163, 175, 0.18);
  color: #9ca3af;
}
[data-theme='dark'] .badge-approvata {
  background: rgba(59, 130, 246, 0.18);
  color: #93c5fd;
}
[data-theme='dark'] .badge-pubblicata,
[data-theme='dark'] .badge-attiva {
  background: rgba(16, 185, 129, 0.18);
  color: #6ee7b7;
}
[data-theme='dark'] .badge-rimossa,
[data-theme='dark'] .badge-ritirata {
  background: rgba(239, 68, 68, 0.18);
  color: #fca5a5;
}

@media (max-width: 768px) {
  .cacce-info-grid {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }
  .cacce-info-grid dt {
    margin-top: 0.5rem;
  }
  .form-grid-2 {
    grid-template-columns: 1fr;
  }
  .cacce-detail-toolbar h2 {
    flex: 1 1 100%;
    font-size: 1.1rem;
  }
}
