:root {
    --primary: #7658B0;
    --dark: #191535;
    --dark2: #26234C;
    --bronze: #B39479;
    --gold: #DAA654;
    --success: #56AC8A;
    --error: #E35164;
    --text-light: #ffffff;
    --overlay-dark: rgba(0, 0, 0, 0.5);
}

html {
    height: 100%;
}

h2 {
    color: var(--gold);
}

/* */
/* Body: variable height, variable width */
/* */

body {
    font-family: Barlow, sans-serif;
    font-weight: 400;
    background-color: var(--dark);
    color: var(--text-light);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    width: 100%;
    box-sizing: border-box;
    min-height: 100%;
}

body a {
    text-decoration: none;
    color: var(--text-light);
}

body a:hover {
    color: var(--primary);
}

/* */
/* Header: fixed height, variable width */
/* */

header {
    position: fixed; /* Fix the header to the top of the viewport */
    left: 0;
    top: 0; /* Align it to the top */
    z-index: 2;
    width: 100vw;
    height: 70px;
    background-color: var(--dark);
    color: var(--text-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-and-title {
    display: flex;
    align-items: center;
    justify-content: left;
    gap: 20px;
    padding-left: 40px;
}

.logo img {
    width: 48px; /* Adjust the width as needed */
    height: auto; /* Maintain aspect ratio */
    /* ... */
}

.header-nav {
    display: flex;
    align-items: center;
    justify-content: right;
    gap: 20px; /* Space between links */
    padding-right: 40px;
    margin-left: auto;
    /* grow vertically to fill the header */
    flex-grow: 1;
}

.headerButton {
    /* blend into the header */
    background-color: var(--dark);
    color: var(--text-light);
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    outline: none;
}

.headerButton:hover {
    color: var(--primary);
}



/* */
/* Main: variable height, variable width */
/* */

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    padding-top: 70px; /* Add space for the header */
    padding-bottom: 60px; /* Add space for the footer */
    background-color: var(--dark);
}

.search-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    margin-top: 20px;
    width: 100%; /* Ensure the search bar takes the full width */
    padding: 0 20px; /* Add some padding on the sides */
    box-sizing: border-box; /* Include padding in the width calculation */
}

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

.search-form {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50%;
    max-width: 960px; /* Max width can be increased as per design */
    margin: 0 auto; /* Center the form if it's smaller than the max-width */
}

.search-bar input[type="text"] {
    padding: 10px;
    border: 1px solid var(--primary);
    border-radius: 5px 0 0 5px;
    font-size: 16px;
    outline: none;
    background-color: var(--dark);
    color: var(--text-light);
    flex-grow: 1; /* Allow input to grow and fill available space */
}

.search-bar button {
    padding: 10px 20px;
    background-color: var(--dark);
    color: var(--text-light);
    border: 1px solid var(--primary);
    border-left: none;
    border-radius: 0 5px 5px 0;
    font-size: 16px;
    cursor: pointer;
    outline: none;
}

.search-bar input[type="text"]:focus {
    border: 1px solid var(--bronze);
}

.search-bar button:hover {
    background-color: var(--bronze);
    border-color: var(--bronze);
}

.search-bar button:focus {
    background-color: var(--bronze);
    border-color: var(--bronze);
}

.search-bar button:active {
    background-color: var(--bronze);
    border-color: var(--bronze);
}

.error-text {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    color: var(--error);
    font-size: 16px;
    margin: 0;
    padding: 0;
}

.results-container {
    flex: 1 0 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.results-row {
    flex: 0 0 80%;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
}

.favorites-container {
    flex: 1 0 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.favorites-row {
    flex: 0 0 80%;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
}

/* Image Tiles and Overlay Styles */
.image-tile {
    margin: 10px;
    overflow: hidden; /* Ensure the overlay fits within the tile */
    border-radius: 5px; /* Match input/button border-radius */
    box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2); /* Add some shadow for depth */
    position: relative; /* Ensure the overlay is positioned relative to the tile */
    flex: 0 1 auto;
    height: 200px;
}

.image-tile img {
    width: auto;
    height: 100%;
    display: block;
    object-fit: contain;
    transition: transform 0.5s ease; /* Smooth scaling on hover */
}

.image-tile:hover img {
    transform: scale(1.1); /* Scale image up on hover for a dynamic effect */
}

.metadata {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--overlay-dark);
    color: var(--text-light);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
    padding: 10px;
    box-sizing: border-box;
    word-wrap: break-word;
    white-space: normal;
}

