/* ============================================================
   Finetruck v2 — Premium SaaS UI (Polizia Locale)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Inter:wght@400;500;600&display=swap');

:root {
  /* Premium Palette (Blu Polizia) */
  --color-police-900: #1e3a8a; 
  --color-police-800: #1e40af; 
  --color-police-700: #1d4ed8; 
  --color-police-600: #1e40af; /* Navy Blue spento e scuro (Sidebar e Card Piccole) */
  --color-police-500: #3b82f6;
  --color-police-100: #dbeafe;
  --color-police-50: #eff6ff;  
  
  --bg-main: var(--color-police-50);
  
  --color-text-main: #1e293b; /* Quasi nero */
  --color-text-muted: #64748b;
  
  --radius-card: 24px;
  --radius-btn: 12px;
  
  --shadow-card: 0 10px 25px -5px rgba(30, 58, 138, 0.1);
  --shadow-hover: 0 20px 40px -8px rgba(30, 58, 138, 0.25);
}

body {
  font-family: 'Outfit', sans-serif;
  background: var(--bg-main);
  color: var(--color-text-main);
  min-height: 100vh;
  letter-spacing: -0.01em;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* --- PREMIUM UTILITIES --- */
.text-police { color: var(--color-police-700) !important; }
.bg-police-soft { background-color: var(--color-police-100) !important; }

/* --- PREMIUM BUTTONS --- */
.btn-police {
  background: var(--color-police-700);
  color: white;
  border-radius: var(--radius-btn);
  border: none;
  padding: 12px 24px;
  font-weight: 500;
  box-shadow: 0 4px 14px 0 rgba(30, 58, 138, 0.3);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-police:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px 0 rgba(30, 58, 138, 0.4);
  color: white;
  background: var(--color-police-800);
}

.btn-police-outline {
  background-color: transparent;
  color: var(--color-police-700);
  border: 2px solid var(--color-police-700);
  border-radius: var(--radius-btn);
  padding: 10px 24px;
  font-weight: 600;
  transition: all 0.3s;
}
.btn-police-outline:hover {
  background-color: var(--color-police-700);
  color: white;
}

/* --- CARDS --- */
.card {
  background: #ffffff;
  border: none;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.hover-scale:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-hover);
}

/* Colori per le card delle statistiche (Verde pastello + testo bianco) */
.card-stat-1, .card-stat-2, .card-stat-3, .card-stat-4 { background: var(--color-police-600); color: white; }
.card-stat-1 .text-muted, .card-stat-2 .text-muted, .card-stat-3 .text-muted, .card-stat-4 .text-muted { color: rgba(255,255,255,0.85) !important; }

