:root {
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --text-main: #ffffff;
    --text-sec: #aaaaaa;
    --accent: #e63946;
    --gap: 15px;
}

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

body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    transition: background 0.3s;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 5%;
    background: rgba(18, 18, 18, 0.95);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(5px);
    border-bottom: 1px solid #333;
}

.logo { font-size: 1.5rem; font-weight: bold; letter-spacing: 2px; }

.controls { display: flex; gap: 15px; align-items: center; }

button {
    cursor: pointer;
    background: none;
    border: 1px solid #444;
    color: var(--text-main);
    padding: 8px 15px;
    border-radius: 20px;
    transition: 0.2s;
}

button:hover { background: #333; }
button.active { background: var(--text-main); color: var(--bg-color); }

/* Category Nav */
#category-nav {
    padding: 20px 5%;
    overflow-x: auto;
    white-space: nowrap;
    -ms-overflow-style: none; 
    scrollbar-width: none; 
}
#category-nav::-webkit-scrollbar { display: none; }

#category-nav ul { list-style: none; display: inline-block; }
#category-nav li { display: inline-block; margin-right: 10px; }

/* Gallery Layouts */
main { padding: 20px 5%; min-height: 80vh; }

#gallery-container {
    display: grid;
    gap: var(--gap);
    transition: all 0.3s ease;
}

/* Grid View (Default) */
.layout-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    grid-auto-rows: 250px;
}
.layout-grid .img-card {
    height: 100%;
    overflow: hidden;
    border-radius: 8px;
}

/* Masonry View (Pinterest style) */
.layout-masonry {
    column-count: 4;
    column-gap: var(--gap);
}
.layout-masonry .img-card {
    break-inside: avoid;
    margin-bottom: var(--gap);
    border-radius: 8px;
    overflow: hidden;
}

/* List View */
.layout-list {
    display: flex;
    flex-direction: column;
    gap: var(--gap);
}
.layout-list .img-card {
    height: 300px;
    border-radius: 8px;
}

/* Image Card Styling */
.img-card {
    position: relative;
    cursor: pointer;
    background: #222;
    transition: transform 0.2s;
}
.img-card:hover { transform: scale(1.02); z-index: 2; }
.img-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Hover Info */
.img-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    padding: 20px 10px 10px;
    opacity: 0;
    transition: opacity 0.2s;
}
.img-card:hover .img-info { opacity: 1; }
.photographer { font-size: 0.8rem; font-weight: bold; }

/* Loading & Footer */
#loading { text-align: center; padding: 50px; color: var(--text-sec); }
.hidden { display: none !important; }
footer { text-align: center; padding: 40px; color: var(--text-sec); font-size: 0.9rem; }

/* Lightbox */
.lightbox {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.95);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}
.lightbox img { max-width: 90%; max-height: 80vh; border-radius: 4px; }
.lightbox-info { margin-top: 20px; display: flex; gap: 20px; color: white; align-items: center; }
#close-lightbox {
    position: absolute; top: 20px; right: 30px;
    font-size: 2rem; border: none;
}
.api-alert {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: #e63946; color: white;
    display: flex; justify-content: center; align-items: center; z-index: 2000;
}

/* Responsive */
@media (max-width: 768px) {
    .layout-masonry { column-count: 2; }
    .layout-grid { grid-template-columns: 1fr; } 
}
