/* =========================================================
   File: /Hotel/css/schedine.css
   Scopo: allineamenti modale schedina + Select2 uguale ai campi Bootstrap (sm)
   Regola progetto: NO CSS INLINE
========================================================= */

/* =========================================================
   MODALE SCHEDINA: LARGHEZZA + FONT (serve anche su Planning)
   Bootstrap 5.3 usa la variabile --bs-modal-width
========================================================= */

/* più larga su desktop, senza rompere mobile */
#schedinaModal .modal-dialog{
  --bs-modal-width: 1320px; /* più di modal-xl (1140px) */
}

@media (max-width: 1400px){
  #schedinaModal .modal-dialog{ --bs-modal-width: calc(100vw - 2rem); }
}

@media (max-width: 992px){
  #schedinaModal .modal-dialog{ --bs-modal-width: calc(100vw - 1rem); }
}

/* padding più compatto */
#schedinaModal .modal-body{ padding: .75rem; }

/* font leggermente più piccolo SOLO nella modale schedina */
#schedinaModal{
  --sc-font-size: .86rem;
  --sc-label-font-size: .78rem;
}

#schedinaModal .modal-body,
#schedinaModal .modal-body input,
#schedinaModal .modal-body select,
#schedinaModal .modal-body textarea,
#schedinaModal .modal-body .btn,
#schedinaModal .modal-body .form-control,
#schedinaModal .modal-body .form-select,
#schedinaModal .modal-body .input-group-text,
#schedinaModal .modal-body table{
  font-size: var(--sc-font-size);
}

#schedinaModal .form-label{ font-size: var(--sc-label-font-size); }

/* Modal body scroll (supporto extra oltre a modal-dialog-scrollable) */
#schedinaModal .schedina-modal-body{
  max-height: calc(100vh - 210px);
  overflow-y: auto;
}

/* Tabella membri: garantisci visibilità colonna azioni (trash) */
#schedinaModal #scMembriTable th:last-child,
#schedinaModal #scMembriTable td:last-child{
  width: 46px;
  min-width: 46px;
}

/* Evita che l'icona venga "tagliata" su layout stretti */
#schedinaModal #scMembriTable td:last-child .btn{
  padding-left: .35rem;
  padding-right: .35rem;
}

/* Etichette più compatte */
#schedinaModal .form-label{
  margin-bottom: .25rem;
}

/* Provincia 2 lettere: visual più corta */
#schedinaModal .sc-provincia-2{
  max-width: 90px;
}

/* --- Select2 = Bootstrap 5 (form-control-sm / form-select-sm) --- */
#schedinaModal .select2-container{
  width: 100% !important;
}

/* box */
#schedinaModal .select2-container--default .select2-selection--single{
  height: calc(1.5em + .5rem + 2px);     /* come .form-control-sm */
  padding: .25rem .5rem;                 /* come .form-control-sm */
  border: 1px solid #ced4da;
  border-radius: .2rem;                  /* sm */
  font-size: .875rem;
  line-height: 1.5;
  display: flex;
  align-items: center;
  background-color: #fff;
}

/* testo */
#schedinaModal .select2-container--default .select2-selection--single .select2-selection__rendered{
  padding: 0;
  line-height: 1.5;
  color: #212529;
  flex: 1 1 auto;
  margin-right: 2.25rem;                 /* spazio per freccia/clear */
}

/* freccia */
#schedinaModal .select2-container--default .select2-selection--single .select2-selection__arrow{
  height: 100%;
  right: .5rem;
  top: 0;
}

/* clear (x) */
#schedinaModal .select2-container--default .select2-selection--single .select2-selection__clear{
  position: absolute;
  right: 1.75rem;
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
  padding: 0 .25rem;
  line-height: 1;
}

/* focus */
#schedinaModal .select2-container--default.select2-container--focus .select2-selection--single,
#schedinaModal .select2-container--default.select2-container--open  .select2-selection--single{
  border-color: #86b7fe;
  box-shadow: 0 0 0 .25rem rgba(13,110,253,.25);
}

/* dropdown */
#schedinaModal .select2-dropdown{
  border-color: #ced4da;
  border-radius: .2rem;
  overflow: hidden;
}

