

/* styles every element on the page */
* {
    box-sizing: border-box; /* fixes problem with padding where it extended the block more than 100%*/
    overflow-x: hidden; /* makes there be no unwanted scroll bars*/
    /* give createor full control over margins and paddings */
    margin: 0;
    padding:0;
}

/* Sets display and minimum dimensions of the html body */
body{
    display: flex; 
    min-height: 100vh; /*helps the footer always be at the bottom*/
    flex-direction: column; /*makes the three main sections (nav bar, content, and footer go on top of each other rther then beside each other )*/
}

/* sets how all buttons will look throughout the webapp's dimensions colour and transitions */
button{
    width:50px;
    aspect-ratio: 1 / 1;
    border-radius: 40%;
    overflow: hidden;
    background-color: white;
    border: 2px solid white;
    cursor: pointer;
    box-sizing: content-box; /* makes padding go on the outside rather than inside */
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* then a button is hovered over it will gain a black outline */
button:hover{
    border: 2px solid black;
    background-color: rgba(15, 60, 150, 0.3);
}

/* makes the button image take up most of the buttons area */
button img{
    width: 90%;
}


/* makes the abbr take up the whole button so that you can hover over anywhere on the button and it will tell you the funtion of the button */
abbr{
    width: 100%;
    height: 100%;
    border-radius: 40%;
    display: flex;
    justify-content: center;
    align-items: center;
}




/* ------------------ */
/* Nav bar and footer */
/* #region----------- */


/* sets its position. states its parameters and colours */
.nav{
    display: flex;
    align-items: center;
    justify-content: left;
    height: 70px;
    background-color: navy;
    padding: 0px 25px 0px 25px;
    border-bottom: 5px solid #FFD403;
}


/* Make that navbar have colour and font which makes it readable against the navy blue background */
.nav_text{
    font-family: sans-serif;
    color: white;
    padding: 0px 10px;
}

/* makes the image the right size in the nav bar */

#nav_logo{
    height: 60px;
    cursor: pointer;
    padding: 0px 10px;
}



/* Makes the pointer a curser because when clicked it runs a js function that takes you back to the areas map */
#navbar_text_button{
    cursor: pointer;
}

/* displayed at the bottom of the screen. Colours and aesthetics are meant to make it not stand out. */
/* It has a dynamic layout that reorders its items */
.footer {
    display: flex;
    align-items: center;
    justify-content: space-between; 
    flex-wrap: wrap;
    font-family: sans-serif;
    border-radius: 5px;
    min-height: 40px; /* make sure that the footer doesn't get smaller then 40px so it looks nice however leave room for it to grow*/
    box-shadow: 0px 2px 5px rgba(0, 0, 128, 0.7); /* makes the footer look like its hovering above everything else*/
    padding: 0.5% 1%;
    margin-top: auto;  /* makes the footer always go to the bottom */
    margin-left: 5px;
    margin-right: 5px;
    margin-bottom: 5px;
}

/* makes the text not go right up against each other before it resizes with flex-wrap: */
.footer_text{
    padding: 1% 5px;
}


/* #endregion */


/* ------- */
/* content */
/* ------- */

/* content is everything between the nav bar and footer */
/* Sets how the content displays */
.content{
    display: flex;
    flex-direction: row;
    width: 100%;
    flex: 1;
    align-items: flex-start;
}


/* ------- */
/* Sidebar */
/* #region */

/* sets the dimensions of the sidebar and its text font */
.sidebar{
    width: 400px;
    border-radius: 24px;
    height: 80vh;
    margin: 20px;
    box-shadow: 0px 2px 5px rgba(0, 0, 128, 0.7);
    padding: 25px;
    min-height: 500px; 
    font-family: sans-serif;
}


/* makes the sidebar content display on top of each other rather then beside each other. also makes it take up the whole height of the sidebar */
.sidebar_content {
    display: flex;
    flex-direction: column;
    height: 100%;
}


/* sets the size and colour of the finder input */
.finder_input{
    outline: none;
    border: 2px solid black;
    padding: 8px;
    border-radius: 12px;
    width: 350px;
    font-size: 20px;
    /* position: static; */
}


