/* ==========================================================================
   CSS DESIGN SYSTEM - GESTIONE PARCO AUTO CROCE ROSSA COMITATO DI FOGGIA
   ========================================================================== */

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

:root {
  /* Tavolozza Colori Premium CRI */
  --primary: #e11d48;          /* Rosso Rubino */
  --primary-hover: #be123c;
  --primary-light: #fff1f2;
  
  --secondary: #0f172a;        /* Slate Slate 900 */
  --secondary-hover: #1e293b;
  
  /* Stati e Allert */
  --success: #10b981;          /* Verde Regolare */
  --success-light: #ecfdf5;
  --warning: #f59e0b;          /* Giallo In Scadenza */
  --warning-light: #fffbeb;
  --danger: #ef4444;           /* Rosso Scaduto */
  --danger-light: #fef2f2;
  --info: #3b82f6;
  
  /* Colori di Base */
  --bg-app: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  
  /* Ombreggiature e Bordi */
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.02);
  --shadow-md: 0 10px 25px -5px rgba(0,0,0,0.05), 0 8px 10px -6px rgba(0,0,0,0.03);
  --shadow-lg: 0 20px 40px -10px rgba(0,0,0,0.08), 0 10px 15px -8px rgba(0,0,0,0.04);
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset Stili Generali */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .font-display {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
}

/* ==========================================================================
   STRUTTURA ACCESSO (LOGIN) & VISIBILITÀ RUOLI
   ========================================================================== */

/* Toggle di Visibilità delle Viste */
body.guest .app-container {
  display: none !important;
}

body.authenticated #login-screen {
  display: none !important;
}

/* Controllo permessi CRUD per Amministratori */
body.role-user .admin-only,
body.role-gestore .admin-only {
  display: none !important;
}

body.role-admin .admin-only {
  display: block; /* oppure inline-block/flex in base al tag */
}

/* Controllo permessi di Scrittura Veicoli per Gestori e Admin */
body.role-user .gestore-admin {
  display: none !important;
}

body.role-admin .gestore-admin,
body.role-gestore .gestore-admin {
  display: block; /* oppure inline-block/flex */
}

/* Visualizzazione specifica per l'utente */
body.role-user .user-only {
  display: block;
}

/* ==========================================================================
   SCHERMATA DI LOGIN
   ========================================================================== */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 10% 20%, rgba(225, 29, 72, 0.12), transparent 45%),
              radial-gradient(circle at 90% 80%, rgba(15, 23, 42, 0.8), transparent 50%),
              linear-gradient(135deg, #020617 0%, #0f172a 100%);
  padding: 20px;
  position: relative;
}

.login-card {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  width: 100%;
  max-width: 450px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), 0 30px 60px -15px rgba(0,0,0,0.5);
  padding: 40px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.login-card:hover {
  border-color: rgba(225, 29, 72, 0.25);
  box-shadow: var(--shadow-lg), 0 30px 60px -15px rgba(225, 29, 72, 0.1);
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--primary) 0%, #f43f5e 100%);
}

.login-logo {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px auto;
  filter: drop-shadow(0 8px 16px rgba(225,29,72,0.3));
}

.login-header h2 {
  font-size: 1.8rem;
  color: #ffffff;
  margin-bottom: 5px;
}

.login-header p {
  color: #94a3b8;
  font-size: 0.95rem;
  margin-bottom: 30px;
}

.form-group {
  margin-bottom: 20px;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #cbd5e1;
  margin-bottom: 6px;
}

#login-screen .input-control {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  transition: var(--transition);
  background-color: rgba(255, 255, 255, 0.04);
  color: #ffffff;
}

#login-screen .input-control::placeholder {
  color: #4b5563;
}

#login-screen .input-control:focus {
  outline: none;
  border-color: var(--primary);
  background-color: rgba(255, 255, 255, 0.07);
  box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.25);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary {
  background-color: var(--primary);
  color: #fff;
  width: 100%;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  box-shadow: 0 8px 20px rgba(225,29,72,0.3);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background-color: var(--secondary);
  color: #fff;
}

