/* stile degli elementi globali */

:root {
    color-scheme: light dark;

    --testo-light: black;
    --testo-dark: white;

    --th-light: lightgrey;
    --th-dark: #222222;

    --td-light: lightgrey;
    --td-dark: #111111;

    --h2-light: blue;
    --h2-dark: deepskyblue;

    --bg-color-light: white;
    --bg-color-dark: black;

    --bg-hover-light: gray;
    --bg-hover-dark: darkgray;

    --main-max-size: 1080px;
}

html {
    font-family: ui-sans-serif, system-ui, sans-serif;
    font-size: 16px;
    color: light-dark(var(--testo-light), var(--testo-dark));
}

body {
    margin: 0;
    background-color: grey;
}

h1 {
    margin: 0;
    color: light-dark(var(--h2-light), var(--h2-dark));
}

h2 {
    color: light-dark(var(--h2-light), var(--h2-dark));
    width: 70%;
}

li {
    text-align: left;
}

p {
    padding-left: 16px;
    padding-right: 16px;
    max-width: 70%;
}

button {
    cursor: pointer;
    padding: 10px;
    margin: 2px;
}

input {
    font-size: 1rem;
    padding: 6px 20px 6px 40px;
    margin: 8px 0;
    box-sizing: border-box;
    border: none;
    border-radius: 20px;
}

/* stile globale delle tabelle */

table {
    width: 100%;
    border-collapse: collapse;
}

table td,
table th {
    padding: 10px;
    vertical-align: middle;
}

table th {
    background-color: light-dark(var(--th-light), var(--th-dark));
}

/* stile degli elementi semantici */

main {
    display: flex;
    min-height: 100vh;
    flex-direction: column;
    max-width: var(--main-max-size);
    margin: 0 auto;
}

header {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    /* height: min-content; */
    height: 42px;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: light-dark(var(--bg-color-light), var(--bg-color-dark));
}

/* stile del menu a scomparsa (dropdown) e dei pulsanti del tema*/

.dropdown {
    position: relative;
}

.dropdown-content {
    display: none;
    position: absolute;
    z-index: 1000;
    min-width: max-content;
    box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
}

.dropdown-content div {
    color: light-dark(var(--testo-light), var(--testo-dark));
    background-color: light-dark(var(--th-light), var(--th-dark));
    cursor: pointer;
    padding: 12px 10px;
    text-decoration: none;
    display: block;
    font-weight: bold;
}

.dropdown-content div:hover {
    background-color: gray;
}

button:hover {
    background-color: light-dark(var(--bg-hover-light), var(--bg-hover-dark));
}

/* stile delle sezioni e degli elementi che le compongono */

#sezioni {
    flex: 1;
    background-color: light-dark(var(--bg-color-light), var(--bg-color-dark));
    width: 100%;
    align-items: center;
    position: relative;
}

.sezione {
    display: none;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

div.scheda {
    display: flex;
    flex-direction: column;
    align-items: center;
    border-color: light-dark(var(--th-light), var(--th-dark));
    border-radius: 6px;
    border-style: solid;
    border-width: 1px;
    margin-bottom: 0.5rem;
    margin-top: 0.5rem;
    width: 70%;
}

.titolo {
    text-align: center;
    font-weight: bold;
}

.paragrafo {
    text-align: justify;
}

/* stile specifico della sezione normativa */

#normativa p.testo {
    display: none;
    text-align: justify;
}

#normativa p.articolo {
    font-weight: bold;
    text-align: center;
    display: flex;
    align-items: center;
}

#normativa p.articolo:hover {
    cursor: pointer;
}

/* stile specifico della tabella matrice */

.matrice {
    max-width: 480px;
    text-align: center;
    table-layout: fixed;
}

.matrice td,
.matrice th {
    border: 4px solid light-dark(var(--testo-dark), var(--testo-light));
    color: light-dark(var(--testo-light), var(--testo-dark));
    font-weight: bold;
}

.matrice td:first-of-type {
    text-align: right;
    padding: 0 5px 0 0;
}

.matrice .vuoto {
    border: 0px;
}

.matrice .prob,
.matrice .grav {
    cursor: pointer;
}

.matrice .selezionato,
.rigaGruppo .selezionato {
    outline: 4px solid orange;
}

table .rischio1 {
    background-color: green;
    color: white;
    height: 2rem;
    width: 2rem;
    font-size: 1.5rem;
}

table .rischio2 {
    background-color: yellow;
    color: black;
    height: 2rem;
    width: 2rem;
    font-size: 1.5rem;
}

