/* --- General Styling & Variables --- */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&display=swap');

:root {
    --primary-color: #007bff;
    --dark-color: #23242a;
    --light-color: #ffffff;
    --gray-color: #f4f4f4;
    --text-color: #333;
    --overlay-bg: rgba(0, 0, 0, 0.7);
}

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

body {
    font-family: 'Poppins', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--light-color);
}

html {
    scroll-behavior: smooth;
}

/* --- Header & Navigation --- */
header {
    background: var(--light-color);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

nav .logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
}

.nav-links {
    list-style: none;
    display: flex;
}

.nav-links li {
    padding: 0 1rem;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-color);
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: var(--primary-color);
}

/* Dropdown Menu */
.dropdown {
    position: relative;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--light-color);
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    list-style: none;
    min-width: 160px;
}

.dropdown:hover .dropdown-menu {
    display: block;
}

.dropdown-menu li {
    padding: 0.75rem 1rem;
}

/* --- Hero Section --- */
.hero {
    height: 60vh;
    background: linear-gradient(var(--overlay-bg), var(--overlay-bg)), url('https://images.unsplash.com/photo-1495344517868-8ebaf0a2044a?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwzNjUyOXwwfDF8c2VhcmNofDE2fHx0cm9waWNhbCUyMGJlYWNofGVufDB8fHx8MTYyNjk4NjI1Mg&ixlib=rb-1.2.1&q=80&w=1080') no-repeat center center/cover;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: var(--light-color);
}

.hero-content h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.hero-content p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
}

#search-form {
    display: flex;
    max-width: 600px;
    margin: 0 auto;
}

#search-input {
    width: 100%;
    padding: 0.8rem;
    border: none;
    border-radius: 5px 0 0 5px;
    font-size: 1rem;
}

#search-form button {
    padding: 0.8rem 1.5rem;
    border: none;
    background: var(--primary-color);
    color: var(--light-color);
    border-radius: 0 5px 5px 0;
    cursor: pointer;
    font-size: 1rem;
}

/* --- Image Gallery --- */
.gallery-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.image-gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.image-card {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    cursor: pointer;
}

.image-card img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.image-card:hover img {
    transform: scale(1.05);
}

.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--overlay-bg);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    color: var(--light-color);
}

.image-card:hover .image-overlay {
    opacity: 1;
}

.image-overlay .close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
}

.image-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    position: absolute;
    bottom: 1rem;
    left: 0;
    padding: 0 1rem;
}

.image-name {
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60%;
}

.image-name i, .download-btn i {
    margin-right: 5px;
}

.download-btn, .close-btn {
    background: none;
    border: none;
    color: var(--light-color);
    font-size: 1.2rem;
    cursor: pointer;
}

.download-btn {
    font-size: 1rem;
    background: var(--primary-color);
    padding: 5px 10px;
    border-radius: 5px;
}


/* --- Pagination --- */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 2rem;
}

.pagination button {
    padding: 0.5rem 1rem;
    margin: 0 0.25rem;
    border: 1px solid #ddd;
    background: var(--light-color);
    cursor: pointer;
    border-radius: 5px;
}

.pagination button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.pagination button.active, .pagination button:not(:disabled):hover {
    background: var(--primary-color);
    color: var(--light-color);
    border-color: var(--primary-color);
}

/* --- Lightbox --- */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none; /* Hidden by default */
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.lightbox.active {
    display: flex;
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

#lightbox-img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 5px;
}

.lightbox .close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 2rem;
}

.lightbox-nav button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.5);
    border: none;
    color: var(--light-color);
    font-size: 2rem;
    padding: 0.5rem 1rem;
    cursor: pointer;
}

#lightbox-prev { left: 15px; }
#lightbox-next { right: 15px; }

.lightbox .image-info-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
    color: var(--light-color);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox-content:hover .image-info-overlay {
    opacity: 1;
}


/* --- Footer --- */
footer {
    background: var(--dark-color);
    color: var(--light-color);
    padding-top: 3rem;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    flex-wrap: wrap;
}

.footer-section {
    flex: 1;
    min-width: 250px;
    margin-bottom: 2rem;
}

.footer-section h4 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li a, .footer-section p {
    color: #ccc;
    text-decoration: none;
    margin-bottom: 0.5rem;
    display: block;
}

.social-links a {
    color: var(--light-color);
    font-size: 1.5rem;
    margin-right: 1rem;
}

.footer-bottom {
    text-align: center;
    padding: 1rem;
    border-top: 1px solid #444;
}

/* --- Scroll to Top Button --- */
.scroll-top-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--primary-color);
    color: var(--light-color);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    cursor: pointer;
    display: none;
    z-index: 1000;
}

.scroll-top-btn.show {
    display: block;
}

/* --- Responsiveness --- */
@media (max-width: 992px) {
    .image-gallery {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    nav { flex-direction: column; }
    .nav-links { margin-top: 1rem; }
    .hero-content h1 { font-size: 2.5rem; }
    .footer-content { flex-direction: column; text-align: center; }
}

@media (max-width: 576px) {
    .image-gallery {
        grid-template-columns: 1fr;
    }
    .nav-links li { padding: 0 0.5rem; }
    #search-form { flex-direction: column; }
    #search-input, #search-form button { border-radius: 5px; }
    #search-form button { margin-top: 0.5rem; }
}