.btn-secondary:hover {
  background-color: var(--secondary-hover);
}

.btn-outline {
  background-color: transparent;
  border: 1.5px solid var(--border-color);
  color: var(--secondary);
}

.btn-outline:hover {
  background-color: var(--border-color);
}

.login-helper {
  margin-top: 25px;
  background-color: rgba(255, 255, 255, 0.01);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: 0.85rem;
  color: #94a3b8;
  border: 1px dashed rgba(255, 255, 255, 0.06);
}

.login-helper code {
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
  color: #f43f5e;
  font-weight: 600;
}

/* ==========================================================================
   APP HEADER & NAVIGATION (Rosso Croce Rossa Italiana)
   ========================================================================== */
.app-header {
  background: #0f172a; /* Tema Ardesia Scuro Premium */
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 20px -2px rgba(0,0,0,0.15);
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.brand-logo {
  width: 46px;
  height: 46px;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.3));
}

.brand-text h1 {
  font-size: 1.3rem;
  color: #ffffff;
  letter-spacing: 0.5px;
}

.brand-text p {
  font-size: 0.75rem;
  color: var(--primary); /* Rosso rubino per branding */
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  text-decoration: none;
  color: #94a3b8; /* Slate leggero */
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  border: 1px solid transparent;
}

.nav-link:hover {
  color: #ffffff;
  background-color: rgba(255, 255, 255, 0.03);
}

.nav-link.active {
  color: #fff;
  background-color: rgba(225, 29, 72, 0.1);
  border: 1px solid rgba(225, 29, 72, 0.2);
  font-weight: 600;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-info {
  text-align: right;
}

.user-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: #ffffff;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 700;
  border: 1px solid transparent;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-admin {
  background: hsla(343, 90%, 96%, 1);
  color: hsla(343, 85%, 45%, 1);
  border-color: hsla(343, 90%, 90%, 1);
}

.badge-user {
  background: hsla(200, 95%, 96%, 1);
  color: hsla(200, 95%, 40%, 1);
  border-color: hsla(200, 95%, 90%, 1);
}

.badge-gestore {
  background: hsla(25, 95%, 96%, 1);
  color: hsla(25, 95%, 40%, 1);
  border-color: hsla(25, 95%, 90%, 1);
}

.btn-logout {
  padding: 8px 14px;
  font-size: 0.85rem;
  color: #94a3b8;
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
}

.btn-logout:hover {
  background-color: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(225,29,72,0.25);
}

/* Spinner di Caricamento Cloud */
.cloud-loading-container {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  background-color: var(--bg-card);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   APP MAIN CONTENT VIEWS
   ========================================================================== */
.app-main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 30px 24px;
}

.view-section {
  display: none;
  animation: fadeIn 0.4s ease-out;
}

.view-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Titolo Sezione */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
}

.section-header h2 {
  font-size: 1.8rem;
  color: var(--secondary);
  position: relative;
}

.section-header h2::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 0;
  width: 50px;
  height: 3.5px;
  background-color: var(--primary);
  border-radius: 2px;
}

/* ==========================================================================
   CRUSCOTTO / DASHBOARD
   ========================================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: var(--bg-card);
  padding: 24px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.stat-info h3 {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--secondary);
  font-family: 'Outfit', sans-serif;
  line-height: 1;
}

.stat-icon {
  width: 54px;
  height: 54px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.stat-card.total .stat-icon {
  background-color: #f1f5f9;
  color: var(--secondary);
}

.stat-card.danger .stat-icon {
  background-color: var(--danger-light);
  color: var(--danger);
  animation: pulseDanger 2s infinite;
}

.stat-card.warning .stat-icon {
  background-color: var(--warning-light);
  color: var(--warning);
}

.stat-card.ok .stat-icon {
  background-color: var(--success-light);
  color: var(--success);
}

@keyframes pulseDanger {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  70% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Layout Dashboard */
.dashboard-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 25px;
}

