/**
 * MexGallery Frontend Styles
 *
 * @package MexGallery
 * @copyright MexTech Limited - All Rights Reserved
 */

:root {
    --mexgallery-primary: #3b82f6;
    --mexgallery-bg: #f8fafc;
    --mexgallery-hover: #1d4ed8;
    --mexgallery-font: system-ui, -apple-system, sans-serif;
    --mexgallery-columns: 4;
    --mexgallery-gap: 16px;
}

.mexgallery-teaser,
.mexgallery-main {
    font-family: var(--mexgallery-font);
    box-sizing: border-box;
}

.mexgallery-teaser *,
.mexgallery-main *,
.mexgallery-lightbox *,
.mexgallery-video-modal * {
    box-sizing: border-box;
}

.mexgallery-empty {
    padding: 40px 20px;
    text-align: center;
    color: #64748b;
    font-size: 14px;
}

/* Grid Layout */
.mexgallery-grid {
    display: grid;
    grid-template-columns: repeat(var(--mexgallery-columns), 1fr);
    gap: var(--mexgallery-gap);
}

@media (max-width: 1024px) {
    .mexgallery-grid {
        grid-template-columns: repeat(min(var(--mexgallery-columns), 3), 1fr);
    }
}

@media (max-width: 768px) {
    .mexgallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .mexgallery-grid {
        grid-template-columns: 1fr;
    }
}

/* Gallery Items */
.mexgallery-item {
    position: relative;
    overflow: hidden;
    background: var(--mexgallery-bg);
}

.mexgallery-item--square {
    border-radius: 0;
}

.mexgallery-item--rounded {
    border-radius: 12px;
}

.mexgallery-item--circle {
    border-radius: 50%;
}

.mexgallery-item--clickable {
    cursor: pointer;
}

.mexgallery-item__inner {
    position: relative;
    padding-bottom: 100%;
    overflow: hidden;
}

.mexgallery-item__image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.mexgallery-item:hover .mexgallery-item__image {
    transform: scale(1.05);
}

.mexgallery-item__overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 16px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mexgallery-item:hover .mexgallery-item__overlay {
    opacity: 1;
}

.mexgallery-item__title {
    color: white;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.mexgallery-item__play-icon,
.mexgallery-item__zoom-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: rgba(0, 0, 0, 0.75);
    border-radius: 50%;
    color: white;
    transition: all 0.3s ease;
    opacity: 0;
    font-size: 20px;
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.mexgallery-item__play-icon i {
    margin-left: 4px;
}

.mexgallery-item:hover .mexgallery-item__play-icon,
.mexgallery-item:hover .mexgallery-item__zoom-icon {
    background: var(--mexgallery-primary);
    transform: translate(-50%, -50%) scale(1.1);
    opacity: 1;
}

.mexgallery-item[data-type="video"] .mexgallery-item__play-icon {
    opacity: 1;
}

/* Teaser Button */
.mexgallery-teaser__button-wrap {
    margin-top: 24px;
    text-align: center;
}

.mexgallery-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 600;
    color: white;
    background: var(--mexgallery-primary);
    border: none;
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mexgallery-button:hover {
    background: var(--mexgallery-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

/* Slider */
.mexgallery-slider {
    position: relative;
    overflow: hidden;
}

.mexgallery-slider__track {
    display: flex;
    transition: transform 0.5s ease;
}

.mexgallery-slider__slide {
    flex: 0 0 100%;
    padding: 0 var(--mexgallery-gap);
}

@media (min-width: 768px) {
    .mexgallery-slider__slide {
        flex: 0 0 50%;
    }
}

@media (min-width: 1024px) {
    .mexgallery-slider__slide {
        flex: 0 0 33.333%;
    }
}

.mexgallery-slider__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    z-index: 10;
}

.mexgallery-slider__nav:hover {
    background: var(--mexgallery-primary);
    color: white;
}

.mexgallery-slider__nav i {
    font-size: 18px;
}

.mexgallery-slider__nav--prev {
    left: 10px;
}

.mexgallery-slider__nav--next {
    right: 10px;
}

.mexgallery-slider__dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
}

.mexgallery-slider__dot {
    width: 10px;
    height: 10px;
    background: #cbd5e1;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mexgallery-slider__dot--active {
    background: var(--mexgallery-primary);
    transform: scale(1.2);
}

/* Lightbox */
.mexgallery-lightbox {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.mexgallery-lightbox.active {
    opacity: 1;
    visibility: visible;
}

.mexgallery-lightbox__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
}

.mexgallery-lightbox__content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 80px;
}

.mexgallery-lightbox__close {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
}

.mexgallery-lightbox__close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.mexgallery-lightbox__close i {
    font-size: 20px;
}

.mexgallery-lightbox__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
}

.mexgallery-lightbox__nav:hover {
    background: rgba(255, 255, 255, 0.2);
}

.mexgallery-lightbox__nav i {
    font-size: 20px;
}

.mexgallery-lightbox__nav--prev {
    left: 20px;
}

.mexgallery-lightbox__nav--next {
    right: 20px;
}

.mexgallery-lightbox__image-wrap {
    max-width: 100%;
    max-height: calc(100vh - 160px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.mexgallery-lightbox__image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mexgallery-lightbox__image.loaded {
    opacity: 1;
}

.mexgallery-lightbox__caption {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 600px;
    padding: 12px 20px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 8px;
    color: white;
    font-size: 14px;
    text-align: center;
}

.mexgallery-lightbox__counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
}

/* Video Modal */
.mexgallery-video-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.mexgallery-video-modal.active {
    opacity: 1;
    visibility: visible;
}

.mexgallery-video-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
}

.mexgallery-video-modal__content {
    position: relative;
    width: 90%;
    max-width: 1000px;
}

.mexgallery-video-modal__close {
    position: absolute;
    top: -50px;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mexgallery-video-modal__close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.mexgallery-video-modal__close i {
    font-size: 20px;
}

.mexgallery-video-modal__player {
    position: relative;
    padding-bottom: 56.25%;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}

.mexgallery-video-modal__video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

@media (max-width: 768px) {
    .mexgallery-lightbox__content {
        padding: 60px 20px;
    }

    .mexgallery-lightbox__nav {
        width: 40px;
        height: 40px;
    }

    .mexgallery-lightbox__nav--prev {
        left: 10px;
    }

    .mexgallery-lightbox__nav--next {
        right: 10px;
    }

    .mexgallery-lightbox__caption {
        max-width: 90%;
        bottom: 80px;
    }
}

/* Accessibility */
.mexgallery-item--clickable:focus {
    outline: 3px solid var(--mexgallery-primary);
    outline-offset: 2px;
}

.mexgallery-button:focus,
.mexgallery-slider__nav:focus,
.mexgallery-lightbox__close:focus,
.mexgallery-lightbox__nav:focus,
.mexgallery-video-modal__close:focus {
    outline: 3px solid var(--mexgallery-primary);
    outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .mexgallery-item__image,
    .mexgallery-item__overlay,
    .mexgallery-item__play-icon,
    .mexgallery-button,
    .mexgallery-slider__track,
    .mexgallery-slider__nav,
    .mexgallery-slider__dot,
    .mexgallery-lightbox,
    .mexgallery-lightbox__image,
    .mexgallery-video-modal {
        transition: none;
    }
}