/* search coerente con sm */
#schedinaModal .select2-search--dropdown .select2-search__field{
  height: calc(1.5em + .5rem + 2px);
  padding: .25rem .5rem;
  font-size: .875rem;
  border: 1px solid #ced4da;
  border-radius: .2rem;
  outline: none;
}

#schedinaModal .select2-results__option{
  font-size: .875rem;
  padding: .35rem .5rem;
}

/* Pallino rosso (capo famiglia/gruppo) - dopo il Cognome */
#schedineTable .sc-dot-tipo-ospite{
  display:inline-block;
  width:8px;
  height:8px;
  border-radius:50%;
  background:#dc3545;
  margin-left:6px;
  vertical-align:middle;
  box-shadow:0 0 0 2px rgba(220,53,69,.18);
}

/* =========================================================
   PAGINA SCHEDINE: header + toolbar + filtri
========================================================= */
.sc-pagehead{
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin: .1rem 0 1rem;
  padding: .15rem 0 .95rem;
  border-bottom: 1px solid rgba(0,0,0,.08);
}

.sc-pagehead-copy{
  min-width: 280px;
  flex: 1 1 420px;
}

.sc-page-title{
  margin: 0;
  font-size: 1.85rem !important;
  line-height: 1.04 !important;
}

.sc-page-subtitle{
  margin-top: .3rem;
  color: rgba(33,37,41,.64);
  font-size: .92rem;
}

.sc-toolbar{
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .55rem;
  flex: 0 1 auto;
  flex-wrap: wrap;
}

.sc-toolbar .btn{
  min-width: 136px;
}

.sc-main-card .card-body{
  padding: 1rem;
}

.sc-filters{
  display: grid;
  grid-template-columns: minmax(190px, 220px) minmax(190px, 220px) minmax(140px, 1fr);
  gap: .75rem;
  align-items: end;
}

.sc-filter-field{
  min-width: 0;
}

.sc-filter-actions{
  display: flex;
  justify-content: flex-end;
}

.sc-filter-actions .btn{
  min-width: 130px;
}

#schedineTable th,
#schedineTable td{
  vertical-align: middle;
}

@media (max-width: 991.98px){
  .sc-page-title{
    font-size: 1.65rem !important;
  }

  .sc-filters{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sc-filter-actions{
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

@media (max-width: 575.98px){
  .sc-pagehead{
    align-items: stretch;
  }

  .sc-toolbar,
  .sc-filter-actions{
    width: 100%;
  }

  .sc-toolbar .btn,
  .sc-filter-actions .btn{
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
  }

  .sc-filters{
    grid-template-columns: 1fr;
  }
}


/* =========================================================
   SCHEDINA MODALE - griglia componenti gruppo/famiglia
   v.2.21.k - micro-fix grafico mirato (no logica)
========================================================= */

/* Tabella compatta e stabile */
#schedinaModal #scMembriTable{
    table-layout: fixed;
    width: 100%;
}

#schedinaModal #scMembriTable th,
#schedinaModal #scMembriTable td{
    vertical-align: middle;
    overflow: hidden;
}

/* Input/select dentro la tabella */
#schedinaModal #scMembriTable input,
#schedinaModal #scMembriTable select,
#schedinaModal #scMembriTable .form-select,
#schedinaModal #scMembriTable .form-control{
    width: 100%;
    min-width: 0;
}

/* =========================================================
   LARGHEZZE COLONNE
   Ordine:
   1 Camera
   2 Cognome
   3 Nome
   4 S
   5 Data nascita
   6 I/E nascita
   7 Luogo nascita
   8 Cittadinanza
   9 I/E residenza
   10 Residenza
   11 Arrivo
   12 Partenza
   13 Azioni
   ========================================================= */

/* 1 Camera */
#schedinaModal #scMembriTable th:nth-child(1),
#schedinaModal #scMembriTable td:nth-child(1){
    width: 78px;
    min-width: 78px;
    max-width: 78px;
}

/* 2 Cognome */
#schedinaModal #scMembriTable th:nth-child(2),
#schedinaModal #scMembriTable td:nth-child(2){
    width: 155px;
    min-width: 155px;
    max-width: 155px;
}

