/* =========================================
   GALERIA MEDIA (Zdjęcia i Klipy)
   ========================================= */
.gallery-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

.media-item {
    position: relative;
    aspect-ratio: 16 / 9;
    background: var(--bg-surface);
    clip-path: polygon(15px 0, 100% 0, 100% calc(100% - 15px), calc(100% - 15px) 100%, 0 100%, 0 15px);
    cursor: zoom-in;
    overflow: hidden;
    transition: transform 0.2s ease-in-out, filter 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: block; 
    text-decoration: none;
}

.media-item:hover {
    transform: scale(1.02);
    filter: drop-shadow(0 10px 20px rgba(0,0,0,0.5));
}

.media-item img, 
.media-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity 0.3s;
}

/* Wyświetlanie globalnego przycisku usuwania (z style.css) po najechaniu na kafel */
.media-item:hover .delete-btn { 
    opacity: 1; 
}

/* Przycisk Play dla wideo */
.play-icon-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transition: all 0.3s;
    backdrop-filter: blur(3px);
    z-index: 1;
}

.play-icon-overlay svg {
    width: 24px;
    height: 24px;
    fill: var(--accent);
    margin-left: 4px;
}

.media-item:hover .play-icon-overlay {
    background: var(--accent);
    transform: translate(-50%, -50%) scale(1.1);
}
.media-item:hover .play-icon-overlay svg { fill: #1d2021; }

/* =========================================
   WINIETA MINIATURKI (Zjeżdżająca z góry)
   ========================================= */
.media-overlay {
    position: absolute;
    top: 0;       
    left: 0;
    right: 0;
    padding: 15px 15px 25px 15px; 
    background: linear-gradient(to bottom, rgba(0,0,0,0.95) 0%, transparent 100%); 
    display: flex;
    justify-content: space-between;
    align-items: flex-start; 
    transform: translateY(-100%); 
    transition: transform 0.3s ease;
    z-index: 2;
}

.overlay-title {
    color: var(--accent);
    font-family: monospace;
    font-size: 0.9rem;
    font-weight: bold;
    letter-spacing: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.overlay-date {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-family: monospace;
    margin-left: 10px;
}

.media-item:hover .media-overlay {
    transform: translateY(0); 
}

/* =========================================
   LIGHTBOX (Tryb powiększenia z Opisami)
   ========================================= */
.lightbox {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(10, 10, 10, 0.98);
    backdrop-filter: blur(5px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.lightbox.active {
    opacity: 1;
    pointer-events: all;
}

/* PANCERNE CENTROWANIE I WYMUSZENIE POWIĘKSZENIA W LIGHTBOXIE */
.lightbox-content-wrapper {
    position: relative;
    width: 90vw;       
    height: 90vh;      
    max-width: 90vw;
    max-height: 90vh; 
    border-radius: 8px;
    overflow: hidden; 
    box-shadow: 0 20px 50px rgba(0,0,0,0.8);
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
}

#lightbox-content {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
}

#lightbox-content img,
#lightbox-content video {
    width: 100%;         
    height: 100%;        
    object-fit: contain; 
    display: block;
}

/* =========================================
   LIGHTBOX FOOTER (Górny, wjeżdżający pasek)
   ========================================= */
.lightbox-footer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 100;
    
    background-color: rgba(15, 15, 15, 0.95);
    padding: 15px 70px 15px 25px; 
    border-bottom: 2px solid var(--accent); 
    
    /* Ukrycie paska nad obrazem */
    opacity: 0;
    transform: translateY(-100%);
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

.lightbox-content-wrapper:hover .lightbox-footer {
    opacity: 1;
    transform: translateY(0); 
}

.lightbox-header-row {
    display: flex;
    flex-direction: row; 
    align-items: center;
    gap: 15px;
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 4px;
}

.lightbox-header-row h2 {
    color: var(--text-main);
    font-size: 1.2rem; 
    margin: 0;
    font-weight: 600;
}

.lightbox-date {
    color: var(--accent);
    background: rgba(222, 188, 122, 0.1);
    padding: 3px 8px;
    border-radius: 4px;
    font-family: ui-monospace, SFMono-Regular, monospace;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.lightbox-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.4;
    margin: 0;
}

/* Przycisk ZAMKNIJ (Zawsze przypięty do ekranu w prawym górnym rogu) */
.lightbox-close {
    position: absolute;
    top: 10px;
    right: 20px;
    color: rgba(255, 255, 255, 0.5); 
    font-size: 2.5rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s, transform 0.2s;
    user-select: none;
    z-index: 10000;
}

.lightbox-close:hover {
    color: var(--accent);
    transform: scale(1.1);
}

/* =========================================
   TRYB MOBILNY (Telefony)
   ========================================= */
@media (max-width: 768px) {
    .lightbox-content-wrapper { 
        width: 100vw; 
        height: 100vh; 
        max-width: 100vw; 
        max-height: 100vh; 
        border-radius: 0; 
    }
    
    #lightbox-content img, #lightbox-content video { 
        width: 100%; 
        height: 100%; 
    }
    
    .lightbox-footer {
        top: 0;
        padding: 15px 50px 15px 15px;
        opacity: 1;
        transform: translateY(0);
    }
    
    .lightbox-header-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .lightbox-close {
        top: 8px;
        right: 15px;
    }
}