.lightbox-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    /* 100dvh dynamically adjusts as mobile browser toolbars collapse/expand */
    height: 100vh;
    height: 100dvh; 
    background: rgba(23, 23, 23, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 99999;
    flex-direction: column;
    overflow: hidden;
}
.lightbox-modal.active { display: flex; }

.lightbox-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    z-index: 10;
    flex-shrink: 0;
}
.lightbox-title { font-weight: 600; font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lightbox-controls { display: flex; gap: 8px; align-items: center; }
.lightbox-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s;
}
.lightbox-btn:hover { background: rgba(255, 255, 255, 0.3); }

.lightbox-body {
    display: flex;
    flex: 1;
    position: relative;
    overflow: hidden;
    height: 100%;
}

.lightbox-main-container {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    min-width: 0;
    height: 100%;
}

.lightbox-viewport {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none; /* Disables native browser touch/zoom actions on this container */
}

.lightbox-img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    transition: transform 0.1s ease-out;
    cursor: zoom-in;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    font-size: 2rem;
    padding: 16px 12px;
    cursor: pointer;
    z-index: 5;
    border-radius: 4px;
    transition: background 0.2s;
}
.lightbox-nav:hover { background: rgba(0, 0, 0, 0.8); }
.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }

.lightbox-sidebar {
    width: 280px;
    background: rgba(41, 41, 41, 0.95);
    color: #f8fafc;
    padding: 20px;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.85rem;
    overflow-y: auto;
    position: relative;
    z-index: 10;
    flex-shrink: 0;
}
.lightbox-sidebar h4 { margin-top: 0; margin-bottom: 12px; font-size: 1rem; color: #38bdf8; border-bottom: 1px solid rgba(255, 255, 255, 0.1); padding-bottom: 8px; }
.meta-group { margin-bottom: 12px; }
.meta-label { color: #94a3b8; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; display: block; margin-bottom: 2px; }
.meta-value { color: #f8fafc; word-break: break-all; font-family: monospace; }

@media (max-width: 768px) { 
    .lightbox-sidebar { display: none; } 
    .lightbox-header { padding: 10px 14px; }
    .lightbox-btn { padding: 8px 14px; } /* Larger touch targets for mobile */
}