/* General Page Styles */
body {
    margin: 0;
    min-height: 100vh;
    font-family: Arial, sans-serif;
    background-color: var(--background-color, #4A4A4A); /* Default dark mode */
    color: #ddd; /* Light text */
    width: 100%;
    display: flex;
    flex-direction: column;
}

:any-link {
    color: #5acbff;
    text-decoration: underline;
}

/* Container Styling */
.container {
    padding: 30px;
    border-radius: 15px;
    max-width: 1200px;
    width: 100%;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    text-align: center;
    margin-top: 40px;
}

/* Fixed Header and Search Box */
.header, .search-sort-bar {
    position: relative;
    top: 0;
    background-color: inherit; /* Inherit background based on mode */
    z-index: 10000;
    padding: 20px 0;
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

/* Header Styling */
.header {
    text-align: center;
    width: 100%;
}

/* Search and Sort Bar */
.search-sort-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: inherit; /* Inherit background based on mode */
    padding: 10px 0;
    margin-bottom: 20px;
    transition: opacity 0.3s ease;
}

/* Search input - hide on scroll */
input[type="text"] {
    padding: 10px;
    border-radius: 5px;
    border: 2px solid #ff0000;
    width: 300px;
    margin-right: 10px;
    background-color: #121212; /* Dark input background */
    color: #fff; /* Light input text */
    transition: opacity 0.3s ease; /* Smooth hide/show */
}

/* Hide search bar by default when scrolling */
.hide-on-scroll {
    opacity: 0;
}

/* Show search bar on hover */
.search-sort-bar:hover input[type="text"] {
    opacity: 1;
}

.sort-button {
    padding: 10px;
    border-radius: 5px;
    border: none;
    background-color: #686868; /* White button */
    color: #b69e51; /* Gold text */
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.sort-button:hover {
    background-color: #b69e51; /* Gold background */
    color: #121212; /* Dark text */
}

/* Image Grid Layout */
.image-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 26px;
    justify-content: center;
    padding-top: 20px; /* Add padding to prevent overlap with fixed elements */
}

.image-container {
    text-align: center;
    width: 200px;
    background-color: #ffe8bc2d;
    border: 2px solid #b69e51;
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
}

.image-container img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Ensures the entire image fits within its box */
    border-radius: 8px;
}

figcaption {
    margin-top: 10px;
    font-weight: bold;
    color: #d4d4d4;
}

/* Download Button Padding Fix */
.download-button {
    background-color: #b69e51;
    color: #121212;
    padding: 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 10px;
    width: 100%;
    font-size: 14px;
}

.download-button:hover {
    background-color: #121212;
    color: #b69e51;
}

/* Theme Toggle Button */
.theme-toggle {
    position: fixed;
    top: 20%;
    right: 10px;
    background-color: var(--toggle-bg, #f5ebb4c2);
    border: dotted 1px;
    padding: 10px;
    cursor: pointer;
    border-radius: 5px;
    font-size: 16px;
}

.theme-toggle:hover {
    background-color: var(--toggle-hover-bg, #b8913ea1);
}

/* Responsive Design: Attach search bar to header for small screens */
@media (max-width: 768px) {
    .search-sort-bar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        justify-content: center;
        z-index: 1000;
        background-color: #4A4A4A; /* Dark mode default */
    }
}
