/* ===== VARIABILI E IMPOSTAZIONI GLOBALI ===== */
:root {
  --primary-dark: #1a2a3a;
  --secondary-dark: #2c3e50;
  --accent-color: #3498db;
  --positive: #28a745;
  --negative: #dc3545;
  --text-light: #f8f9fa;
  --bg-light: #f8fafc;
  --border-color: #dee2e6;
}

/* Reset e impostazioni globali */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-light);
  color: #212529;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.9rem;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ===== HEADER COMPATTO ===== */
header {
  background: linear-gradient(135deg, var(--primary-dark), var(--secondary-dark));
  padding: 0.5rem 1rem;
  position: sticky;
  top: 0;
  z-index: 1000;
}

header h1 {
  color: var(--text-light) !important;
  font-weight: 600;
  font-size: 1.1rem;
  margin: 0;
  display: flex;
  align-items: center;
}

header h1 i {
  margin-right: 10px;
}

/* Navigazione */
.nav {
  display: flex;
  list-style: none;
  margin-bottom: 0;
}

.nav-link {
  color: rgba(255, 255, 255, 0.85) !important; /* Bianco trasparente */
  padding: 0.25rem 0.5rem !important;
  font-size: 0.85rem;
  text-decoration: none;
  transition: color 0.2s ease;
  display: flex;
  align-items: center;
}

.nav-link:hover, 
.nav-link.active {
  color: white !important; /* Bianco pieno al passaggio del mouse */
}

.nav-link i {
  margin-right: 5px;
  font-size: 0.9em;
}

/* Badge compatti */
.badge {
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
  font-weight: 500;
}

/* ===== CONTENUTO PRINCIPALE ===== */
.container-fluid {
  padding: 1rem;
  flex-grow: 1;
}

/* Alert compatti */
.alert {
  border-radius: 4px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
}

.alert-success {
  background-color: rgba(40, 167, 69, 0.15);
  color: var(--positive);
}

/* Card e tabella */
.card {
  border: none;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  background-color: white;
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.card-body {
  padding: 0.5rem !important;
}

/* Titoli sezione */
h5 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
}

h5 i {
  margin-right: 8px;
}

/* Tabella ultra compatta */
#backtestsTable {
  font-size: 0.82rem;
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

#backtestsTable thead th {
  background-color: var(--primary-dark);
  color: white;
  font-weight: 600;
  font-size: 0.78rem;
  padding: 0.35rem 0.5rem;
  text-align: center;
  border: none;
}

#backtestsTable tbody td {
  padding: 0.3rem 0.5rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
  background-color: white;
}

#backtestsTable tbody tr:hover {
  background-color: #f8f9fa !important;
}

/* Allineamenti e formattazione */
.text-end {
  text-align: right !important;
  padding-right: 0.5rem;
}

.text-center {
  text-align: center !important;
}

.fw-medium {
  font-weight: 500;
}

.text-success { 
  color: var(--positive) !important; 
}

.text-danger { 
  color: var(--negative) !important; 
}

/* Bottoni compatti */
.btn {
  border-radius: 4px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-sm {
  padding: 0.1rem 0.3rem;
  font-size: 0.75rem;
}

.btn-outline-primary {
  border-color: var(--accent-color);
  color: var(--accent-color);
}

.btn-outline-primary:hover {
  background-color: var(--accent-color);
  color: white;
}

/* Footer compatto */
footer {
  font-size: 0.8rem;
  padding: 0.75rem 1rem !important;
  background-color: white;
  border-top: 1px solid var(--border-color);
}

/* ===== MEDIA QUERIES PER RESPONSIVITÀ ===== */
@media (max-width: 768px) {
  .container-fluid {
    padding: 0.75rem;
  }
  
  header {
    flex-wrap: wrap;
  }
  
  .nav {
    order: 2;
    margin-top: 0.5rem;
    width: 100%;
    justify-content: center;
  }
  
  .badge {
    margin-top: 0.25rem;
  }
  
  #backtestsTable {
    font-size: 0.78rem;
  }
  
  #backtestsTable thead th {
    font-size: 0.75rem;
    padding: 0.25rem 0.4rem;
  }
}

/* ===== DATA TABLE: ripristina ordinamento completo ===== */
#backtestsTable thead th {
  cursor: pointer;         /* mostra l’indice cliccabile */
  user-select: none;       /* evita la selezione accidentale di testo */
}

/* ===== UNIFORMITÀ CARD/FORM ===== */
.form-card {
  border: none;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  background-color: white;
  margin-bottom: 1.5rem;
}
.form-card .card-body {
  padding: 0.75rem 1rem !important;
}

/* ===== COMPACT PAGINATION ===== */
.dataTables_wrapper .dataTables_paginate .pagination {
  font-size: 0.75rem;            /* testo più piccolo */
}

.dataTables_wrapper .dataTables_paginate .paginate_button a,
.dataTables_wrapper .dataTables_paginate .paginate_button span {
  padding: 0.25rem 0.5rem !important;  /* padding ridotto */
  min-width: 1.5rem;                   /* larghezza minima */
}

.dataTables_wrapper .dataTables_paginate .paginate_button .fas {
  font-size: 0.75rem;            /* icone più piccole */
}