.image-tile:hover .metadata {
    opacity: 1;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--overlay-dark);
    color: var(--text-light);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: .9;
    transition: opacity 0.2s ease;
    pointer-events: none;

}

/* Footer: fixed height, variable width */
footer {
    position: fixed; /* Fix the footer to the bottom of the viewport */
    left: 0;
    bottom: 0; /* Align it to the bottom */
    text-align: center;
    width: 100%;
    background-color: var(--dark);
    color: var(--text-light);
    padding-top: 20px;
    padding-bottom: 20px;
    z-index: 2;
}

/* The Modal (background) */
.modal {
    position: fixed;
    z-index: 1; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto; /* Enable scroll if needed */
    background-color: rgb(0,0,0); /* Fallback color */
    background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
}

/* Modal Content */
.modal-content {
    display: flex;
    flex-direction: column;
    background-color: var(--primary);
    margin: 15% auto; /* 15% from the top and centered */
    padding: 20px;
    border: 1px solid var(--dark);
    border-radius: 5px;
    width: 30%; /* Could be more or less, depending on screen size */
}

.left-sidebar-overlay {
    position: fixed;
    z-index: 2; /* Sit on top, only behind modals */
    left: 0;
    top: 70px; /* Align it to the top */
    height: calc(100vh - 70px - 60px);
    width: 300px;
    overflow: auto; /* Enable scroll if needed */
/*     transform: translateX(-100%);
    transition: 0.5s; */
}

.left-sidebar-overlay-expand-button {
    position: fixed;
    z-index: 3;
    left: 0;
    top: 70px;
    height: 60px;
    width: 60px;
}

.left-sidebar-overlay-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    background-color: var(--dark2);
    color: var(--text-light);
    border-radius: 0 0 5px 0;
    box-shadow: 0 4px 8px 0 var(--overlay-dark); /* Add some shadow for depth */
    padding: 0 20px 20px 20px;
}

.left-sidebar-overlay-toggle-buttons {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    box-sizing: border-box;
    height: 60px;
    background-color: transparent;
}

.left-sidebar-overlay-arrow {
    /* button to toggle the sidebar */
    color: var(--text-light);
    border: none;
    height: 100%;
    width: 60px;
}

.left-sidebar-overlay-arrow i {
    /* icon to toggle the sidebar */
    font-size: 20px;
}

.left-sidebar-overlay-arrow#leftArrow {
    border-radius: 0 5px 0 0;
}

.left-sidebar-overlay-arrow#rightArrow {
    border-radius: 0 5px 5px 0;
    background-color: var(--dark2);
}

.left-sidebar-overlay-arrow:hover {
    background-color: var(--primary);
}

.left-sidebar-overlay-arrow:focus {
    background-color: var(--primary);
}

.left-sidebar-overlay-arrow:active {
    background-color: var(--primary);
}

.left-sidebar-overlay-toggle-button-spacer {
    /* spacer to fill the remaining space */
    flex-grow: 1;
    height: 100%;
    background-color: var(--dark2);
}

.left-sidebar-overlay-text {
    /* text to display in the sidebar */
    color: var(--text-light);
    font-size: 16px;
    margin: 0;
    padding: 0;
}

.left-sidebar-overlay-text p {
    margin: 0;
    padding: 10px;
}

.options-form {
    display: flex;
    align-items: flex-start;
    flex-direction: column;
    justify-content: left;
    padding: 10px;
}

.options-form label {
    margin-bottom: 10px;
}

.example-button-container {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    box-sizing: border-box;
    gap: 10px;
    padding: 10px;
}

.example-button {
    /* blend into the sidebar */
    background-color: var(--dark2);
    color: var(--text-light);
    display: flex;
    flex: 0 0 auto;
    border: 1px solid var(--primary);
    border-radius: 5px;
    font-size: 16px;
    margin: 0;
    max-width: 100%;
}

.example-button:hover {
    background-color: var(--primary);
}

.example-button:focus {
    background-color: var(--primary);
}

.example-button:active {
    background-color: var(--primary);
}

.example-button p {
    margin: 0;
    padding: 10px;
    text-align: start;
}

.example-button, .left-sidebar-overlay-text p {
    word-wrap: break-word;
    white-space: normal;
}