/**
 * Te Gallery Styles
 *
 * Styles for shortcode-generated galleries with Embla carousel
 * and GLightbox integration. Includes RTL and responsive support.
 *
 * @package Tewido
 * @since 1.4.1
 */

/* Gallery Container */
.te-gallery-container {
    margin: 2rem 0;
    max-width: 100%;
}

/* Main Carousel */
.te-gallery-main {
    position: relative;
    background: #fff;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
}

.te-gallery-main .embla {
    overflow: hidden;
}

.te-gallery-main .embla__container {
    display: flex;
    transition: transform 0.3s ease;
    backface-visibility: hidden;
}

.te-gallery-main .embla__slide {
    flex: 0 0 100%;
    min-width: 0;
    height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9fafb;
}

.te-gallery-main .embla__slide img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    margin-top: 0;
    margin-bottom: 0;
    border-radius: 0;
}

.te-gallery-main .embla__slide a {
    display: block;
    width: 100%;
    height: 100%;
    cursor: zoom-in;
    transition: opacity 0.2s;
}

.te-gallery-main .embla__slide a:hover {
    opacity: 0.95;
}

/* Navigation Arrows */
.te-gallery-main .embla__prev,
.te-gallery-main .embla__next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.te-gallery-main .embla__prev:hover,
.te-gallery-main .embla__next:hover {
    background: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: translateY(-50%) scale(1.05);
}

.te-gallery-main .embla__prev:active,
.te-gallery-main .embla__next:active {
    transform: translateY(-50%) scale(0.95);
}

.te-gallery-main .embla__prev {
    left: 1rem;
}

.te-gallery-main .embla__next {
    right: 1rem;
}

.te-gallery-main .embla__prev svg,
.te-gallery-main .embla__next svg {
    width: 20px;
    height: 20px;
    color: #333;
}

/* RTL Support for Navigation */


/* Thumbnails Container */
.te-gallery-thumbs {
    overflow: hidden;
}

.te-gallery-thumbs .embla-thumbs__container {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
}

.te-gallery-thumbs .embla-thumbs__slide {
    flex: 0 0 80px;
    min-width: 0;
}

.te-gallery-thumbs .embla-thumbs__slide__button {
    border-radius: .55rem;
    overflow: hidden;
    cursor: pointer;
    padding: 0;
    background: none;
    transition: all 0.2s ease;
    display: block;
    width: 80px;
    height: 80px;
}

.te-gallery-thumbs .embla-thumbs__slide__img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    display: block;
    opacity: 0.6;
    transition: opacity 0.2s;
    margin-top: 0;
    margin-bottom: 0;
    border-radius: 0;
}

.te-gallery-thumbs .embla-thumbs__slide__button:hover .embla-thumbs__slide__img {
    opacity: 0.8;
}

.te-gallery-thumbs .embla-thumbs__slide__button.active .embla-thumbs__slide__img {
    opacity: 1;
}

/* Dark mode support */
.dark .te-gallery-main {
    background: #1f2937;
    box-shadow: 0 1px 3px rgba(255, 255, 255, 0.05);
}

.dark .te-gallery-main .embla__slide {
    background: #374151;
}

.dark .te-gallery-main .embla__prev,
.dark .te-gallery-main .embla__next {
    background: rgba(31, 41, 55, 0.95);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.dark .te-gallery-main .embla__prev:hover,
.dark .te-gallery-main .embla__next:hover {
    background: #1f2937;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.dark .te-gallery-main .embla__prev svg,
.dark .te-gallery-main .embla__next svg {
    color: #f9fafb;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .te-gallery-container {
        margin: 1.5rem 0;
    }

    .te-gallery-main .embla__slide {
        height: 400px;
    }

    .te-gallery-main .embla__prev,
    .te-gallery-main .embla__next {
        width: 32px;
        height: 32px;
    }

    .te-gallery-main .embla__prev svg,
    .te-gallery-main .embla__next svg {
        width: 16px;
        height: 16px;
    }

    .te-gallery-main .embla__prev {
        left: 0.5rem;
    }

    .te-gallery-main .embla__next {
        right: 0.5rem;
    }

    [dir="rtl"] .te-gallery-main .embla__prev {
        left: auto;
        right: 0.5rem;
    }

    [dir="rtl"] .te-gallery-main .embla__next {
        right: auto;
        left: 0.5rem;
    }

    .te-gallery-thumbs .embla-thumbs__container {
        gap: 0.5rem;
    }

    .te-gallery-thumbs .embla-thumbs__slide {
        flex: 0 0 60px;
    }

    .te-gallery-thumbs .embla-thumbs__slide__button {
        width: 60px;
        height: 60px;
    }

    .te-gallery-thumbs .embla-thumbs__slide__img {
        width: 60px;
        height: 60px;
    }
}

/* Loading State */
.te-gallery-container.loading .embla__slide {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.dark .te-gallery-container.loading .embla__slide {
    background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
    background-size: 200% 100%;
}