/* Makes the close button go to the right side. */
#left_sidebar_close_button{
    align-self:flex-end;
}



/* sets the postion of the left sidebar open button */
#left_sidebar_open_button{
    position: absolute;
    top: 120px;
    left: 1%;
    z-index: 10;
}


/* #endregion */



/* -------------------------- */
/* Classroom code Key / tables*/
/* #region--------------------*/


/* Makes the table_div take up all the room it can without increasing the size of the sidebar */
.table_div{
    flex: 1; /* makes the table div take up all remaining space*/ 
    overflow-y: scroll;
    margin-top: none;
    border-radius: 12px;
}

/* followed example table from https://www.youtube.com/watch?v=lXxEm9thbiQ */

table{
    width:336px;
    border-radius: 12px;
    overflow: hidden;
    border-collapse: collapse;
    margin-top: 5%;
}

/* styles each individual cell width and move the text from the center to the left */
th,td{
    padding:5%;
    text-align: left;
}

/* style table heads colour and text*/
th{
    background-color: rgb(0, 0, 128);
    color:white;
    font-weight: bold;
    border-bottom: 5px solid #FFD403;
}
/* sytles table rows background colour */
tr{
    background-color: #f3f3f3;
}

/* gets every second row and changes its background colour to a darker gray so that the table is more readable */
tr:nth-child(even){
    background-color: #e9e9e9;

}

/* sets the images in the tables to the right size */
.table_img{
    height:75px;
}

/* sets the height and width of the polygons in the tables */
.key_polygon_container{
    width: 75px; 
    aspect-ratio: 1 / 1;
}

/* sets the colour of the building polygons in the table */
.key_polygon{
    width: 100%; 
    height: 100%;
    fill: white;
    stroke: black;
    stroke-width: 2px;
}

/* sets the colours for the other polygon in the table */
.key_other_polygon{
    width: 100%; 
    height: 100%;
    fill: white;
    stroke: gray;
    stroke-width: 3px;
    vector-effect: non-scaling-stroke;
}

/* #endregion */


/* ----------------------------------------------- */
/* Areas Map (shows buildings and notable locations)*/
/* #region ----------------------------------- */


/* sets the dimensions and transitions of the maps */
.map{
    position: relative;
    overflow-x: hidden;
    overflow-y: hidden;
    aspect-ratio: 16 / 9; /* makes the map always in scale */
    flex: 1 0 auto; /* sets the width to fill full the flexbox content div however makes the height uneffected */
    transition: width 0.3s ease;
    transition: transform  1s ease;
}

/* ---------------------- */
/* #region polygons styles*/

/* Sets up for the polygons to be displayed correctly */
.polygon_container{
    position: absolute;
    width: 57.5%; 
    aspect-ratio: 1 / 1; /* makes sure the polygon containers stay a square to keep the shape of the buildings */
    pointer-events: none; /* makes the hover feature on the buildings work better because the polygon container is very large and goes over other elements */
    overflow: visible; /* makes polygons not clip when they increase in size */
}

/* sets the dimension and aesthetic of the polygons and makes sure that they transform right */
.polygon{
    width: 100%; 
    height: 100%;
    fill: white;
    stroke: black;
    stroke-width: 0.3%;
    transition: transform 0.3s ease, fill 0.3s ease; 
    pointer-events: auto; /* makes the hover work because its parent has pointer-events: none; */
    transform-origin: center center; 
    transform-box: fill-box; 
    cursor: pointer;
}

/* changes the colour and size when hovered over */
.polygon:hover{
    fill: rgba(15, 60, 150, 0.3);
    transform: scale(1.03);
}

/* formats the polygons that aren't buildings, just without the outline and change in cursor */
.other_polygon{
    width: 100%;
    height: 100%;
    fill: white;
    stroke: gray;
    stroke-width: 0.05%;
    transition: transform 0.3s ease, fill 0.3s ease;
    pointer-events: auto;
    transform-origin: center center;
    transform-box: fill-box;
}

/* #endregion polygons */


/* -------------------- */
/* #region label styles */
/* styles for labels of the building */
.building_label{
    position: absolute;
    font-size: 1.8vw; /* sets the label so that they change height based on screen width so that they remain the same scale compared with the buildings */
    font-family: sans-serif;
    pointer-events: none;
}