/* 3 Nome */
#schedinaModal #scMembriTable th:nth-child(3),
#schedinaModal #scMembriTable td:nth-child(3){
    width: 145px;
    min-width: 145px;
    max-width: 145px;
}

/* 4 S */
#schedinaModal #scMembriTable th:nth-child(4),
#schedinaModal #scMembriTable td:nth-child(4){
    width: 58px;
    min-width: 58px;
    max-width: 58px;
}

/* 5 Data nascita */
#schedinaModal #scMembriTable th:nth-child(5),
#schedinaModal #scMembriTable td:nth-child(5){
    width: 120px;
    min-width: 120px;
    max-width: 120px;
}

/* 6 I/E nascita */
#schedinaModal #scMembriTable th:nth-child(6),
#schedinaModal #scMembriTable td:nth-child(6){
    width: 58px;
    min-width: 58px;
    max-width: 58px;
}

/* 7 Luogo nascita */
#schedinaModal #scMembriTable th:nth-child(7),
#schedinaModal #scMembriTable td:nth-child(7){
    width: 140px;
    min-width: 140px;
    max-width: 140px;
}

/* 8 Cittadinanza */
#schedinaModal #scMembriTable th:nth-child(8),
#schedinaModal #scMembriTable td:nth-child(8){
    width: 150px;
    min-width: 150px;
    max-width: 150px;
}

/* 9 I/E residenza */
#schedinaModal #scMembriTable th:nth-child(9),
#schedinaModal #scMembriTable td:nth-child(9){
    width: 58px;
    min-width: 58px;
    max-width: 58px;
}

/* 10 Residenza */
#schedinaModal #scMembriTable th:nth-child(10),
#schedinaModal #scMembriTable td:nth-child(10){
    width: 240px;
    min-width: 240px;
    max-width: 240px;
}

/* 11 Arrivo */
#schedinaModal #scMembriTable th:nth-child(11),
#schedinaModal #scMembriTable td:nth-child(11){
    width: 122px;
    min-width: 122px;
    max-width: 122px;
}

/* 12 Partenza */
#schedinaModal #scMembriTable th:nth-child(12),
#schedinaModal #scMembriTable td:nth-child(12){
    width: 122px;
    min-width: 122px;
    max-width: 122px;
}

/* 13 Azioni */
#schedinaModal #scMembriTable th:nth-child(13),
#schedinaModal #scMembriTable td:nth-child(13){
    width: 48px;
    min-width: 48px;
    max-width: 48px;
    text-align: center;
}

/* =========================================================
   INPUT / SELECT PER COLONNA
   ========================================================= */

/* Camera */
#schedinaModal #scMembriTable td:nth-child(1) select,
#schedinaModal #scMembriTable td:nth-child(1) .form-select{
    min-width: 68px;
    max-width: 68px;
}

/* Cognome */
#schedinaModal #scMembriTable td:nth-child(2) input{
    min-width: 135px;
    max-width: 135px;
}

/* Nome */
#schedinaModal #scMembriTable td:nth-child(3) input{
    min-width: 125px;
    max-width: 125px;
}

/* S */
#schedinaModal #scMembriTable td:nth-child(4) select,
#schedinaModal #scMembriTable td:nth-child(4) .form-select{
    min-width: 48px;
    max-width: 48px;
    /*
    padding-left: .45rem;
    padding-right: 1.4rem;
    */
    display: center
}

/* Data nascita */
#schedinaModal #scMembriTable td:nth-child(5) input[type="date"]{
    min-width: 110px;
    max-width: 110px;
    width: 110px;
    padding-right: 1.9rem;
}

/* I/E nascita */
#schedinaModal #scMembriTable td:nth-child(6) select,
#schedinaModal #scMembriTable td:nth-child(6) .form-select{
    min-width: 48px;
    max-width: 48px;
    /*
    padding-left: .4rem;
    padding-right: 1.3rem;
    */
    display: center;
}

/* Luogo nascita */
#schedinaModal #scMembriTable td:nth-child(7) .form-select,
#schedinaModal #scMembriTable td:nth-child(7) .form-control,
#schedinaModal #scMembriTable td:nth-child(7) select,
#schedinaModal #scMembriTable td:nth-child(7) input{
    min-width: 128px;
    max-width: 128px;
}

