/* Define custom properties for easy reuse */
:root {
    --legend-height: 30px; /* Height of the legend */
}

/* Ensure full height coverage for HTML and body */
html {
    height: 100%;
}

body {
    height: 100%;
    margin: 0;
    display: grid;
    grid-template-rows: auto 2em; /* Grid layout with two rows: chart area and legend */
}

/* Styles for canvas elements */
#chartCanvas,
#effectCanvas,
#detectionCanvas {
    grid-column: 1; /* Position within the grid */
    grid-row: 1;
    width: 100%;
    height: 100%;
}

/* Transition effect for the effect canvas opacity */
#effectCanvas {
    transition: opacity 0.3s;
}

/* Set detection canvas to invisible */
#detectionCanvas {
    opacity: 0;
}

/* Styles for the chart legend */
#chartLegend {
    grid-column: 1; /* Position within the grid */
    grid-row: 2;
    display: none; /* Hidden by default */
    justify-content: center;
    align-items: center;
    text-align: center;
}

/* Styles for legend items */
#chartLegend div {
    display: inline;
    margin: 0 1rem 0 1rem; /* Spacing between legend items */
    width: 5rem;
}

/* Styles for the tooltip */
#tooltip {
    display: none; /* Initially hidden */
    position: absolute;
    background-color: white;
    border: 1px solid grey;
    text-align: center;
    padding: 0.5rem;
    border-radius: 0.1rem;
    /*box-shadow: 0.2rem 0.2rem 0.2rem lightgrey;*/
    z-index: 1; /* Ensure tooltip appears above other elements */
}

/* Styles for text within the tooltip */
#tooltip p {
    margin: 0;
    font-size: 1em;
}

#tooltip b {
    position: center;
    font-size: 1em;
}

/* Styles for tooltip arrow */
.leftArrow::after {
    content: ""; /* Create a pseudo-element */
    position: absolute; /* Position relative to its containing block */
    top: 50%; /* Position vertically centered */
    right: 100%; /* Position to the right of the tooltip */
    margin-top: -0.5rem; /* Adjust vertical position */
    border-width: 0.5rem; /* Size of the arrow */
    border-style: solid; /* Solid border */
    border-color: transparent white transparent transparent; /* Arrow color */
}

.rightArrow::before {
    content: ""; /* Create a pseudo-element */
    position: absolute; /* Position relative to its containing block */
    top: 50%; /* Position vertically centered */
    left: 100%; /* Position to the left of the tooltip */
    margin-top: -0.5rem; /* Adjust vertical position */
    border-width: 0.5rem; /* Size of the arrow */
    border-style: solid; /* Solid border */
    border-color: transparent transparent transparent white; /* Arrow color */
}