/**
 * Header-Bildergalerie - Responsive Galerie unter der Hauptnavigation
 */

.header-gallery {
    padding: 20px 0;
    background: #F2F2F2;
    border-bottom: 1px solid #e9ecef;
}

.header-gallery .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

.header-gallery-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 15px;
    align-items: center;
}

.header-gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    aspect-ratio: 1;
}

.header-gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

.header-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

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

/* Lightbox Overlay */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 999999;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.lightbox-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    display: block;
    margin: 10% auto;
}

.lightbox-close {
    position: absolute;
    top: 0px;
    right: -10px;
    background: rgba(0, 45, 92, 0.8);
    border: 2px solid #F2F2F2;
    border-radius: 50%;
    color: #F2F2F2;
    font-size: 24px;
    cursor: pointer;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 9999999 !important;
    font-weight: bold;
}

.lightbox-close:hover {
    background: rgba(125, 194, 28, 0.8);
    transform: scale(1.1);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 45, 92, 0.8);
    border: 2px solid #F2F2F2;
    border-radius: 50%;
    color: #F2F2F2;
    font-size: 28px;
    font-weight: bold;
    width: 60px;
    height: 60px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex !important;
    align-items: center;
    justify-content: center;
    z-index: 9999999 !important;
}

.lightbox-nav:hover:not(.disabled) {
    background: rgba(125, 194, 28, 0.8);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-nav.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.lightbox-nav.disabled:hover {
    background: rgba(0, 45, 92, 0.8);
    transform: translateY(-50%);
}

.lightbox-prev {
    left: 30px;
}

.lightbox-next {
    right: -80px;
}

.lightbox-counter {
    position: absolute;
    bottom: -60px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 45, 92, 0.8);
    color: #F2F2F2;
    font-size: 16px;
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid #F2F2F2;
    z-index: 1000000;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .header-gallery-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
}

@media (max-width: 768px) {
    .header-gallery {
        padding: 15px 0;
    }
    
    .header-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .lightbox-nav {
        width: 50px;
        height: 50px;
        font-size: 24px;
    }
    
    .lightbox-prev {
        left: -65px;
    }
    
    .lightbox-next {
        right: -65px;
    }
    
    .lightbox-close {
        width: 45px;
        height: 45px;
        font-size: 20px;
        top: 10px;
    }
    
    /* Admin-Bar Anpassung für Tablets */
    body.admin-bar .lightbox-close {
        top: 70px;
    }
    
    .lightbox-counter {
        font-size: 14px;
        padding: 6px 12px;
        bottom: -55px;
    }
}

@media (max-width: 480px) {
    .header-gallery .container {
        padding: 0 10px;
    }
    
    .header-gallery-grid {
        gap: 8px;
    }
    
    .lightbox-nav {
        width: 45px;
        height: 45px;
        font-size: 20px;
    }
    
    .lightbox-prev {
        left: -55px;
    }
    
    .lightbox-next {
        right: -55px;
    }
    
    .lightbox-close {
        top: 10px;
        font-size: 18px;
        width: 40px;
        height: 40px;
    }
    
    /* Admin-Bar Anpassung für Mobile */
    body.admin-bar .lightbox-close {
        top: 70px;
    }
    
    .lightbox-content {
        max-width: 95vw;
        max-height: 95vh;
    }
    
    .lightbox-counter {
        bottom: -50px;
        font-size: 12px;
        padding: 4px 8px;
    }
}

/* Für sehr kleine Bildschirme Navigation ausblenden */
@media (max-width: 360px) {
    .lightbox-nav {
        display: none !important;
    }
    
    .lightbox-counter {
        bottom: -45px;
    }
}

/* Touch-Verbesserungen */
@media (pointer: coarse) {
    .lightbox-nav,
    .lightbox-close {
        min-width: 44px;
        min-height: 44px;
    }
}

/* Animation für das Laden */
.header-gallery-item {
    opacity: 0;
    animation: fadeInUp 0.6s ease forwards;
}

.header-gallery-item:nth-child(1) { animation-delay: 0.1s; }
.header-gallery-item:nth-child(2) { animation-delay: 0.2s; }
.header-gallery-item:nth-child(3) { animation-delay: 0.3s; }
.header-gallery-item:nth-child(4) { animation-delay: 0.4s; }
.header-gallery-item:nth-child(5) { animation-delay: 0.5s; }
.header-gallery-item:nth-child(6) { animation-delay: 0.6s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Smooth scrolling prevention when lightbox is open */
body.lightbox-open {
    overflow: hidden;
}

/* Stelle sicher, dass die Lightbox über allen anderen Elementen liegt */
.lightbox-overlay {
    z-index: 9999999 !important;
}

/* Spezielle Überschreibung für WordPress Admin Bar und andere hochpriorisierte Elemente */
.admin-bar .lightbox-overlay {
    z-index: 999999999 !important;
}

#wpadminbar {
    z-index: 99999 !important;
}

.et_fixed_nav #main-header,
.et_fixed_nav #top-header,
#et-main-area,
.et_header_style_centered #main-header,
.et_header_style_split #main-header {
    z-index: 99999 !important;
}

/* Lightbox hat höchste Priorität */
.lightbox-overlay,
.lightbox-content,
.lightbox-close,
.lightbox-nav,
.lightbox-counter {
    z-index: 9999999 !important;
}

/* Spezielle Behandlung für Admin-Bar */
body.admin-bar .lightbox-close {
    top: 60px;
    z-index: 999999999 !important;
}

body.admin-bar .lightbox-overlay {
    z-index: 999999999 !important;
}

body.admin-bar .lightbox-nav,
body.admin-bar .lightbox-counter {
    z-index: 999999999 !important;
}