/* Colori per le Action Cards (Bianche) */
.card-action-1 { background: #ffffff; border: 1px solid var(--color-police-100); }
.card-action-2 { background: #ffffff; border: 1px solid var(--color-police-100); }

/* --- SIDEBAR FLOATING VERDE --- */
.sidebar {
  background: var(--color-police-600) !important;
  color: white !important;
  box-shadow: 10px 10px 30px rgba(4, 120, 87, 0.15);
  min-width: 280px;
  max-width: 280px;
  padding: 2rem !important;
  z-index: 1000;
  
  /* Floating Effect */
  margin: 1rem;
  border-radius: 24px;
  height: calc(100vh - 2rem) !important;
  display: flex;
  flex-direction: column;
}

.sidebar .nav-link {
  color: rgba(255,255,255,0.7) !important;
  border-radius: var(--radius-btn);
  font-weight: 500;
  font-size: 1.05rem;
  transition: all 0.3s;
  padding: 1rem 1.2rem;
  margin-bottom: 0.5rem;
}
.sidebar .nav-link:hover, .sidebar .nav-link.active {
  background: rgba(255,255,255,0.15);
  color: white !important;
  transform: translateX(4px);
}
.sidebar .nav-link.active {
  font-weight: 600;
  box-shadow: inset 3px 0 0 white;
}

/* --- PREMIUM ICONS --- */
.stat-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  box-shadow: inset 0 0 0 1px rgba(29,78,216,0.1);
}
/* Icone su sfondo bianco */
.card-stat-1 .stat-icon { background: var(--color-police-50); color: var(--color-police-900); }
.card-stat-2 .stat-icon { background: var(--color-police-50); color: var(--color-police-800); }
.card-stat-3 .stat-icon { background: var(--color-police-50); color: var(--color-police-700); }
.card-stat-4 .stat-icon { background: var(--color-police-50); color: var(--color-police-600); }

/* Dropzone per Upload XML */
.upload-dropzone {
  border: 2px dashed rgba(29, 78, 216, 0.3);
  border-radius: var(--radius-card);
  padding: 3rem;
  background: rgba(255,255,255,0.5);
  transition: all 0.3s;
}
.upload-dropzone:hover {
  border-color: var(--color-police-700);
  background: white;
}

/* ============================================================
   Vecchi stili preservati per i verbali e infrazioni
   ============================================================ */

/* Evidenziazione variabili nei verbali */
.vhl, mark.vhl {
  background-color: #fff3cd;
  color: #000;
  font-weight: 600;
  padding: 0.05em 0.2em;
  border-radius: 3px;
  border-bottom: 2px solid #ffc107;
}

/* Card verbale */
.verbale-card {
  border-left: 4px solid var(--color-police-primary);
}

.verbale-testo {
  font-size: 0.92rem;
  line-height: 1.7;
  text-align: justify;
}

/* Accordion infrazioni */
.accordion-button:not(.collapsed) {
  background-color: var(--color-police-light);
  color: var(--color-police-primary);
}

/* Print styles */
@media print {
  .no-print { display: none !important; }
  .verbale-card {
    border: 1px solid #ccc;
    break-inside: avoid;
    margin-bottom: 2rem;
  }
  .verbale-block { page-break-after: always; }
  .vhl, mark.vhl {
    background-color: transparent;
    border-bottom: 1px dashed #333;
  }
}

/* ============================================================
   DARK MODE - TEMA BLU POLIZIA (SLATE & NAVY)
   ============================================================ */
body.dark-mode {
  /* Slate & Navy Premium Palette */
  --bg-main: #0f172a; /* Slate 900 */
  --color-police-600: rgba(30, 58, 138, 0.9); /* Navy traslucido per la sidebar */
  --color-police-100: #1e293b; /* Slate 800 */
  --color-text-main: #f8fafc; /* Slate 50 */
  --color-text-muted: #93c5fd; /* Ice Blue / Blu Chiaro per visibilità */
  
  --shadow-card: inset 0 1px 0 0 rgba(255, 255, 255, 0.05), 0 4px 6px -1px rgba(0, 0, 0, 0.5);
  --shadow-hover: inset 0 1px 0 0 rgba(255, 255, 255, 0.1), 0 10px 15px -3px rgba(0, 0, 0, 0.7);
  
  /* Override variabili Bootstrap */
  --bs-secondary-color: #93c5fd !important;
  --bs-tertiary-color: #93c5fd !important;
  --bs-body-color: #f8fafc !important;
}

/* Override Universali Sfondi Bootstrap */
body.dark-mode .bg-white,
body.dark-mode .bg-light {
  background-color: #1e293b !important;
  color: #f8fafc !important;
}
body.dark-mode .text-dark {
  color: #f8fafc !important;
}
body.dark-mode .text-muted,
body.dark-mode .text-secondary,
body.dark-mode .text-body-secondary,
body.dark-mode .text-tertiary,
body.dark-mode .text-body-tertiary,
body.dark-mode .text-black-50,
body.dark-mode .form-text {
  color: #93c5fd !important;
}

/* Card Generiche */
body.dark-mode .card,
body.dark-mode .card-action-1, 
body.dark-mode .card-action-2 {
  background-color: #1e293b !important;
  border-color: #334155 !important;
}
body.dark-mode .card-header {
  border-bottom-color: #334155 !important;
}

/* Soft Glow per Colori di Stato (Success/Verde) */
body.dark-mode .bg-success,
body.dark-mode .border-success {
  background-color: rgba(16, 185, 129, 0.15) !important;
  border-color: rgba(16, 185, 129, 0.4) !important;
  color: #34d399 !important;
}
body.dark-mode .text-success {
  color: #34d399 !important;
}
body.dark-mode .btn-success {
  background-color: rgba(16, 185, 129, 0.2) !important;
  color: #34d399 !important;
  border: 1px solid rgba(16, 185, 129, 0.5) !important;
}
body.dark-mode .btn-success:hover {
  background-color: rgba(16, 185, 129, 0.3) !important;
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.2);
}

/* Danger / Rosso */
body.dark-mode .btn-danger {
  background-color: rgba(239, 68, 68, 0.2) !important;
  color: #fca5a5 !important;
  border: 1px solid rgba(239, 68, 68, 0.5) !important;
}
body.dark-mode .btn-danger:hover {
  background-color: rgba(239, 68, 68, 0.3) !important;
}
body.dark-mode .btn-outline-danger {
  color: #f87171 !important;
  border-color: #f87171 !important;
  background-color: transparent !important;
}
body.dark-mode .btn-outline-danger:hover {
  background-color: rgba(239, 68, 68, 0.2) !important;
}
body.dark-mode .text-danger {
  color: #f87171 !important;
}

