/* General Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Always reserve space for the scrollbar so content doesn't shift left when
   results grow tall enough to make one appear */
html {
    overflow-y: scroll;
    scrollbar-gutter: stable;
}

/* Import Poppins Font */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&display=swap');

/* Body Styling */
body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(to bottom right, #e1e1ff, #c2c2ff);
    color: #333;
    text-align: center;
    min-height: 100vh;
    margin: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding-top: 10vh;
    padding-bottom: 2rem;

    align-items: center;
}

/* Header Styling */
header {
    margin-top: 2rem;
}

header .logo img {
    width: 100px;
    margin-bottom: 1rem;
}

header h1 {
    font-size: 2rem;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

/* Search Section */
#search {
    margin: 2rem auto 3rem auto; /* Add more spacing below the search bar */
}

#searchForm {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.search-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    border-radius: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 0.5rem 1rem;
    position: relative;
}

.search-bar input {
    border: none;
    outline: none;
    flex: 1;
    padding: 0.5rem 1rem;
    border-radius: 30px;
    font-size: 1rem;
}

.search-bar button {
    background: #928fff;
    border: none;
    border-top-right-radius: 30px;
    border-bottom-right-radius: 30px;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    width: 60px;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-left: 0;
    cursor: pointer;
    transition: background 0.3s ease;
    position: absolute;
    right: 0;
}

.search-bar button:hover {
    background: #7a70d9;
}

.search-bar button img {
    width: 20px;
    height: 20px;
}

.search-tip {
    font-size: 0.9rem;
    color: #555;
    margin: 0.5rem 0;
}

.search-button {
    background: #1f1d44;
    width: 250px;
    color: #fff;
    border: none;
    padding: 0.7rem 1.5rem;
    border-radius: 5px; /* Keep original rounded corners */
    font-size: 1rem;
    cursor: pointer;
    margin-top: 1rem;
    transition: background 0.3s ease;
}

.search-button:hover {
    background: #3c3a70;
}

/* Categories Section */
#categories {
    margin: 2rem auto;
}

.category-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
}

.category-buttons button {
    background: #c2c2ff;
    color: #1f1d44;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 5px; /* Keep original rounded corners */
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.3s ease;
}

.category-buttons button:hover {
    background: #b0b0ff;
}

/* Results Section */
main {
    width: 100%;
}

#results {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    gap: 1rem;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 1rem;
}

.result-item {
    position: relative;
    width: 280px;
    max-width: 100%;
}

.result-item img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.result-item img:hover {
    transform: scale(1.03);
}

.download-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease, background 0.2s ease;
}

.result-item:hover .download-btn {
    opacity: 1;
}

.download-btn:hover {
    background: rgba(0, 0, 0, 0.85);
}

.download-btn svg {
    width: 16px;
    height: 16px;
}

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.lightbox.active {
    display: flex;
}

.lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
    position: fixed;
    top: 1.5rem;
    right: 2rem;
    background: none;
    border: none;
    color: #fff;
    font-size: 2.5rem;
    line-height: 1;
    cursor: pointer;
}

/* Footer Styling */
footer {
    margin-top: 2rem;
    color: #333;
    padding: 1rem 0;
    font-size: 0.9rem;
}
