@font-face {
    font-family: 'Lexend';
    src: url('fonts/Lexend-ExtraLight.ttf');
    font-style: normal;
    font-weight: 300;
}

@font-face {
    font-family: 'Lexend';
    src: url('fonts/Lexend-Light.ttf');
    font-style: normal;
    font-weight: 400;
}

@font-face {
    font-family: 'Lexend';
    src: url('fonts/Lexend-Medium.ttf');
    font-style: normal;
    font-weight: 500;
}

:root {
    --themeColor: #9b0014;
    --themeSecondaryColor: #203f6d;
    --themeContrastColor: #ffffff;
    --textColor: #212529;
    --textBackgroundColor: #f6f6f6;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: "Lexend", system-ui, sans-serif;
    font-size: 1.2em;
    margin: 0;
    padding: 0;
    background-color: var(--themeContrastColor);
    color: var(--textColor);
}

main {
    padding-top: 1em;
    line-height: 1.5em;
}

a:link {
    color: #3C74C8;
}

a:visited {
    color: black;
}

.link-dark {
    color: #212529;
}

strong {
    font-weight: 500;
}

abbr {
    text-decoration: none !important;
}

.btn {
    display: inline-block;
    font-weight: 400;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    vertical-align: middle;
    cursor: pointer;
    border: 1px solid transparent;
    padding: .375rem .75rem;
    font-size: 1em;
    border-radius: .25rem;
    transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}

/* ACCESSIBILITA */
.nav-accessibility {
    position: absolute;
    height: 1px;
    width: 1px;
    overflow: hidden;
    clip: rect(1px, 1px, 1px, 1px);
}

/* TORNA SU */
.btn-go-up {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background-color: #203f6d ;
    border-color: #203f6d ;
    color: var(--textBackgroundColor) !important;
}

.btn-go-up:visited {
    background-color: var(--themeSecondaryColor) !important;
    border-color: #203f6d ;
    color: var(--textBackgroundColor) !important;
}

.btn-go-up:focus-visible,
.btn-go-up:focus-visible {
    outline: 2px solid var(--textColor);
    border-radius: .25rem;
}

/* LANG SWITCH */
.language-switch {
    width: 95%;
    max-width: 95vw;
    margin: 0.5em auto 0.5em auto;
    display: flex;
    justify-content: flex-end;
    position: static;
    padding-right: 1em;
}

.lang-toggle {
    display: inline-block;
    position: relative;
    width: 80px;
    height: 32px;
}

.lang-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    background-color: #e0e0e0;
    border-radius: 16px;
    width: 100%;
    height: 100%;
    transition: background 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    margin: 0 0.5em;
    box-sizing: border-box;
    gap: 12px;
}

.lang-label {
    font-weight: bold;
    color: #203f6d;
    opacity: 0.5;
    transition: opacity 0.3s;
    font-size: 1em;
}

input:checked + .slider .lang-en {
    opacity: 1;
    color: #9b0014;
}
input:not(:checked) + .slider .lang-it {
    opacity: 1;
    color: #9b0014;
}
input:checked + .slider .lang-it {
    opacity: 0.5;
    color: #203f6d;
}
input:not(:checked) + .slider .lang-en {
    opacity: 0.5;
    color: #203f6d;
}


/* BANNER LOGHI */
.logo-banner {
    background-color: #9b0014;
    padding-bottom: 12px;
    padding-top: 5px;
    border-bottom: 1px solid white;
}

.logo-banner-container {
    display: flex;
    justify-content: center;
}

