/*
 * Resource Preview System Styles - RiPro Style
 * Gallery, Demo Sites, Video Player
 */

/* ===== Gallery Slider ===== */
.io-gallery-slider {
    margin-bottom: 30px;
    border-radius: var(--main-radius);
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.io-gallery-swiper {
    width: 100%;
    height: 500px;
}

.gallery-item {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
}

.gallery-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.gallery-item:hover .gallery-image {
    transform: scale(1.02);
}

.gallery-nav {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    backdrop-filter: blur(10px);
}

.gallery-counter {
    font-weight: 500;
}

.gallery-prev,
.gallery-next {
    width: 45px;
    height: 45px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    color: var(--theme-color);
    font-size: 18px;
    transition: all 0.3s ease;
}

.gallery-prev:hover,
.gallery-next:hover {
    background: var(--theme-color);
    color: #fff;
    transform: scale(1.1);
}

.gallery-pagination {
    bottom: 15px !important;
}

.gallery-pagination .swiper-pagination-bullet {
    width: 10px;
    height: 10px;
    background: rgba(255, 255, 255, 0.7);
    opacity: 1;
    transition: all 0.3s ease;
}

.gallery-pagination .swiper-pagination-bullet-active {
    background: var(--theme-color);
    width: 24px;
    border-radius: 5px;
}

/* Gallery Thumbnails */
.gallery-thumbs {
    padding: 15px;
    background: #fff;
    border-top: 1px solid #eee;
}

.gallery-thumbs-swiper {
    height: 80px;
}

.gallery-thumb-item {
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    opacity: 0.6;
}

.gallery-thumb-item.swiper-slide-thumb-active {
    border-color: var(--theme-color);
    opacity: 1;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(var(--theme-color-rgb), 0.3);
}

.gallery-thumb-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ===== Gallery Grid ===== */
.io-gallery-grid {
    margin-bottom: 30px;
}

.gallery-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
}

.gallery-grid-item {
    position: relative;
    aspect-ratio: 16/10;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    background: #f5f5f5;
}

.gallery-grid-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.gallery-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-overlay i {
    color: #fff;
    font-size: 32px;
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.gallery-grid-item:hover .gallery-grid-image {
    transform: scale(1.1);
}

.gallery-grid-item:hover .gallery-overlay {
    opacity: 1;
}

.gallery-grid-item:hover .gallery-overlay i {
    transform: scale(1);
}

/* ===== Demo Button ===== */
.io-demo-button-wrapper {
    margin: 20px 0;
}

.btn-demo {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    padding: 12px 28px;
    border-radius: 25px;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-demo:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
    color: #fff;
}

.btn-demo i {
    font-size: 16px;
}

.demo-screenshot-preview {
    margin-top: 15px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.demo-screenshot-preview img {
    width: 100%;
    height: auto;
    display: block;
}

/* ===== Demo Modal ===== */
.io-demo-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.io-demo-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
}

.io-demo-container {
    position: relative;
    width: 90%;
    max-width: 1400px;
    height: 85vh;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.io-demo-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.io-demo-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.io-demo-actions {
    display: flex;
    gap: 10px;
}

.io-demo-actions .btn {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.io-demo-actions .btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.btn-close-demo {
    background: rgba(255, 77, 79, 0.8) !important;
}

.btn-close-demo:hover {
    background: #ff4d4f !important;
}

.io-demo-body {
    flex: 1;
    position: relative;
    background: #f5f5f5;
    overflow: hidden;
}

.io-demo-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    z-index: 10;
    transition: opacity 0.3s ease;
}

.io-demo-loading.hidden {
    opacity: 0;
    pointer-events: none;
}

#demo-iframe {
    width: 100%;
    height: 100%;
    border: none;
    transition: width 0.3s ease;
}

.io-demo-footer {
    padding: 12px 20px;
    background: #fff;
    border-top: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.demo-info {
    color: #666;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.demo-device-switcher {
    display: flex;
    gap: 8px;
}

.device-btn {
    background: #f5f5f5;
    border: 2px solid transparent;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.device-btn:hover {
    background: #e8e8e8;
}

.device-btn.active {
    background: var(--theme-color-bg);
    border-color: var(--theme-color);
    color: var(--theme-color);
}

/* Device Sizes */
.io-demo-container[data-device="tablet"] #demo-iframe {
    width: 768px;
    margin: 0 auto;
}

.io-demo-container[data-device="mobile"] #demo-iframe {
    width: 375px;
    margin: 0 auto;
}

/* ===== Video Player ===== */
.io-video-player-wrapper {
    margin: 20px 0;
}

.io-video-container {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    background: #000;
}

.video-js {
    width: 100%;
    height: 500px;
    border-radius: 12px;
}

.video-duration-badge {
    position: absolute;
    bottom: 60px;
    right: 15px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    gap: 6px;
}

.io-video-external {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #f5f5f5;
}

.btn-video-external {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 15px 30px;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-video-external:hover {
    background: var(--theme-color);
    transform: translate(-50%, -50%) scale(1.05);
    color: #fff;
}

.video-cover-image {
    width: 100%;
    height: auto;
    display: block;
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    .io-gallery-swiper {
        height: 300px;
    }
    
    .gallery-thumbs-swiper {
        height: 60px;
    }
    
    .gallery-grid-container {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }
    
    .io-demo-container {
        width: 95%;
        height: 90vh;
    }
    
    .video-js {
        height: 300px;
    }
    
    .device-btn span {
        display: none;
    }
}

@media (max-width: 480px) {
    .io-gallery-swiper {
        height: 250px;
    }
    
    .gallery-prev,
    .gallery-next {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
    
    .btn-demo {
        width: 100%;
        justify-content: center;
    }
}