table .rischio3 {
    background-color: red;
    color: white;
    height: 2rem;
    width: 2rem;
    font-size: 1.5rem;
}

table .rischio4 {
    background-color: #222222;
    color: white;
    height: 2rem;
    width: 2rem;
    font-size: 1.5rem;
}

/* stile specifico della sezione agenti */

#agenti {
    height: calc(100vh - 42px);
}

/* stile specifico del flexbox dei gruppi */

#gruppiAgenti {
    display: flex;
    flex-direction: row;
    margin: 5px 11rem;
    flex-wrap: wrap;
    justify-content: center;
}

.rigaGruppo {
    display: flex;
    align-items: center;
    margin: 5px 0px;
    width: calc(50% - 20px);
    min-width: 340px;
}

.boxGruppo {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    border-radius: 4px;
    user-select: none;
}

.boxGruppo:hover {
    cursor: pointer;
}

.rigaGruppo .boxGruppo {
    margin: 0 10px 0 0;
}

.gruppo1 {
    background-color: green;
    color: white;
}

.gruppo2 {
    background-color: yellow;
    color: black;
}

.gruppo3 {
    background-color: red;
    color: white;
}

.gruppo4 {
    background-color: #222222;
    color: white;
}

/* stile specifico della tabella agenti e del filtro */

.gruppoFiltro {
    display: flex;
    align-items: center;
    margin-top: 1rem;
    margin-bottom: 1rem;
    justify-content: center;
}

.gruppoFiltro button {
    margin-left: 1rem;
    padding: 0;
    width: 2rem;
    height: 2rem;
}

.tabAgentiWrapper {
    overflow-y: auto;
    width: 100%;
}

#elencoAgenti {
    width: 100%;
}

#elencoAgenti th {
    position: sticky;
    top: 0;
    z-index: 1;
    border: 0;
}

/* larghezza colonne per evitare il ridensionamento del filtro */

#elencoAgenti th:nth-child(1) {
    width: 10vw;
}

#elencoAgenti th:nth-child(2) {
    width: 50vw;
}

#elencoAgenti th:nth-child(3) {
    width: 3rem;
}

#elencoAgenti th:nth-child(4) {
    width: 10vw;
}

#elencoAgenti tr:nth-of-type(even) {
    background-color: light-dark(var(--td-light), var(--td-dark));
}

#elencoAgenti td {
    padding: 5px;
}

#elencoAgenti .boxGruppo {
    margin: 0 auto;
}

.vaccino {
    color: green;
}

/* stile specifico della sezione PDF e del QR code */

#pdf {
    /* flex-wrap: wrap; */
    justify-content: space-between;
    height: calc(100vh - 42px);
}

.download {
    margin: auto;
}

.download a {
    display: inline-block;
    background-color: light-dark(var(--h2-light), var(--h2-dark));
    color: white;
    padding: 12px 18px;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    font-size: 1.3rem;
    margin: 2rem;
}

#qrcode {
    /* margin: auto 0 0 0; */
    max-width: 400px;
    max-height: 400px;
}

#qrcode canvas {
    width: 50vw;
    height: 50vw;
    max-width: 20rem;
    max-height: 20rem;
}

/* media queries per dispositivi mobili */

@media (max-width: 768px) {
    html {
        font-size: 13px;
    }

    .vaccino {
        font-size: 1.3rem;
    }

    p {
        font-size: 1rem;
        padding-left: 0;
        padding-right: 0;
        max-width: 90%;
    }

    h1 {
        font-size: 1.5rem;
    }

    div.scheda {
        width: 90%;
    }

    #gruppi {
        width: 90%;
        margin-top: 1rem;
        /* margin-bottom: 1rem; */
    }

    .tabAgentiWrapper {
        margin-top: 0.5rem;
    }

    .gruppoFiltro {
        margin-top: 0;
        margin-bottom: 0;
    }

    table th {
        padding: 5px;
    }

    .rigaGruppo {
        min-width: 280px;
    }
}

@media (max-width: 360px) {
    html {
        font-size: 10px;
    }

    .tab {
        font-size: 1.2rem;
    }
}

@media (max-height: 600px) and (orientation: landscape) {

    /* toglie lo scroll alla tabella agenti per basse risoluzioni verticali */
    /* quando si ruota in orizzontale il dispositivo mobile */
    #agenti {
        height: auto;
    }

    #qrcode canvas {
        width: 35vh;
        height: 35vh;
    }
}