@media (max-width: 1024px) {
  .dashboard-layout {
    grid-template-columns: 1fr;
  }
}

/* Card Generiche */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  padding: 24px;
  margin-bottom: 25px;
}

.card-title {
  font-size: 1.15rem;
  color: var(--secondary);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}

/* Lista degli Allerta Attivi */
.alerts-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 480px;
  overflow-y: auto;
  padding-right: 5px;
}

.alert-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  border-left: 4px solid transparent;
  transition: var(--transition);
}

.alert-item:hover {
  transform: translateX(3px);
}

.alert-item.critico {
  background-color: var(--danger-light);
  border-left-color: var(--danger);
  color: #7f1d1d;
}

.alert-item.inscadenza {
  background-color: var(--warning-light);
  border-left-color: var(--warning);
  color: #78350f;
}

.alert-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.alert-content {
  flex-grow: 1;
}

.alert-title {
  font-weight: 700;
  margin-bottom: 2px;
}

.alert-desc {
  font-size: 0.85rem;
  opacity: 0.9;
}

.no-alerts {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

.no-alerts-icon {
  font-size: 2.5rem;
  color: var(--success);
  margin-bottom: 12px;
}

/* ==========================================================================
   LISTA E TABELLA VEICOLI
   ========================================================================== */
.filters-bar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px 24px;
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

.search-box {
  position: relative;
  flex-grow: 1;
  max-width: 400px;
  min-width: 250px;
}

.search-box input {
  width: 100%;
  padding: 10px 16px 10px 40px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  transition: var(--transition);
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary);
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.95rem;
}

.filter-group {
  display: flex;
  gap: 12px;
  align-items: center;
}

.select-control {
  padding: 10px 16px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  background-color: #fff;
  cursor: pointer;
  outline: none;
  transition: var(--transition);
}

.select-control:focus {
  border-color: var(--primary);
}

/* Tabella Premium */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  background: transparent;
  border-radius: 0;
  border: none;
  box-shadow: none;
}

.fleet-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 10px;
  text-align: left;
  font-size: 0.9rem;
}

.fleet-table th {
  background-color: transparent;
  color: var(--secondary);
  font-weight: 700;
  padding: 8px 24px;
  border-bottom: none;
  font-family: 'Outfit', sans-serif;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.fleet-table td {
  padding: 16px 24px;
  background-color: var(--bg-card);
  border-top: 1.5px solid var(--border-color);
  border-bottom: 1.5px solid var(--border-color);
  color: var(--text-main);
  vertical-align: middle;
  transition: var(--transition);
}

.fleet-table td:first-child {
  border-left: 1.5px solid var(--border-color);
  border-top-left-radius: var(--radius-sm);
  border-bottom-left-radius: var(--radius-sm);
}

.fleet-table td:last-child {
  border-right: 1.5px solid var(--border-color);
  border-top-right-radius: var(--radius-sm);
  border-bottom-right-radius: var(--radius-sm);
}

.fleet-table tbody tr {
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.fleet-table tbody tr:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.fleet-table tbody tr:hover td {
  background-color: #fafbfc;
  border-color: #cbd5e1;
}

.td-vehicle {
  display: flex;
  align-items: center;
  gap: 12px;
}

.vehicle-type-icon {
  width: 40px;
  height: 40px;
  background-color: var(--primary-light);
  color: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.vehicle-model {
  font-weight: 700;
  color: var(--secondary);
}

.vehicle-type-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.badge-plate {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border: 2px solid #0f172a;
  color: #0f172a;
  padding: 4px 12px;
  border-radius: 6px;
  letter-spacing: 1px;
  font-size: 0.85rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
  display: inline-block;
  text-align: center;
  position: relative;
}

.badge-plate::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background-color: #003399;
  border-top-left-radius: 4px;
  border-bottom-left-radius: 4px;
}

/* Stato Allerta Cella */
.alert-dot-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.alert-dot.critico { background-color: var(--danger); animation: dotPulseDanger 1.5s infinite; }
.alert-dot.inscadenza { background-color: var(--warning); }
.alert-dot.regolare { background-color: var(--success); }

@keyframes dotPulseDanger {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.5; }
  100% { transform: scale(1); opacity: 1; }
}

/* Azioni Riga */
.actions-cell {
  display: flex;
  gap: 8px;
}

.btn-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.9rem;
}

