
/* ====== RIEPILOGO ANTROPOMETRICO — STILI UNIFICATI (FORZATI) ====== */

/* Desktop base */
.riepilogo-styled {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.95rem;
  table-layout: fixed;
}

.riepilogo-styled th,
.riepilogo-styled td {
  border: 1px solid #ddd;
  padding: 0.5rem;
  text-align: center;
  vertical-align: middle;
  word-wrap: break-word;
}

.riepilogo-styled thead tr,
.thead-riepilogo th {
  background-color: #4560BB !important;
  color: #fff !important;
  font-weight: bold;
}

.table.riepilogo-styled th,
.table.riepilogo-styled td {
  width: 12.5%; /* 8 colonne */
}

/* Caption */
@media (min-width: 992px) {
  .riepilogo-styled caption {
    display: table-caption;
    caption-side: top;
    text-align: center;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: #4560BB !important;
  }
}
@media (max-width: 991.98px) {
  .riepilogo-styled caption {
    display: block;
    caption-side: top;
    text-align: left;
    margin-bottom: 0.25rem;
    font-size: 1rem;
    font-weight: 700;
    color: #4560BB !important;
  }
}

/* ===== MOBILE (<=576px) — FORZA griglia 2 colonne ANCHE CON 1 SOLA RIGA ===== */
@media (max-width: 576px) {
  .riepilogo-styled thead { display: none !important; }

  /* Il <tbody> diventa una griglia 2 colonne */
  .riepilogo-styled tbody {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
  }

  /* Sgancia i <td> dal <tr> (anche se c'è solo 1 tr) */
  .riepilogo-styled tr {
    display: contents !important;
    border: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
  }

  /* Ogni <td> è un box con etichetta e valore */
  .riepilogo-styled td {
    display: flex !important;
    align-items: baseline;
    justify-content: space-between;
    gap: .5rem;
    border: 1px solid #e9ecef !important;
    border-radius: 8px !important;
    padding: .45rem .65rem !important;
    background: #fff !important;
    text-align: left !important;
    width: 100% !important;
    white-space: nowrap; /* evita a capo tra numero e unità */
  }

  .riepilogo-styled td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #4560BB;
    margin-right: .5rem;
    white-space: normal; /* l'etichetta può andare a capo */
  }

  /* Normalizza contenuto interno (asp:Label ecc.) */
  .riepilogo-styled td > * {
    margin: 0 !important;
  }
}

/* ===== Tablet (577–991.98px): compattazione delicata ===== */
@media (min-width: 577px) and (max-width: 991.98px) {
  .riepilogo-styled th,
  .riepilogo-styled td {
    padding: .45rem .4rem;
    font-size: .92rem;
  }
}

/* ===== Desktop (>=992px): allineamento preciso ===== */
@media (min-width: 992px) {
  .riepilogo-styled th,
  .riepilogo-styled td {
    vertical-align: middle;
  }
}


/* ===== MOBILE FIX (<=576px): etichetta sopra, valore sotto allineato a destra ===== */
@media (max-width: 576px) {
  .riepilogo-styled thead { display: none !important; }

  .riepilogo-styled tbody {
    display: grid !important;
    grid-template-columns: 1fr 1fr; /* due colonne di box */
    gap: 10px;
  }

  .riepilogo-styled tr { display: contents !important; }

  .riepilogo-styled td {
    display: block !important;
    border: 1px solid #e9ecef !important;
    border-radius: 10px !important;
    background: #ffffff !important;
    padding: .5rem .65rem .6rem .65rem !important;
    text-align: right !important;       /* valore allineato a destra */
    white-space: nowrap;                 /* evita a capo fra numero e unità */
    box-shadow: 0 1px 0 rgba(0,0,0,0.03);
  }

  /* Etichetta (sopra) */
  .riepilogo-styled td::before {
    content: attr(data-label);
    display: block;
    font-weight: 700;
    color: #0D2261;
    text-decoration: none !important;
    margin-bottom: .25rem;
    text-align: left;                    /* etichetta a sinistra */
    white-space: normal;                 /* l'etichetta può andare a capo */
  }

  /* Link o elementi interni: niente sottolineature o allineamenti strani */
  .riepilogo-styled td a {
    text-decoration: none !important;
    color: inherit !important;
  }

  /* Normalizza i figli (asp:Label ecc.) */
  .riepilogo-styled td > * {
    margin: 0 !important;
  }
}

