/* === STILE LINGUETTE ORIZZONTALI E BOTTONI AZIONE === */
.tab-bar {
  display: flex;
  justify-content: center;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 0.25rem;
  padding: 0 1rem;
  margin-bottom: -1px;
  position: relative;
  z-index: 10;
}

/* Bottoni stile linguetta e azione */
.tab-btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  color: white !important;
  font-weight: bold;
  text-decoration: none;
  border: none;
  cursor: pointer;
  text-align: center;
  box-shadow: inset 0 -4px 0 rgba(0,0,0,0.15);
  transition: background-color 0.3s, box-shadow 0.3s, transform 0.2s;
  width: 100%;
  max-width: 260px;
  min-width: 200px;
}

/* Icona interna */
.tab-btn i {
  margin-right: 5px;
}

/* Hover con ombra */
.tab-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

/* Tab attiva */
.tab-btn.active {
  box-shadow: inset 0 -5px 0 #fff, 0 1px 4px rgba(0,0,0,0.2);
  z-index: 20;
}

/* Colori linguette */
.tab-magenta   { background-color: #c100fb !important; }
.tab-fucsia    { background-color: #ea076c !important; }
.tab-rosso     { background-color: #fb2f04 !important; }
.tab-arancio   { background-color: #ec7e0f !important; }
.tab-giallo    { background-color: #ffbc09 !important; }

/* Colori per pulsanti azione */
.btn-verde     { background-color: #198754 !important; }
.btn-blu       { background-color: #0d6efd !important; }
.btn-rosso     { background-color: #d60c32 !important; }

/* Compatibilità ASP.NET LinkButton */
.tab-btn:focus {
  outline: none;
}

/* Stile contenitore bottoni azione */
.bottone-gruppo {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

/* Responsive */
@media (max-width: 576px) {
  .tab-btn {
    width: 100%;
    max-width: 100%;
  }
}

/* === Pulsanti moderni stile pillola === */
.btn-pill {
  font-size: 1.1rem;
  padding: 0.6rem 1.8rem;
  font-weight: 600;
  border-radius: 999px;
  transition: all 0.3s ease-in-out;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.btn-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-pill i {
  margin-right: 0.5rem;
}

.bottone-gruppo {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 1rem;
}

@media (min-width: 768px) {
  .bottone-gruppo {
    flex-direction: row;
    justify-content: center;
  }
}


/* GRUPPO 3 PULSANTI - Responsive */
.bottone-gruppo-tre {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.bottone-gruppo-tre .btn-wrapper {
  flex: 1 1 calc(33.333% - 1rem);
  display: flex;
  justify-content: center;
}

@media (max-width: 768px) {
  .bottone-gruppo-tre {
    flex-direction: column;
    align-items: center;
  }

  .bottone-gruppo-tre .btn-wrapper {
    width: 100%;
    justify-content: center;
  }

  .bottone-gruppo-tre .btn-wrapper:nth-child(1) {
    order: 2; /* Annulla sotto */
  }

  .bottone-gruppo-tre .btn-wrapper:nth-child(2) {
    order: 1; /* Calcola sopra */
  }

  .bottone-gruppo-tre .btn-wrapper:nth-child(3) {
    order: 0; /* Salva in cima */
  }
}



/* GRUPPO 3 PULSANTI - Responsive migliorato */
.bottone-gruppo-tre {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 1rem;
}

.bottone-gruppo-tre .btn-wrapper {
  flex: 1;
  display: flex;
  justify-content: center;
}

/* Ordine su mobile: Salva, Calcola, Annulla */
@media (max-width: 768px) {
  .bottone-gruppo-tre {
    flex-direction: column;
    align-items: stretch;
  }

  .bottone-gruppo-tre .btn-wrapper {
    order: 0;
    width: 100%;
    justify-content: center;
  }

  .bottone-gruppo-tre .btn-wrapper:nth-child(1) { order: 2; } /* Annulla */
  .bottone-gruppo-tre .btn-wrapper:nth-child(2) { order: 1; } /* Calcola */
  .bottone-gruppo-tre .btn-wrapper:nth-child(3) { order: 0; } /* Salva */
}
@media (max-width: 767.98px) {
    .bottone-gruppo .tab-btn {
        margin-bottom: 1rem;
    }

        .bottone-gruppo .tab-btn:last-child {
            margin-bottom: 0;
        }
}

/* Layout di default: pulsanti in riga */
.bottone-gruppo-3 {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

/* Modalità mobile */
@media (max-width: 576px) {
    .bottone-gruppo-3 {
        flex-direction: column;
        align-items: stretch;
    }

    /* Ordine dei pulsanti */
    #btm_aggiorna {
        order: 1;
    }
    /* Salva in alto */
    #btm_calcola {
        order: 2;
    }
    /* Calcola al centro */
    #btm_annulla {
        order: 3;
    }
    /* Annulla in basso */

    /* Spaziatura verticale */
    .bottone-gruppo-3 .tab-btn {
        margin-bottom: 0.75rem;
    }
        /* Rimuove margine all'ultimo */
        .bottone-gruppo-3 .tab-btn:last-child {
            margin-bottom: 0;
        }
}

/* ===== FIX MOBILE per bottone-gruppo-3: ordine, spaziatura uniforme e larghezza ===== */
@media (max-width: 576px) {
  .bottone-gruppo-3 {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem; /* spaziatura uniforme tra tutti i pulsanti */
  }

  /* Ordine: Salva (su), Calcola (centro), Annulla (giù) */
  #btm_aggiorna { order: 1; }  /* Salva */
  #btm_calcola  { order: 2; }  /* Calcola */
  #btm_annulla  { order: 3; }  /* Annulla */

  /* Evita margini diversi dovuti a regole precedenti */
  .bottone-gruppo-3 .tab-btn {
    width: 100%;
    margin: 0 !important;      /* niente margini verticali: usa solo gap */
    text-align: center;
  }
}

/* ===== Desktop/Tablet: allineamento coerente ===== */
@media (min-width: 577px) {
  .bottone-gruppo-3 {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
  }
}

/* Solo per il blocco Ottimizzazione del Paziente */
.card .form-check-input:checked {
    background-color: #FF6E00 !important;
    border-color: #FF6E00 !important;
}

.card .form-check-input:focus {
    box-shadow: 0 0 0 0.25rem rgba(255, 110, 0, 0.25) !important;
}

/* === Gradient per le varianti colore delle tab-btn === */
/* fallback: i background-color esistenti restano come base */

.tab-btn.btn-verde {
    background-image: linear-gradient(135deg, #006699 0%, #99CC33 100%) !important;
    box-shadow: 0 10px 24px rgba(0,102,153,.28);
    color: #fff !important;
}

.tab-btn.btn-rosso {
    background-image: linear-gradient(135deg, #990066 0%, #FF6600 100%) !important;
    box-shadow: 0 10px 24px rgba(153,0,102,.28);
    color: #fff !important;
}

.tab-btn.btn-blu {
    background-image: linear-gradient(135deg, #0D6EFD 0%, #0B5ED7 100%) !important;
    box-shadow: 0 10px 24px rgba(13,110,253,.28);
    color: #fff !important;
}

/* Tab blu con gradiente più marcato */
.tab-btn.btn-blu {
    background-color: #7215A5 !important; /* fallback */
    background-image: linear-gradient(135deg, #7215A5 0%, #00AAFF 100%) !important;
    color: #fff !important;
    box-shadow: 0 10px 24px rgba(0,170,255,.28);
}

    /* (opzionale) effetti più “vivi” */
    .tab-btn.btn-blu:hover {
        filter: brightness(1.06);
        transform: translateY(-2px);
        box-shadow: 0 12px 28px rgba(0,170,255,.35);
    }

    .tab-btn.btn-blu:focus-visible {
        outline: 3px solid rgba(0,170,255,.35);
        outline-offset: 2px;
    }

/* Stati interattivi coerenti */
.tab-btn:hover {
    filter: brightness(1.06);
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(0,0,0,.18);
}

.tab-btn:active {
    transform: translateY(0);
    filter: brightness(.98);
}

.tab-btn:focus-visible {
    outline: 3px solid rgba(13,110,253,.35);
    outline-offset: 2px;
}

/* Disabilitato */
.tab-btn[disabled], .tab-btn.disabled {
    opacity: .6;
    pointer-events: none;
    filter: none;
    transform: none;
    box-shadow: none;
}

/* Switch verdi SOLO dentro il blocco Disturbi */
.bloc-disturbi .form-switch .form-check-input:checked {
    background-color: #A5DC37 !important;
    border-color: #A5DC37 !important;
}

.bloc-disturbi .form-switch .form-check-input:focus {
    box-shadow: 0 0 0 .25rem rgba(165,220,55,.25);
}

.bloc-disturbi .form-switch .form-check-input:active {
    filter: brightness(.95);
}

.btn-gradient-blue {
    background: linear-gradient(90deg, #0d6efd 0%, #0a58ca 100%);
    color: #fff !important;
    font-weight: 500;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap; /* evita che il testo vada a capo */
}

    .btn-gradient-blue:hover {
        background: linear-gradient(90deg, #0a58ca 0%, #084298 100%);
        color: #fff !important;
        text-decoration: none;
    }

.btn-gradient-blue {
    background: linear-gradient(90deg,#0d6efd 0%,#0a58ca 100%);
    color: #fff !important;
    font-weight: 500;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    white-space: nowrap;
}

    .btn-gradient-blue:hover {
        background: linear-gradient(90deg,#0a58ca 0%,#084298 100%);
        color: #fff !important;
        text-decoration: none;
    }