/* Cittadinanza */
#schedinaModal #scMembriTable td:nth-child(8) .form-select,
#schedinaModal #scMembriTable td:nth-child(8) .form-control,
#schedinaModal #scMembriTable td:nth-child(8) select,
#schedinaModal #scMembriTable td:nth-child(8) input{
    min-width: 138px;
    max-width: 138px;
}

/* I/E residenza */
#schedinaModal #scMembriTable td:nth-child(9) select,
#schedinaModal #scMembriTable td:nth-child(9) .form-select{
    min-width: 48px;
    max-width: 48px;
    /*
    padding-left: .4rem;
    padding-right: 1.3rem;
    */
    display: center;
}

/* Residenza */
#schedinaModal #scMembriTable td:nth-child(10) .form-select,
#schedinaModal #scMembriTable td:nth-child(10) .form-control,
#schedinaModal #scMembriTable td:nth-child(10) select,
#schedinaModal #scMembriTable td:nth-child(10) input{
    min-width: 240px;
    max-width: 240px;
}

/* Arrivo */
#schedinaModal #scMembriTable td:nth-child(11) input[type="date"]{
    min-width: 112px;
    max-width: 112px;
    width: 112px;
    padding-right: 1.9rem;
}

/* Partenza */
#schedinaModal #scMembriTable td:nth-child(12) input[type="date"]{
    min-width: 112px;
    max-width: 112px;
    width: 112px;
    padding-right: 1.9rem;
}

/* Azioni */
#schedinaModal #scMembriTable td:nth-child(13) .btn,
#schedinaModal #scMembriTable td:nth-child(13) button{
    width: 34px;
    height: 34px;
    padding: 0;
}

/* =========================================================
   RESIDENZA ESTERO
   - nasconde Città estera
   - lascia più spazio a Nazione
   ========================================================= */

#schedinaModal #scMembriTable [data-m-field="residenza_citta_estera"]{
    display: none !important;
}

#schedinaModal #scMembriTable .sc-m-res-est .col-7,
#schedinaModal #scMembriTable .sc-m-res-est .col-md-7,
#schedinaModal #scMembriTable .sc-m-res-est .col-lg-7{
    display: none !important;
}

#schedinaModal #scMembriTable .sc-m-res-est .col-5,
#schedinaModal #scMembriTable .sc-m-res-est .col-md-5,
#schedinaModal #scMembriTable .sc-m-res-est .col-lg-5{
    flex: 0 0 100% !important;
    max-width: 100% !important;
    width: 100% !important;
}

/* =========================================================
   SELECT2 / controlli interni più compatti
   ========================================================= */

#schedinaModal #scMembriTable .select2-container{
    width: 100% !important;
    min-width: 0 !important;
}

#schedinaModal #scMembriTable .select2-selection{
    min-height: 38px;
}

#schedinaModal #scMembriTable td:nth-child(7) .select2-container,
#schedinaModal #scMembriTable td:nth-child(8) .select2-container,
#schedinaModal #scMembriTable td:nth-child(10) .select2-container{
    max-width: 100%;
}

/* =========================================================
   COMPONENTI DEL GRUPPO - Residenza Italia senza Provincia
   ========================================================= */

/* Nasconde il wrapper della provincia nella riga membri */
#schedinaModal #scMembriTable .sc-m-res-it .col-3,
#schedinaModal #scMembriTable .sc-m-res-it .col-md-3,
#schedinaModal #scMembriTable .sc-m-res-it .col-lg-3{
    display: none !important;
}

/* Allarga il wrapper del Comune a tutta larghezza */
#schedinaModal #scMembriTable .sc-m-res-it .col-9,
#schedinaModal #scMembriTable .sc-m-res-it .col-md-9,
#schedinaModal #scMembriTable .sc-m-res-it .col-lg-9{
    flex: 0 0 100% !important;
    max-width: 100% !important;
    width: 100% !important;
}

/* Nasconde direttamente il campo provincia, se presente */
#schedinaModal #scMembriTable [data-m-field="residenza_provincia"]{
    display: none !important;
}

/* =========================================================
   HEADER
   ========================================================= */

#schedinaModal #scMembriTable thead th{
    white-space: nowrap;
}

/* Celle tabella */
#schedinaModal #scMembriTable tbody td{
    white-space: nowrap;
}