/* GridView colonnato uniforme (6 colonne visibili) */
.gridview-small {
    table-layout: fixed; /* fissa le larghezze */
    width: 100%;
}

    .gridview-small th,
    .gridview-small td {
        width: calc(100% / 6); /* tutte uguali */
        vertical-align: middle;
        text-align: center;
        word-wrap: break-word;
        white-space: normal;
    }

        /* Rende i pulsanti del TemplateField compatti e non “allargano” la colonna */
        .gridview-small td .d-flex {
            gap: .5rem !important;
        }

        .gridview-small td .btn {
            padding: .3rem .5rem;
            font-size: .9rem;
            line-height: 1.1;
            white-space: nowrap;
            flex: 1 1 0;
            min-width: 0; /* evita overflow */
        }

        /* Evita che il contenuto forzi la larghezza della cella */
        .gridview-small td *,
        .gridview-small th * {
            max-width: 100%;
            overflow: hidden;
            text-overflow: ellipsis;
        }

/* Su mobile, mantieni lo scroll orizzontale senza rompere le colonne */
@media (max-width: 576px) {
    .table-responsive {
        overflow-x: auto;
    }

    .gridview-small th,
    .gridview-small td {
        font-size: .9rem;
    }
}

/* === FIX: bottoni nel GridView non tagliati e più alti === */
.gridview-small td .btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.8rem !important; /* più alti */
    line-height: 1.25 !important; /* evita schiacciamento testo/icone */
    min-height: 42px !important; /* touch-friendly (puoi portare a 44px) */
    white-space: nowrap; /* nessun a capo interno */
    overflow: visible !important; /* niente clipping */
    text-overflow: clip !important;
}

    /* Le icone non devono allungare la riga */
    .gridview-small td .btn i {
        line-height: 1;
    }

/* Contenitore dei due bottoni: non comprimere troppo i figli */
.gridview-small td .d-flex {
    gap: .5rem !important;
    align-items: stretch;
}

/* Evita che la cella “schiacci” il contenuto verticalmente */
.gridview-small th,
.gridview-small td {
    height: auto !important;
}

    /* L'ellissi non si applica ai bottoni (solo ad altri contenuti) */
    .gridview-small td .btn,
    .gridview-small td .btn * {
        max-width: none !important;
    }

/* === GridView IDP — versione super compatta SOLO per questo controllo === */
.table.gv-idp-compact,
.gv-idp-compact.table {
    margin-bottom: 0 !important; /* niente spazio sotto la tabella */
    font-size: 0.85rem; /* testo leggermente più piccolo */
}

.gv-idp-compact td,
.gv-idp-compact th {
    padding: 2px 6px !important; /* celle più strette */
    line-height: 1.1 !important; /* riduce l’altezza riga */
    vertical-align: middle !important;
}

.gv-idp-compact tr {
    height: auto !important; /* nessuna altezza minima */
}

.gv-idp-compact .btn {
    padding: 2px 6px !important; /* bottoni compatti */
    margin: 0 !important; /* elimina margini attorno */
    font-size: 0.75rem !important;
    line-height: 1.1 !important;
    min-height: 0 !important; /* sovrascrive min-height globali */
}

.gv-idp-compact .d-flex {
    gap: .25rem !important; /* meno spazio tra bottoni nel TemplateField */
}

/* Se vuoi ancora più “piatto”, puoi anche ridurre il bordo o il raggio */
.gv-idp-compact td,
.gv-idp-compact th {
    /* border-width: 1px !important; */
    /* border-radius: 0 !important;   <-- se usi radius da qualche parte */
}

/* Caption personalizzata SOLO per la tabella gv-idp-compact */
.gv-idp-compact caption {
    background-color: #4560BB;
    color: #FFFFFF;
    font-weight: bold;
    padding: 6px 8px; /* altezza maggiore */
    text-align: center;
    caption-side: top; /* posizione sopra la tabella */
    font-size: 0.95rem; /* leggermente più grande */
}

/* Header personalizzato per tabella compatta gv-idp-compact */
.gv-idp-compact thead th {
    background-color: #4560BB !important; /* sfondo blu */
    color: #FFFFFF !important; /* testo bianco */
    font-weight: bold;
    padding: 8px 10px; /* più alta */
    text-align: center;
    border: none; /* rimuove bordo interno */
}

    /* Arrotondamento solo agli angoli esterni */
    .gv-idp-compact thead th:first-child {
        border-top-left-radius: 8px;
    }

    .gv-idp-compact thead th:last-child {
        border-top-right-radius: 8px;
    }

