/* GALLERY.CSS - OSTATECZNA WERSJA Z JEDNOLITYMI MINIATURAMI */

/* ===== RESET I FORCE VISIBILITY ===== */
.gallery-section,
.gallery-grid,
.gallery-item,
.gallery-thumbnail,
.gallery-thumbnail img,
.gallery-caption {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
}

/* ===== FILTRY GALERII ===== */
.gallery-filters-section {
    padding: 2rem 0;
    background: linear-gradient(135deg, #f8f9fa 0%, #f0f2f5 100%);
    border-bottom: 1px solid rgba(255, 107, 53, 0.1);
}

.gallery-filters {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.filter-btn {
    background: #ffffff;
    color: #1a365d;
    border: 2px solid #f8f9fa;
    padding: 12px 24px;
    border-radius: 25px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
    text-align: center;
}

.filter-btn:hover {
    border-color: #ff6b35;
    color: #ff6b35;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.filter-btn.active {
    background: linear-gradient(135deg, #ff6b35, #ff8c5a);
    color: #ffffff;
    border-color: #ff6b35;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

/* ===== GŁÓWNA SEKCJA GALERII ===== */
.gallery-section {
    padding: 4rem 0 !important;
    background: #ffffff !important;
    min-height: 60vh !important;
}

.gallery-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)) !important;
    gap: 2rem !important;
    margin-top: 2rem !important;
}

/* ===== ELEMENTY GALERII - JEDNOLITE ROZMIARY ===== */
.gallery-item {
    position: relative !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
    transition: all 0.3s ease !important;
    background: #ffffff !important;
    height: 320px !important; /* STAŁA WYSOKOŚĆ - BEZ PODPISÓW */
    opacity: 1 !important;
    transform: translateY(0) !important;
    display: block !important;
    visibility: visible !important;
}

.gallery-item:hover {
    transform: translateY(-8px) scale(1.02) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15) !important;
}

.gallery-thumbnail {
    position: relative !important;
    width: 100% !important;
    height: 320px !important; /* STAŁA WYSOKOŚĆ - CAŁA KARTA */
    border: none !important;
    background: none !important;
    cursor: pointer !important;
    padding: 0 !important;
    overflow: hidden !important;
    border-radius: 12px !important; /* PEŁNE ZAOKRĄGLENIE */
    display: block !important;
    visibility: visible !important;
}

.gallery-thumbnail img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important; /* PRZYCINANIE DO JEDNOLITEJ WIELKOŚCI */
    object-position: center !important; /* WYŚRODKOWANIE */
    transition: all 0.3s ease !important;
    border-radius: 12px !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    max-width: none !important;
    max-height: none !important;
}

.gallery-item:hover .gallery-thumbnail img {
    transform: scale(1.1) !important;
}

.gallery-overlay {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: linear-gradient(135deg, rgba(26, 54, 93, 0.85) 0%, rgba(44, 90, 160, 0.85) 100%) !important;
    color: #ffffff !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    opacity: 0 !important;
    transition: all 0.3s ease !important;
    backdrop-filter: blur(2px) !important;
}

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

.gallery-overlay i {
    font-size: 2.5rem !important;
    animation: pulse 2s infinite !important;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3)) !important;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ===== UKRYJ PODPISY - JEDNOLITE MINIATURY ===== */
.gallery-caption {
    display: none !important;
}

/* ===== KATEGORIE KOLOROWE ===== */
.gallery-item[data-category="training"] {
    border-top: 4px solid #27ae60 !important;
}

.gallery-item[data-category="machines"] {
    border-top: 4px solid #f39c12 !important;
}

.gallery-item[data-category="certificates"] {
    border-top: 4px solid #9b59b6 !important;
}

.gallery-item[data-category="facilities"] {
    border-top: 4px solid #3498db !important;
}

/* ===== LIGHTBOX ===== */
.lightbox {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.9) !important;
    backdrop-filter: blur(10px) !important;
    z-index: 99999 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transition: all 0.3s ease !important;
}

.lightbox.active {
    opacity: 1 !important;
    visibility: visible !important;
}

.lightbox-overlay {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    cursor: pointer !important;
}