/* styles the labels not on buildings */
.other_label{
    position: absolute;
    font-size: 1.5vw;
    font-family: serif;
    color: grey;
    pointer-events: none;
}

/* makes the labels that have highlightable polygons different from the other labels */
#field_label, #cola_label, #astro_label {
    color: black;
    font-family: sans-serif;
}

/* makes the label always 2 lines instead of sometimes changing to 4 */ 
#main_entrance_label{
    font-size: 1.2vw;
}

/* sets the size and postion behavours for staricases and elevators */
.areas_map_icon{
    position: absolute;
    height: 5%;
}

.compass{
    position: absolute;
    height: 7.5%;
}


/* ----------- */
/* Layout Maps */
/* #region */


.layout_map{
    position: relative;
    overflow-x: hidden;
    overflow-y: hidden;
    flex: 1 0 auto; /* sets the width to fill full the flexbox content div however makes the height uneffected */
    max-height: calc(80vh);
    transition: width 0.3s ease;
    transition: transform  1s ease;
}

/* sets the image so that it resized properly while taking up as much room as it can */
.layout_map_image{
    position: absolute;
    top: 0%;
    left: 0%;
    width: 100%;
    height: 100%;
    max-height: 100%;
    max-width: 100%;
    object-fit: contain; /* makes the image not stretch */
}

/* sets the position back buttons */
.back_to_areas_map_button{
    position: absolute;
    right:1%;
    top:1%;
    z-index: 10;
}





/* the point of the outer and inner marker container is to perfectly line up with the image of the layout map with the inner container */
.outer_marker_container{
    position: absolute;
    top: 0%;
    left: 0%;
    width: 100%;
    height: 100%;

    /* the image is centered so the outer container is too */
    display: flex;
    justify-content: center;
    align-items: center;
}

/* makes the inner marker take up the whole height of the outer indicator */
.inner_marker_container{    
    position: relative;
    height: 100%;
}

/* makes all the images the right aspect-ratio so that they don't get distorted */
#sanford_inner_marker_container{
    aspect-ratio: 372 / 263;
}

#allen_inner_marker_container{
    aspect-ratio: 381 / 343.5;
}

#bolam_inner_marker_container{
    aspect-ratio: 541 / 704;
}


#ec_inner_marker_container{
    aspect-ratio: 415 / 325;
}

#te-kainga_inner_marker_container{
    aspect-ratio: 231 / 369;
}

#arts_block_inner_marker_container{
    aspect-ratio: 928 / 764;
}


/* makes the indicator a small yellow circle with a pulsing animation */
.indicator{
    position: absolute;
    background-color: rgb(255, 212, 3, 0.7);
    border-radius: 50%;
    height: 4.5%;
    aspect-ratio: 1/1;
    overflow: hidden;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 0 0.3vw rgb(255, 212, 3, 0.7);
    animation-name: indicatorPulse;
    animation-duration: 2s;
    animation-fill-mode: forwards;
    animation-timing-function: ease; 
    animation-iteration-count: infinite;
}



/* set keyframes for the indicators to give it the pulsing animation */
@keyframes indicatorPulse {
    0%{
        box-shadow: 0 0 0 0vw rgb(255, 212, 3, 0.7);
    }

    50%{
        box-shadow: rgb(255, 212, 3, 0.5);
    }

    100%{
        box-shadow: 0 0 0 1.5vw rgb(255, 212, 3, 0);
    }
    
}

/* #endregion */





/* ===================== */
/* JS toggleable classes */
/* #region============== */


/* fills the element with a yellow background (use with things that use fill instead of background-colour) */
.highlighted{
    fill: rgb(255, 212, 3, 0.5);
}
/* change the colour then hovered. to give the user feedback */
.highlighted:hover{
    fill: rgb(255, 212, 3);
}

/* sets the background to yellow (use with things that use background color instead of fill) */
.highlighted_background{
    background-color: rgb(255, 212, 3, 0.5);
}

/* change the colour then hovered. to give the user feedback */
.highlighted_background:hover{
    background-color: rgb(255, 212, 3);
}