/* Header SOLO per questa tabella compatta */
.gv-idp-compact thead tr,
.gv-idp-compact thead th {
    background-color: #4560BB !important; /* sfondo blu richiesto */
    color: #FFFFFF !important; /* testo bianco */
    font-weight: 700;
    border: none; /* pulisci i bordi Bootstrap */
    padding: 8px 10px; /* più alta */
    text-align: center;
}

    /* Link nell'header (sorting) in bianco e senza sottolineatura */
    .gv-idp-compact thead th a {
        color: #FFFFFF !important;
        text-decoration: none !important;
        font-weight: 700;
    }

    /* Arrotonda solo gli angoli esterni dell'header */
    .gv-idp-compact thead th:first-child {
        border-top-left-radius: 8px;
    }

    .gv-idp-compact thead th:last-child {
        border-top-right-radius: 8px;
    }

/* Se per qualche motivo resta .table-primary, forziamo anche questo selettore */
.gv-idp-compact .table-primary th {
    background-color: #4560BB !important;
    color: #FFFFFF !important;
}

/* Header blu solo per questa tabella */
.table.gv-idp-compact thead th,
.gv-idp-compact thead th {
    background-color: #4560BB !important;
    color: #FFFFFF !important;
    font-weight: 700;
    padding: 8px 10px;
    text-align: center;
    border: none !important;
}

    /* Link di sorting in bianco */
    .gv-idp-compact thead th a {
        color: #FFFFFF !important;
        text-decoration: none !important;
        font-weight: 700;
    }

    /* Arrotonda gli angoli esterni dell'header */
    .gv-idp-compact thead th:first-child {
        border-top-left-radius: 8px;
    }

    .gv-idp-compact thead th:last-child {
        border-top-right-radius: 8px;
    }

/* Fallback: colora qualsiasi TH in questa tabella */
.table.gv-idp-compact th {
    background-color: #4560BB !important;
    color: #FFFFFF !important;
    font-weight: 700;
    padding: 8px 10px;
    text-align: center;
    border: none !important;
}

    .table.gv-idp-compact th a {
        color: #FFFFFF !important;
        text-decoration: none !important;
    }

/* Header più alto SOLO per la tabella gv-idp-compact */
.gv-idp-compact thead th {
    background-color: #4560BB !important;
    color: #FFFFFF !important;
    font-weight: 700;
    padding: 14px 12px !important; /* ↑ aumenta l’altezza */
    line-height: 1.4 !important; /* ulteriore “slancio” verticale */
    text-align: center;
    border: none !important;
    vertical-align: middle;
}

    /* Link di sorting coerenti (bianco, senza sottolineatura) */
    .gv-idp-compact thead th a {
        color: #FFFFFF !important;
        text-decoration: none !important;
        font-weight: 700;
        line-height: 1.4 !important; /* allinea l’altezza anche ai link */
    }

    /* Arrotonda solo gli angoli esterni dell’header */
    .gv-idp-compact thead th:first-child {
        border-top-left-radius: 8px;
    }

    .gv-idp-compact thead th:last-child {
        border-top-right-radius: 8px;
    }

/* Header più alto SOLO per la tabella gv-idp-compact */
.gv-idp-compact thead th {
    background-color: #4560BB !important;
    color: #FFFFFF !important;
    font-weight: 700;
    padding: 14px 12px !important; /* ↑ aumenta l’altezza */
    line-height: 1.4 !important; /* ulteriore “slancio” verticale */
    text-align: center;
    border: none !important;
    vertical-align: middle;
}

    /* Link di sorting coerenti (bianco, senza sottolineatura) */
    .gv-idp-compact thead th a {
        color: #FFFFFF !important;
        text-decoration: none !important;
        font-weight: 700;
        line-height: 1.4 !important; /* allinea l’altezza anche ai link */
    }

    /* Arrotonda solo gli angoli esterni dell’header */
    .gv-idp-compact thead th:first-child {
        border-top-left-radius: 8px;
    }

    .gv-idp-compact thead th:last-child {
        border-top-right-radius: 8px;
    }