/* ===========================
   RESET & BASE STYLES
   =========================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Color Palette */
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #252525;
    --bg-hover: #2f2f2f;
    --text-primary: #ffffff;
    --text-secondary: #d6f68b;
    --text-muted: #707070;
    --accent-primary: #a22b2b;
    --accent-hover: #942c2c;
    --border-color: #333333;
    --shadow-color: rgba(0, 0, 0, 0.5);
    
    /* Spacing */
    --sidebar-width: 280px;
    --header-height: 70px;
    --gap: 20px;
    
    /* Typography */
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Consolas', monospace;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* ===========================
   LAYOUT
   =========================== */
.top-banner {
    height: 60px;
    width: 100%;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    overflow: hidden;
    flex-shrink: 0;
    padding: 10px;
}

.banner-image {
    height: 100%;
    width: auto;
    object-fit: contain;
}

.container {
    display: flex;
    flex: 1;
    width: 100vw;
    overflow: hidden;
}

/* ===========================
   SIDEBAR
   =========================== */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar-header {
    padding: 30px 20px 20px;
    border-bottom: 1px solid var(--border-color);
}

.gallery-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.categories {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
}

.category-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.category-item {
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.category-item:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.category-item.active {
    background-color: var(--accent-primary);
    color: white;
    font-weight: 500;
}

.category-count {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.category-item.active .category-count {
    color: rgba(255, 255, 255, 0.8);
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.stats {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ===========================
   MAIN CONTENT
   =========================== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.content-header {
    height: var(--header-height);
    padding: 0 30px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--bg-secondary);
}

.content-header h2 {
    font-size: 1.8rem;
    font-weight: 600;
}

/* ===========================
   GALLERY GRID
   =========================== */
.gallery {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    grid-gap: 20px;
    grid-row-gap: 20px;
    grid-column-gap: 20px;
    align-content: start;
}

.gallery-item {
    position: relative;
    width: 100%;
    padding-bottom: 100%;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    background-color: var(--bg-tertiary);
    transition: all 0.3s ease;
    border: 1px solid rgb(51, 58, 30);
}

.gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 24px var(--shadow-color);
}

.gallery-item img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.gallery-item-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-item:hover .gallery-item-overlay {
    opacity: 1;
}

.gallery-item-title {
    font-size: 0.9rem;
    color: white;
    font-weight: 500;
}

/* ===========================
   LOADING & EMPTY STATES
   =========================== */
.loading, .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--bg-tertiary);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===========================
   LIGHTBOX
   =========================== */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox.active {
    display: block;
    opacity: 1;
}

.lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
}

.lightbox-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
}

/* ===========================
   LIGHTBOX CONTROLS
   =========================== */
.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1003;
    background: var(--bg-tertiary);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.lightbox-close:hover {
    background: var(--accent-primary);
    color: white;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1003;
    background: var(--bg-tertiary);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.lightbox-nav:hover {
    background: var(--accent-primary);
    color: white;
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 350px; /* Account for metadata sidebar */
}

/* ===========================
   LIGHTBOX IMAGE
   =========================== */
.lightbox-image-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 20px 100px 20px;
    overflow: hidden;
}

.lightbox-image-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    max-height: 100%;
    cursor: grab;
}

.lightbox-image-container.dragging {
    cursor: grabbing;
}

.lightbox-image-container.zoom-fit {
    cursor: default;
}

#lightbox-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    user-select: none;
    transition: none;
}

#lightbox-image.zoom-50 {
    max-width: 50%;
    max-height: 50%;
}

#lightbox-image.zoom-100 {
    max-width: none;
    max-height: none;
    width: auto;
    height: auto;
}

/* ===========================
   LIGHTBOX METADATA SIDEBAR
   =========================== */
.lightbox-metadata {
    width: 320px;
    background-color: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    overflow-y: auto;
    z-index: 1002;
}

.metadata-header {
    padding: 30px 20px 20px;
    border-bottom: 1px solid var(--border-color);
}

.metadata-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
}

.metadata-content {
    padding: 20px;
}

.metadata-item {
    margin-bottom: 20px;
}

.metadata-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.metadata-value {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.metadata-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 20px 0;
}

/* ===========================
   ZOOM CONTROLS
   =========================== */
.lightbox-controls {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1003;
    display: flex;
    gap: 10px;
    background: var(--bg-tertiary);
    padding: 8px;
    border-radius: 8px;
}

.zoom-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.zoom-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.zoom-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

/* ===========================
   SCROLLBAR STYLING
   =========================== */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--bg-hover);
}

/* ===========================
   RESPONSIVE DESIGN
   =========================== */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 220px;
    }
    
    .gallery {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .lightbox-metadata {
        width: 280px;
    }
    
    .lightbox-next {
        right: 300px;
    }
}

@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        max-height: 200px;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .gallery {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
        padding: 20px;
    }
    
    .lightbox-metadata {
        display: none; /* Hide metadata sidebar on mobile */
    }
    
    .lightbox-next {
        right: 20px;
    }
    
    .lightbox-image-wrapper {
        padding: 100px 10px;
    }
}