/* Elementi Blu Polizia (Accenti) */
body.dark-mode .text-police {
  color: #60a5fa !important;
}
body.dark-mode .bg-police-soft {
  background-color: rgba(59, 130, 246, 0.15) !important;
  border-color: #3b82f6 !important;
}
body.dark-mode .btn-police {
  background-color: #3b82f6 !important;
  color: #ffffff !important;
}
body.dark-mode .btn-police:hover {
  background-color: #60a5fa !important;
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.3);
}
body.dark-mode .btn-police-outline {
  border-color: #60a5fa !important;
  color: #60a5fa !important;
  background-color: transparent !important;
}
body.dark-mode .btn-police-outline:hover {
  background-color: rgba(59, 130, 246, 0.15) !important;
}

/* Badges e Alert */
body.dark-mode .badge.bg-secondary {
  background-color: #334155 !important;
  color: #e2e8f0 !important;
}
body.dark-mode .badge.bg-warning {
  background-color: rgba(245, 158, 11, 0.2) !important;
  color: #fcd34d !important;
  border: 1px solid rgba(245, 158, 11, 0.4) !important;
}
body.dark-mode .alert-info {
  background-color: rgba(59, 130, 246, 0.15) !important;
  border-color: rgba(59, 130, 246, 0.3) !important;
  color: #93c5fd !important;
}
body.dark-mode .alert-warning {
  background-color: rgba(245, 158, 11, 0.15) !important;
  border-color: rgba(245, 158, 11, 0.3) !important;
  color: #fcd34d !important;
}

/* Modali e Dropzone */
body.dark-mode .modal-content {
  background-color: #1e293b;
  border-color: #334155;
  color: #f8fafc;
}
body.dark-mode .modal-header,
body.dark-mode .modal-footer {
  border-color: #334155;
}
body.dark-mode .upload-dropzone {
  background: rgba(30, 41, 59, 0.5) !important;
  border-color: rgba(59, 130, 246, 0.3) !important;
}
body.dark-mode .upload-dropzone:hover {
  background: rgba(30, 41, 59, 0.9) !important;
  border-color: #3b82f6 !important;
}

/* Tabelle (Archivio) */
body.dark-mode .table {
  color: #f8fafc;
  border-color: #334155;
}
body.dark-mode .table-light {
  background-color: #0f172a !important;
  color: #93c5fd !important;
}
body.dark-mode .table-hover tbody tr:hover {
  color: #ffffff;
  background-color: rgba(255, 255, 255, 0.05) !important;
}
body.dark-mode .table>:not(caption)>*>* {
  background-color: transparent;
  color: inherit;
  border-bottom-color: #334155;
}

/* List Group (Lista Infrazioni) */
body.dark-mode .list-group-item {
  background-color: #1e293b;
  border-color: #334155;
  color: #f8fafc;
}
body.dark-mode .list-group-item:hover:not(.bg-police-soft) {
  background-color: #334155;
}

/* Form Control e Select */
body.dark-mode .form-control,
body.dark-mode .form-select {
  background-color: #0f172a !important;
  border-color: #334155 !important;
  color: #f8fafc !important;
}
body.dark-mode .form-control:focus,
body.dark-mode .form-select:focus {
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 0.25rem rgba(59, 130, 246, 0.25) !important;
}
body.dark-mode .form-control::placeholder {
  color: #93c5fd;
  opacity: 0.7;
}
body.dark-mode .form-control::file-selector-button {
  background-color: #1e293b !important;
  color: #f8fafc !important;
  border-color: #334155 !important;
}
body.dark-mode .form-control:hover::file-selector-button {
  background-color: #334155 !important;
}

/* Topbar Sticky e Navbar */
body.dark-mode .sticky-top,
body.dark-mode .border-bottom {
  border-color: #334155 !important;
}

/* Icone Statistiche */
body.dark-mode .card-stat-1 .stat-icon, 
body.dark-mode .card-stat-2 .stat-icon, 
body.dark-mode .card-stat-3 .stat-icon, 
body.dark-mode .card-stat-4 .stat-icon {
  background: rgba(59, 130, 246, 0.2) !important;
  color: #60a5fa !important;
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.4) !important;
}
body.dark-mode .card-action-1 .rounded-circle,
body.dark-mode .card-action-2 .rounded-circle {
  background: rgba(59, 130, 246, 0.15) !important;
  color: #60a5fa !important;
  border: 1px solid rgba(59, 130, 246, 0.3) !important;
}

/* Sidebar Navigazione */
body.dark-mode .sidebar .nav-link {
  color: rgba(255,255,255,0.6) !important;
}
body.dark-mode .sidebar .nav-link:hover, 
body.dark-mode .sidebar .nav-link.active {
  color: white !important;
  background: rgba(255,255,255,0.1) !important;
}