/* hides things by setting there display to none */
.hidden{
    display: none;
}


/* Gives the sidebar open button the properties needed to have an animation */
.appear_animation {
    animation-name: openButtonAppear;
    animation-duration: 1s;
    animation-fill-mode: forwards;
    transform: translate(-300px) ;
}

/* Gives the sidebar the properties needed to have an animation */
.sidebar.closing{
    animation-name: sidebarWidth0;
    animation-duration: 0.5s;
    animation-fill-mode: forwards;
    animation-timing-function: ease;
}

/* animation that make the closing of the sidebar look smooth */
.sidebar.opening{
    animation-name: sidebarFullWidth;
    animation-duration: 0.5s;
    animation-fill-mode: forwards;
    animation-timing-function: ease; 
    width: 0;
    padding: 25px 0%;
    margin: 20px 0%;
    transform: translate(-300px);
}

/* animation to make the sidebars open button slid into frame once the left sidebar has been closed */
@keyframes openButtonAppear{

    100%{
        transform: translate(0px)
    }
}


/* Animation that plays when the sidebar is closed */
/* it makes the sidebar translate to the left while its width is reducing */
@keyframes sidebarWidth0{

    100%{
        width: 0;
        padding: 25px 0%;
        margin:20px 0%;
        transform: translate(-300px);
    }
}



/* Animation that plays when the sidebar is opened */
/* increase the width while translating it to the left */
@keyframes sidebarFullWidth{

    100%{
        width: 400px;
        padding: 25px;
        margin:20px;
        transform: translate(0px);
    }
}





@media screen and (max-width: 1024px) { 
    /* makes the map and the sidebar go on top of each other */
    .content{  
        flex-direction: column;

    }

    /* makes the sidebar take up the whole width of the screen */
    .sidebar{
        width: calc(100% - 40px);
        height: auto;
        order: 2;
        flex: 1;
        box-shadow: none;
        margin-top: 0px;
    }

    /* makes the finder input go to the top of the screen and centers it */
    /* The JS move the finder_input to the top of the page */
    .finder_input{
        position: absolute;
        top: 80px;
        left: 50%;
        transform: translate(-50%, 0%);
        z-index: 11;
    }

    /* Finder text isn't needed because the input has moved */
    .finder_text{
        display: none;
    }

    
    /* makes the map take up the whole width because the sidebar is no longer next to it */
    .map{
        width: 100%;
    }   



    /* makes the tables fill the sidebar which now takes up the whole width */
    .table_div{
        width: 100%;
        justify-self: center;
        overflow: hidden;
    }

    table{
        width: 100%;
    }

    /* makes the building and other labels more readable */
    .building_label{
        font-size: 2.8vw;
    }
    .other_label{
        font-size: 2.5vw;
    }

    /* makes the main_entrance_label always be 2 lines instead of increasing to four when the text would wrap */
    #main_entrance_label{
        font-size: 1.8vw;
    }

    /* give the finder room at the top so that it does overlap the map */
    .spacer{
        width: 100%;
        height: 60px;
    }

    /* ovrriders the styles that the animations give the sidebar for closeing and opening so that is display correctaly at the bottom of the page */
    .sidebar.opening{
        animation-name: sidebarFullWidth;
        animation-duration: none;
        animation-fill-mode: none;
        animation-timing-function: none; 
        transform: translate(0px);
        width: calc(100% - 40px);
        order: 2;
        flex: 1;
        box-shadow: none;
        align-self: center;  
        margin: 0% 25px;    
        padding: 25px;
    }


    .sidebar.closing{
        animation-name: sidebarWidth0;
        animation-duration: none;
        animation-fill-mode: none;
        animation-timing-function: none;
        transform: translate(0px);
        width: calc(100% - 40px);
        order: 2;
        flex: 1;
        box-shadow: none;
        align-self: center;
        margin: 0% 25px;
        padding: 25px;
    }


    /* since the user can't close or open the sidebar the buttons get hidden */
    #left_sidebar_close_button{
        display: none;
    }

    #left_sidebar_open_button{
        display: none;
    }


    /* centers the text in the footer */
    .footer{
        justify-content: center;
        text-align: center;
        font-size: 15px;
    }

}