/* LIGHTBOX BEZ OPISÓW - WYŚRODKOWANY */
.lightbox-container {
    position: relative !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    margin: 0 !important;
    transform: none !important;
    width: 100vw !important;
    height: 100vh !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.lightbox-content {
    position: relative !important;
    background: transparent !important;
    border-radius: 0 !important;
    overflow: visible !important;
    box-shadow: none !important;
    max-width: 100% !important;
    max-height: 100% !important;
    margin: 0 !important;
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.lightbox-image-container {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    background: transparent !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: auto !important;
    height: auto !important;
    min-height: auto !important;
    max-height: 95vh !important;
    max-width: 95vw !important;
}

#lightbox-image {
    max-width: 95vw !important;
    max-height: 95vh !important;
    object-fit: contain !important;
    transition: opacity 0.3s ease !important;
    width: auto !important;
    height: auto !important;
    display: block !important;
    margin: 0 !important;
    position: relative !important;
}

/* UKRYJ OPISY W LIGHTBOX */
.lightbox-info {
    display: none !important;
}

.lightbox-close {
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    width: 50px !important;
    height: 50px !important;
    background: rgba(0, 0, 0, 0.8) !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    z-index: 100001 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 1.5rem !important;
    transition: all 0.3s ease !important;
    backdrop-filter: blur(10px) !important;
}

.lightbox-nav {
    position: fixed !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 60px !important;
    height: 60px !important;
    background: rgba(0, 0, 0, 0.8) !important;
    color: #ffffff !important;
    border: none !important;
    cursor: pointer !important;
    z-index: 100001 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 1.8rem !important;
    transition: all 0.3s ease !important;
    backdrop-filter: blur(10px) !important;
}

.lightbox-prev {
    left: 20px !important;
    border-radius: 0 30px 30px 0 !important;
}

.lightbox-next {
    right: 20px !important;
    border-radius: 30px 0 0 30px !important;
}

.lightbox-close:hover {
    background: rgba(255, 107, 53, 0.9) !important;
    transform: scale(1.1) !important;
}

.lightbox-nav:hover {
    background: rgba(255, 107, 53, 0.9) !important;
    transform: translateY(-50%) scale(1.1) !important;
}

.lightbox-loading {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    display: none !important;
    align-items: center !important;
    justify-content: center !important;
    color: #ffffff !important;
    z-index: 100000 !important;
}

.loading-spinner {
    width: 40px !important;
    height: 40px !important;
    border: 4px solid rgba(255, 255, 255, 0.3) !important;
    border-top: 4px solid #ffffff !important;
    border-radius: 50% !important;
    animation: spin 1s linear infinite !important;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== UTILITY CLASSES ===== */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

body.lightbox-open {
    overflow: hidden !important;
    padding-right: 15px !important;
}

/* ===== RESPONSYWNOŚĆ - JEDNOLITE ROZMIARY NA WSZYSTKICH URZĄDZENIACH ===== */

/* TABLET - JEDNOLITE ROZMIARY */
@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important;
        gap: 1.5rem !important;
    }
    
    .gallery-item {
        height: 280px !important; /* STAŁA WYSOKOŚĆ */
    }
    
    .gallery-thumbnail {
        height: 280px !important; /* STAŁA WYSOKOŚĆ - CAŁA KARTA */
    }
    
    .gallery-filters {
        flex-direction: row !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 0.8rem !important;
    }
    
    .filter-btn {
        padding: 10px 18px !important;
        font-size: 0.9rem !important;
        min-width: 100px !important;
    }
}

/* TELEFON - JEDNOLITE ROZMIARY */
@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)) !important;
        gap: 1rem !important;
        padding: 0 10px !important;
    }
    
    .gallery-item {
        height: 250px !important; /* STAŁA WYSOKOŚĆ */
        max-width: none !important;
        margin: 0 !important;
    }
    
    .gallery-thumbnail {
        height: 250px !important; /* STAŁA WYSOKOŚĆ - CAŁA KARTA */
    }
    
    .gallery-filters {
        flex-direction: column !important;
        align-items: center !important;
        gap: 0.5rem !important;
    }
    
    .filter-btn {
        width: 90% !important;
        max-width: 200px !important;
        padding: 12px 20px !important;
    }
    
    /* Lightbox na telefonie */
    .lightbox-close {
        width: 40px !important;
        height: 40px !important;
        font-size: 1.2rem !important;
        top: 15px !important;
        right: 15px !important;
    }
    
    .lightbox-nav {
        width: 50px !important;
        height: 50px !important;
        font-size: 1.5rem !important;
    }
    
    .lightbox-prev {
        left: 15px !important;
    }
    
    .lightbox-next {
        right: 15px !important;
    }
}

/* BARDZO MAŁE TELEFONY */
@media (max-width: 360px) {
    .gallery-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
        padding: 0 15px !important;
    }
    
    .gallery-item {
        height: 220px !important; /* STAŁA WYSOKOŚĆ */
        max-width: 320px !important;
        margin: 0 auto !important;
    }
    
    .gallery-thumbnail {
        height: 220px !important; /* STAŁA WYSOKOŚĆ - CAŁA KARTA */
    }
    
    .lightbox-close {
        width: 35px !important;
        height: 35px !important;
        font-size: 1rem !important;
        top: 10px !important;
        right: 10px !important;
    }
    
    .lightbox-nav {
        width: 45px !important;
        height: 45px !important;
        font-size: 1.3rem !important;
    }
    
    .lightbox-prev {
        left: 10px !important;
    }
    
    .lightbox-next {
        right: 10px !important;
    }
}

/* NADPISANIE WSZYSTKICH POPRZEDNICH REGUŁ ORIENTACJI */
.gallery-item.portrait,
.gallery-item.landscape,
.gallery-item.square {
    height: inherit !important; /* UŻYWA WYSOKOŚCI Z RESPONSYWNYCH REGUŁ */
}

.gallery-item.portrait .gallery-thumbnail,
.gallery-item.landscape .gallery-thumbnail,
.gallery-item.square .gallery-thumbnail {
    height: inherit !important; /* UŻYWA WYSOKOŚCI Z RESPONSYWNYCH REGUŁ */
}

.lightbox.active .lightbox-container {
    transform: none !important;
}