/* Gallery Addon - mit gallery- Präfix für alle Klassen */

/* Gallery Container */
.gallery-container {
    width: 100%;
    margin: 2rem auto;
    padding: 0 1rem;
}

.gallery-info {
    background: var(--bg-secondary, #f8f9fa);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    color: var(--text-primary, #333);
    border-left: 4px solid var(--accent-color, #199bca);
}

.gallery-empty {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary, #666);
    font-style: italic;
}

/* Gallery Grid Layout */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
    list-style: none;
    padding: 0;
}

.gallery-item {
    position: relative;
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background: var(--bg-primary, white);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 1px solid var(--border-color, #e5e7eb);
    /* Touch-friendly tap area */
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
}

.gallery-item:hover,
.gallery-item.gallery-touch-active {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

/* Touch feedback for mobile devices */
.gallery-touch-active {
    transform: scale(0.98) !important;
    transition: transform 0.1s ease !important;
}

.gallery-thumb {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    transition: opacity 0.3s ease;
}

.gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

.gallery-zoom {
    color: white;
    font-size: 2rem;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

/* Modern Lightbox */
.gallery-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

.gallery-lightbox.gallery-active {
    display: flex;
}

.gallery-lightbox-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    cursor: pointer;
}

.gallery-lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    z-index: 10;
}

.gallery-lightbox-image {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.gallery-lightbox-close,
.gallery-lightbox-prev,
.gallery-lightbox-next {
    position: absolute;
    background: rgba(0,0,0,0.7);
    color: white;
    border: none;
    font-size: 2rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Touch-friendly */
    min-width: 44px;
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.gallery-lightbox-prev,
.gallery-lightbox-next {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 20;
}

.gallery-lightbox-close:hover,
.gallery-lightbox-prev:hover,
.gallery-lightbox-next:hover {
    background: rgba(0,0,0,0.9);
}

.gallery-lightbox-close {
    top: -25px;
    right: -25px;
    font-size: 1.5rem;
}

.gallery-lightbox-prev {
    left: 24px;
}

.gallery-lightbox-next {
    right: 24px;
}

.gallery-lightbox-counter {
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    background: rgba(0,0,0,0.7);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
}

/* Swipe indicator for mobile */
.gallery-lightbox.gallery-active::before {
    content: "← Wischen zum Navigieren →";
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,0.7);
    font-size: 0.8rem;
    z-index: 11;
    animation: fadeInOut 3s ease-in-out;
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0; }
    20%, 80% { opacity: 1; }
}

/* Responsive Design */
@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.5rem;
    }
    
    .gallery-thumb {
        height: 150px;
    }
    
    /* Hide navigation buttons on mobile - swipe works */
    .gallery-lightbox-prev,
    .gallery-lightbox-next {
        display: none;
    }
    
    .gallery-lightbox-content {
        max-width: 95vw;
        max-height: 85vh;
    }
    
    .gallery-lightbox-close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    /* Larger touch targets on mobile */
    .gallery-lightbox-close {
        min-width: 48px;
        min-height: 48px;
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .gallery-thumb {
        height: 120px;
    }
}
