/* ================================================================
 * Gallery Plugin - Widget Styles
 * 
 * CSS cho các gallery widgets: slider, carousel, grid
 * YouTube Popup dùng chung cho tất cả widget types
 * Plugin: Gallery | Version: 1.0.0
 * ================================================================ */

/* ----------------------------------------------------------------
 * SHARED STYLES - Dùng chung cho tất cả widget types
 * ---------------------------------------------------------------- */

.gallery-widget .gallery-youtube {
    cursor: pointer;
}

.gallery-widget .gallery-play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    transition: transform 0.3s, color 0.3s, opacity 0.3s;
}

/* ----------------------------------------------------------------
 * SLIDER STYLES
 * ---------------------------------------------------------------- */

.gallery-slider .gallery-swiper {
    width: 100%;
    position: relative;
}

.gallery-slider .gallery-item {
    display: block;
    width: 100%;
    position: relative;
}

.gallery-slider .gallery-item img {
    width: 100%;
    height: auto;
    display: block;
}

.gallery-slider .gallery-play-overlay {
    font-size: 64px;
}

.gallery-slider .gallery-youtube:hover .gallery-play-overlay {
    transform: translate(-50%, -50%) scale(1.1);
    color: #ff0000;
}

/* ----------------------------------------------------------------
 * CAROUSEL STYLES
 * ---------------------------------------------------------------- */

.gallery-carousel {
    overflow: hidden;
}

.gallery-carousel .gallery-carousel-swiper {
    width: 100%;
}

.gallery-carousel .swiper-slide {
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-carousel .gallery-item {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    position: relative;
}

.gallery-carousel .gallery-item img {
    max-width: 100%;
    max-height: 80px;
    object-fit: contain;
    filter: grayscale(100%);
    opacity: 0.7;
    transition: all 0.3s;
}

.gallery-carousel .gallery-item:hover img {
    filter: grayscale(0%);
    opacity: 1;
}

.gallery-carousel .gallery-play-overlay {
    font-size: 32px;
    opacity: 0;
}

.gallery-carousel .gallery-youtube:hover .gallery-play-overlay {
    opacity: 1;
}

/* ----------------------------------------------------------------
 * GRID STYLES - Dùng CSS Custom Properties cho responsive columns
 * ---------------------------------------------------------------- */

.gallery-grid .gallery-grid-container {
    display: grid;
    grid-template-columns: repeat(var(--grid-cols-desktop, 4), 1fr);
    gap: 16px;
}

@media (max-width: 992px) {
    .gallery-grid .gallery-grid-container {
        grid-template-columns: repeat(var(--grid-cols-tablet, 3), 1fr);
    }
}

@media (max-width: 576px) {
    .gallery-grid .gallery-grid-container {
        grid-template-columns: repeat(var(--grid-cols-mobile, 2), 1fr);
        gap: 8px;
    }
}

.gallery-grid .gallery-item {
    display: block;
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    background: #f8f9fa;
}

.gallery-grid .gallery-item img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s;
}

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

.gallery-grid .gallery-play-overlay {
    font-size: 48px;
}

.gallery-grid .gallery-youtube:hover .gallery-play-overlay {
    transform: translate(-50%, -50%) scale(1.1);
    color: #ff0000;
}

.gallery-grid .gallery-item-title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px 12px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    color: #fff;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s;
}

.gallery-grid .gallery-item:hover .gallery-item-title {
    opacity: 1;
}

/* ----------------------------------------------------------------
 * SIMPLE STYLES - Danh sách ảnh cơ bản
 * ---------------------------------------------------------------- */

.gallery-simple .gallery-simple-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.gallery-simple .gallery-item {
    display: block;
    position: relative;
    text-decoration: none;
}

.gallery-simple .gallery-image-wrapper {
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.gallery-simple .gallery-item:hover .gallery-image-wrapper {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
}

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

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

.gallery-simple .gallery-item-title {
    margin-top: 8px;
    font-weight: 500;
    color: #333;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gallery-simple .gallery-play-overlay {
    font-size: 40px;
}

.gallery-simple .gallery-youtube:hover .gallery-play-overlay {
    transform: translate(-50%, -50%) scale(1.1);
    color: #ff0000;
}

/* ----------------------------------------------------------------
 * YOUTUBE POPUP - Dùng chung cho tất cả widget types
 * ---------------------------------------------------------------- */

.gallery-youtube-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
}

.gallery-youtube-popup.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-youtube-popup .popup-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
}

.gallery-youtube-popup .popup-content {
    position: relative;
    width: 90%;
    max-width: 900px;
    z-index: 1;
}

.gallery-youtube-popup .popup-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: #fff;
    font-size: 32px;
    cursor: pointer;
}

.gallery-youtube-popup .popup-video {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
}

.gallery-youtube-popup .popup-video iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}