.logo-container-unipd {
    width: 3em;
    align-self: center;
    font-size: 3em !important;
    /*line-height: 1.5em;*/
    text-indent: -999em;
    background-image: url('../imgs/unipd_logo_white.png');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

.logo-container-informatica {
    width: 3em;
    align-self: center;
    font-size: 3em !important;
    /*line-height: 1.5em;*/
    text-indent: -999em;
    background-image: url('../imgs/informatica_logo_white.png');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

.logo-container-dm {
    width: 3em;
    align-self: center;
    font-size: 3em !important;
    /*line-height: 1.5em;*/
    text-indent: -999em;
    background-image: url('../imgs/matematica_logo_white.png');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

/* FOOTER */
footer {
    margin: auto;
    width: 90%;
}

.footer-link {
    display: block;
    padding: .5rem 1rem;
    transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out;
}

.logo-container-footer-unipd {
    /*width: 3em;
    align-self: center;*/
    font-size: 3em !important;
    text-indent: -999em;
    background-image: url('../imgs/unipd_logo_red.png');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

.logo-container-footer-dm {
    /*width: 3em;
    align-self: center;
    font-size: 3em;*/
    text-indent: -999em;
    background-image: url('../imgs/matematica_logo_red.png');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

.footer-contacts {
    text-align: center;
    list-style-type: none;
    margin-bottom: 0 !important;
    color: #6c757d !important;
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    padding: 0;
}

.footer-contacts address {
    margin-bottom: auto;
}

.footer-flex {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    padding-bottom: 1rem;
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
    border-top: 1px solid #dee2e6;
    gap: 1em;
}

.footer-link {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0;
    text-decoration: none !important;
    flex: 1 1 0;
    width: auto;
    min-width: 0;
}

main {
    background-color: var(--themeContrastColor);
    color: var(--textColor);
    width: 95%;
    margin: auto;
}

.btn-analyze {
    background-color: var(--themeColor);
    border-color: var(--themeContrastColor);
    color: var(--themeContrastColor);
    padding: 0.3em 1em;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 1em;
    margin: 0.5em 0.2em;
    cursor: pointer;
    border-radius: 5px;
}

.btn-reset {
    background-color: var(--themeContrastColor);
    border-color: var(--themeColor);
    color: var(--themeColor);
    padding: 0.3em 1em;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 1em;
    margin: 0.5em 0.2em;
    cursor: pointer;
    border-radius: 5px;
}


.title-hidden {
    visibility: hidden;
}

.title-visible {
    visibility: visible;
}

select {
    font-family: "Lexend", system-ui, sans-serif;
    font-size: 1em;
    color: white;
    background-color: var(--themeContrastColor);
    border: 1px solid var(--themeColor);
    color: var(--textColor);
    padding: 0.2em;
    border-radius: 5px;
}

.disabled-select {
    background-color: #e0e0e0 !important;
    color: #888 !important;
    cursor: not-allowed;
}

#imageForm {
    margin-bottom: 2em;
}

#canvasContainer {
    display: none;
    justify-content: space-between;
    gap: 1em;
    margin-bottom: 2em;
}

.canvas-column {
    align-items: center;
    flex: 1;
    max-width: calc(25% - 1em);
    height: auto;
    box-sizing: border-box;
}

@media (min-width: 901px) {
    .canvasContainer-2x2{
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        grid-template-rows: 1fr 1fr;
        gap: 1em;
    }
    
    .canvasContainer-2x2 .canvas-column {
        max-width: 100%;
    }
    
    .canvasContainer-2x2 .canvas-column canvas {
        height: 40vh;
        max-height: none;
    }
    
}

.canvas-column canvas {
    max-width: 100%;
    max-height: 300px;
    width: auto;
    height: auto;
    display: block;
    margin: 0 auto;
}

.canvas-title {
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 0.5em;
    text-align: center;
}

.block-title {
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 0.5em;
}

#quantizationTable table,
#DCTCoefficients table,
#ModQuantizTableEditable table {
    border-collapse: collapse;
    margin: 1em 1em;
    text-align: center;
}

#quantizationTable td,
#DCTCoefficients td,
#ModQuantizTableEditable td{
    width: 1.5em;
    height: 1.5em;
    border: 1px solid black;
    padding: 0;
    text-align: center;
    vertical-align: middle;
}

#quantizationTable th,
#DCTCoefficients th,
#ModQuantizTableEditable th {
    width: 1.5em;
    height: 1.5em;
    border: 1px solid black;
    text-align: center;
    vertical-align: middle;
}

#AnalysisResults {
    display: grid;
    grid-template-columns: 60% 1fr;
    grid-template-areas:
    "CanvasContainer text"
    "ModQuantContainer text";
    gap: 1em;
    width: 100%;
    box-sizing: border-box;
    align-items: start;
}

#CanvasContainer{
    grid-area: CanvasContainer;
    max-width: 100%;
}

#AnalysisResults h2 {
    grid-area: title;
    margin-top: 0;
}

#DCTCanvasContainer {
    max-width: 60vw;
    max-height: 80vh;
    overflow: auto;
    box-sizing: border-box;
}

#DCTCanvasContainer canvas {
    display: block;
    margin: 0 auto;
}

#DCTCanvasContainer p {
    margin-top: 0;
    margin-bottom: 0.5em;
}

#componentForm {
    display: none;
}

#TextResults {
    grid-area: text;
}
#CanvasResults {
    grid-area: canvas;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    max-width: 100%;
    overflow-x: auto;
}

#generalInfo h2 {
    margin-top: 0;
}

#blockZoomCanvas, #blockZoomCanvasY, #zoomBlockCanvas{
    width: 160px;
    height: 160px;
    border: 1px solid transparent;
    margin: 0.3em 0;
}

#ApplyQuantizTable {
    display: none;
}

#ModQuantTitle {
    display: none;
    margin-top: 2em;
}
#ModQuantContainer {
    grid-area: ModQuantContainer;
    max-width: 100%;
    box-sizing: border-box;
    display: none;
    justify-content: center;
    align-items: center;
}

#ModQuantContainer canvas {
    max-width: 100%;
    height: auto;
    display: block;
}

#clickCanvasTitle{
    display: none;
}

#ModQuantizTable{
    display: none;
}

#ModQuantizTableEditable{
    display: none;
}

/* Animazione puntini "..." */
#loadingText .dot {
  opacity: 0;
  animation: blink 1.2s infinite;
}
#loadingText .dot:nth-child(2) { animation-delay: 0.2s; }
#loadingText .dot:nth-child(3) { animation-delay: 0.4s; }
#loadingText .dot:nth-child(4) { animation-delay: 0.6s; }

@keyframes blink {
  0%, 20% { opacity: 0; }
  30%, 100% { opacity: 1; }
}

.quant-input {
    width: 3.3em;      
    text-align: center;
    padding: 2px 0;
    box-sizing: border-box;
}

#canvasDCTContainer{
    display: none;
}