.btn-icon-edit {
  background-color: #eff6ff;
  color: #2563eb;
}

.btn-icon-edit:hover {
  background-color: #2563eb;
  color: #fff;
}

.btn-icon-delete {
  background-color: var(--danger-light);
  color: var(--danger);
}

.btn-icon-delete:hover {
  background-color: var(--danger);
  color: #fff;
}

/* ==========================================================================
   VISUALIZZAZIONE GRAFICI
   ========================================================================== */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 25px;
  margin-bottom: 25px;
}

@media (max-width: 900px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

.chart-wrapper {
  position: relative;
  height: 320px;
  width: 100%;
}

.chart-card-large {
  grid-column: span 2;
}

@media (max-width: 900px) {
  .chart-card-large {
    grid-column: span 1;
  }
}

/* ==========================================================================
   MODALI - FINESTRE POP-UP
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(5px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-container {
  background: var(--bg-card);
  width: 95%;
  max-width: 900px;
  max-height: 92vh;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-container.modal-md {
  max-width: 520px;
}

@media (min-width: 768px) {
  .modal-container {
    width: 85%;
  }
}

@media (min-width: 1200px) {
  .modal-container {
    width: 70%;
    max-width: 1000px;
  }
  .modal-container.modal-md {
    width: 45%;
    max-width: 550px;
  }
}

.modal-overlay.open .modal-container {
  transform: scale(1);
}

.modal-header {
  background-color: var(--secondary);
  color: #fff;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 1.3rem;
  margin: 0;
}

.modal-close {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  font-size: 1.5rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

.modal-close:hover {
  background-color: rgba(255,255,255,0.1);
  color: #fff;
}

.modal-tabs {
  display: flex;
  background-color: #f1f5f9;
  border-bottom: 1px solid var(--border-color);
}

.modal-tab-btn {
  flex: 1;
  padding: 12px 10px;
  border: none;
  background: transparent;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--transition);
  text-align: center;
  border-bottom: 3px solid transparent;
}

.modal-tab-btn:hover {
  color: var(--primary);
  background-color: rgba(211, 47, 47, 0.05);
}

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

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex-grow: 1;
}

.modal-container form {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  overflow: hidden;
  min-height: 0;
}

.modal-tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.modal-tab-content.active {
  display: block;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 600px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

.form-group-full {
  grid-column: span 2;
}

@media (max-width: 600px) {
  .form-group-full {
    grid-column: span 1;
  }
}

.modal-footer {
  padding: 16px 24px;
  background-color: #f8fafc;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Stili specifici per i campi di input nelle schede */
.section-subheading {
  font-size: 0.95rem;
  color: var(--primary);
  border-bottom: 1.5px solid var(--primary-light);
  padding-bottom: 6px;
  margin: 15px 0 10px 0;
  grid-column: span 2;
  font-weight: 600;
}

@media (max-width: 600px) {
  .section-subheading {
    grid-column: span 1;
  }
}

.optional-badge {
  background-color: #e2e8f0;
  color: var(--text-muted);
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
  font-weight: normal;
}

/* Stile per messaggi di alert connessione */
#cloud-connection-message.success {
  background-color: var(--success-light);
  color: #065f46;
  border-left: 4px solid var(--success);
}

#cloud-connection-message.error {
  background-color: var(--danger-light);
  color: #991b1b;
  border-left: 4px solid var(--danger);
}

/* Fine Stile */
