body,
html {
    margin: 0;
    padding: 0;
    font-family: 'Roboto', sans-serif;
    font-size: 16px;
}


/* 1. Grid board styles */
.board {
    margin: 6px auto;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 4px solid black;
}

.grid-cell {
    margin: 0;
    border: 1px solid black;
    width: 20px;
    height: 20px;
    background-color: white;
}

.startNode {
    background-color: #08c90f;
    animation: startingNode 2s linear infinite;
}

.foundElement {
    background: #1592e6;
    animation: fillBackground 0.5s linear forwards;
}


/* 2. Grid Controls */
.controls {
    width: 100%;
    background-color: #f2f3f6;
    border-bottom: 1px solid #d7dae1;
    margin: 0;
    padding: 8px 0;
    display: flex;
    justify-content: center;
    flex-direction: column;
    align-items: center;
}

.gridControl {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.algorithmControls {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
}

.clear {
    display: flex;
    justify-content: center;
    align-items: center;
}

.buttonSpacing {
    display: flex;
    align-items: center;
    margin: 0 8px;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
}

.wallControls {
    display: flex;
    justify-content: center;
    flex-direction: row;
    align-items: center;
}

select {
    padding: 6px;
    font-size: 16px;
    font-family: 'Roboto', sans-serif;
    font-weight: 400;
    border-radius: 10px;
    border: 2px solid black;
    outline: none;
}

select:hover,
select:focus {
    outline: none;
    box-shadow: none;
}


/* 3. Cell legend */
.legend {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    flex-direction: row;
    margin: 6px 10px 0 10px;
}

.showcase-legend {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    margin: 4px 0 0 0;
}

.pathfinder-hint {
    font-size: 0.85em;
    color: #7b8290;
    margin: 4px 0 0 8px;
}

.grid-cell-legend {
    display: block;
    border: 1px solid black;
    width: 20px;
    height: 20px;
}

.legend-unvisited { background-color: white; }
.legend-visited { background-color: #03fcf8; }
.legend-start { background-color: #08c90f; }
.legend-path { background-color: #ffab03; }
.legend-end { background-color: Red; }
.legend-wall { background-color: Grey; }

.cell-legend-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0px 18px 0 6px;
}


.buttonDiv {
    margin: 4px 8px;
}

.functionBtn {
    appearance: button;
    backface-visibility: hidden;
    background-color: #405cf5;
    border-radius: 6px;
    border-width: 0;
    box-shadow: rgba(50, 50, 93, .1) 0 0 0 1px inset, rgba(50, 50, 93, .1) 0 2px 5px 0, rgba(0, 0, 0, .07) 0 1px 1px 0;
    box-sizing: border-box;
    color: #fff;
    cursor: grab;
    font-family: 'Roboto', sans-serif;
    font-size: 100%;
    height: 36px;
    line-height: 1.1;
    outline: none;
    overflow: hidden;
    padding: 0 20px;
    position: relative;
    text-align: center;
    text-transform: none;
    transform: translateZ(0);
    transition: all .2s, box-shadow .08s ease-in;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    width: 100%;
}


/* 4. Slider styles */
.slider-wrapper{
    display: flex;
    justify-content: center;
    align-items: center;
    height: 20px;
    border: 2px solid black;
    border-radius: 5px;
    background-color: #08c90f;
}


.slider {
    -webkit-appearance: none;
    width: 140px;
    height: 2px;
    border-radius: 5px;
    padding: 4px 0;
    border: 2px solid black;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background: #405cf5;
    cursor: pointer;
}

.slider::-moz-range-thumb {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background: #405cf5;
    cursor: pointer;
}




/* 5. Wall border styles */
/* Used to remove borders between walls dynamically */
.topWall21 {
    border-top: 0px;
    height: 21px;
}

.bottomWall21 {
    border-bottom: 0px;
    height: 21px;
}

.rightWall21 {
    border-right: 0px;
    width: 21px;
}

.leftWall21 {
    border-left: 0px;
    width: 21px;
}

.bottomWall22 {
    border-bottom: 0px;
    height: 22px;
}

.topWall22 {
    border-top: 0px;
    height: 22px;
}

.rightWall22 {
    border-right: 0px;
    width: 22px;
}

.leftWall22 {
    border-left: 0px;
    width: 22px;
}


/* 6. Pathfinding backtracking styles */
/* Allows backtracking nodes to remove borders between each other */
.topBottomBacktrack {
    border-top: 0px;
    border-bottom: 0px;
    height: 22px;
}

.leftRightBacktrack {
    border-right: 0px;
    border-left: 0px;
    width: 22px;
}

.topRightBacktrack {
    border-right: 0px;
    border-bottom: 0px;
    height: 21px;
    width: 21px;
}

.topLeftBacktrack {
    border-left: 0px;
    border-bottom: 0px;
    height: 21px;
    width: 21px;
}

.bottomRightBacktrack {
    border-right: 0px;
    border-top: 0px;
    height: 21px;
    width: 21px;
}

.bottomLeftBacktrack {
    border-left: 0px;
    border-top: 0px;
    height: 21px;
    width: 21px;
}






@media(min-width: 740px) {
    .showcase-legend {
        margin: 0;
    }
}


/* Starting node colour change animation */
@keyframes startingNode {
    0% {
        background-color: #08c90f;
    }

    75% {
        background-color: #0f912f;
    }
}


/* Animation for visiting a new grid cell */
@keyframes fillBackground {
    0% {
        width: 20px;
        height: 20px;
        margin: 0;
        border-radius: 50%;
        border: 1px solid black;
    }

    50% {
        width: 20px;
        height: 20px;
        margin: 0;
        border-radius: 75%;
        border: 1px solid black;
    }

    100% {
        width: 20px;
        height: 20px;
        border-radius: 0%;
        background-color: #03fcf8;
        border: 1px solid black;
    }
}
