/**
 * Category Gallery Elementor - Styles
 */

/* Gallery Grid */
.cge-gallery-wrapper {
    width: 100%;
    margin: 0 auto;
}

.cge-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    padding: 20px 0;
}

.cge-gallery-wrapper[data-columns="1"] .cge-gallery-grid {
    grid-template-columns: 1fr;
}

.cge-gallery-wrapper[data-columns="2"] .cge-gallery-grid {
    grid-template-columns: repeat(2, 1fr);
}

.cge-gallery-wrapper[data-columns="3"] .cge-gallery-grid {
    grid-template-columns: repeat(3, 1fr);
}

.cge-gallery-wrapper[data-columns="4"] .cge-gallery-grid {
    grid-template-columns: repeat(4, 1fr);
}

.cge-gallery-wrapper[data-columns="6"] .cge-gallery-grid {
    grid-template-columns: repeat(6, 1fr);
}

/* Card Styles */
.cge-card {
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.cge-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.cge-card-image {
    width: 100%;
    height: 250px;
    overflow: hidden;
    position: relative;
}

.cge-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.cge-card:hover .cge-card-image img {
    transform: scale(1.05);
}

.cge-card-title {
    color: #0066cc;
    font-size: 18px;
    font-weight: 600;
    margin: 15px 20px;
    text-align: center;
    line-height: 1.4;
}

/* Popup Modal */
.cge-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    animation: fadeIn 0.3s ease;
}

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

.cge-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.cge-popup-content {
    position: relative;
    background: #ffffff;
    border-radius: 12px;
    max-width: 95%;
    max-height: 95vh;
    width: 1200px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
    overflow: hidden;
}

.cge-popup-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease, transform 0.3s ease;
    color: #333;
}

.cge-popup-close:hover {
    background: #ffffff;
    transform: rotate(90deg);
}

.cge-popup-header {
    padding: 30px 30px 20px;
    border-bottom: 1px solid #e0e0e0;
}

.cge-popup-title {
    color: #0066cc;
    font-size: 24px;
    font-weight: 600;
    margin: 0;
    text-align: center;
}

.cge-popup-body {
    padding: 0;
    overflow: hidden;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.cge-popup-loading {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 16px;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Main Image Display */
.cge-popup-main-image {
    width: 100%;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    position: relative;
    min-height: 400px;
    max-height: 60vh;
    overflow: hidden;
}

.cge-popup-main-image img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.cge-popup-main-image-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: #333;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.cge-popup-main-image-nav:hover {
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transform: translateY(-50%) scale(1.1);
}

.cge-popup-main-image-nav.prev {
    left: 20px;
}

.cge-popup-main-image-nav.next {
    right: 20px;
}

.cge-popup-main-image-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Thumbnail Slider */
.cge-popup-thumbnails {
    padding: 20px;
    background: #ffffff;
    border-top: 1px solid #e0e0e0;
    overflow: hidden;
}

.cge-popup-thumbnails-wrapper {
    position: relative;
    overflow: hidden;
}

.cge-popup-thumbnails-slider {
    display: flex;
    gap: 10px;
    transition: transform 0.3s ease;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
    padding-bottom: 5px;
}

.cge-popup-thumbnails-slider::-webkit-scrollbar {
    height: 6px;
}

.cge-popup-thumbnails-slider::-webkit-scrollbar-track {
    background: transparent;
}

.cge-popup-thumbnails-slider::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.cge-popup-thumbnails-slider::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.cge-popup-thumbnail-item {
    flex: 0 0 auto;
    width: 100px;
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.3s ease;
    position: relative;
}

.cge-popup-thumbnail-item:hover {
    border-color: #0066cc;
    transform: scale(1.05);
}

.cge-popup-thumbnail-item.active {
    border-color: #0066cc;
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.2);
}

.cge-popup-thumbnail-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cge-popup-thumbnails-nav {
    display: none; /* Hide thumbnail navigation arrows */
}

/* Responsive */
@media (max-width: 1024px) {
    .cge-popup-content {
        width: 95%;
        max-width: 95%;
    }
    
    .cge-popup-main-image {
        min-height: 350px;
        max-height: 50vh;
    }
    
    .cge-popup-main-image-nav {
        width: 45px;
        height: 45px;
        font-size: 20px;
    }
    
    .cge-popup-main-image-nav.prev {
        left: 10px;
    }
    
    .cge-popup-main-image-nav.next {
        right: 10px;
    }
}

@media (max-width: 768px) {
    .cge-gallery-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 20px;
    }
    
    .cge-gallery-wrapper[data-columns="3"] .cge-gallery-grid,
    .cge-gallery-wrapper[data-columns="4"] .cge-gallery-grid,
    .cge-gallery-wrapper[data-columns="6"] .cge-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .cge-popup-content {
        max-width: 98%;
        width: 100%;
        max-height: 98vh;
        border-radius: 8px;
    }
    
    .cge-popup-header {
        padding: 15px 15px 10px;
    }
    
    .cge-popup-title {
        font-size: 18px;
    }
    
    .cge-popup-main-image {
        min-height: 300px;
        max-height: 45vh;
    }
    
    .cge-popup-main-image-nav {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
    
    .cge-popup-main-image-nav.prev {
        left: 5px;
    }
    
    .cge-popup-main-image-nav.next {
        right: 5px;
    }
    
    .cge-popup-thumbnails {
        padding: 15px 10px;
    }
    
    .cge-popup-thumbnail-item {
        width: 80px;
        height: 80px;
    }
    
    .cge-popup-thumbnails-nav {
        width: 30px;
        height: 30px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .cge-gallery-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .cge-popup-content {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .cge-popup-header {
        padding: 12px 12px 8px;
    }
    
    .cge-popup-title {
        font-size: 16px;
    }
    
    .cge-popup-close {
        width: 35px;
        height: 35px;
        font-size: 20px;
        top: 10px;
        right: 10px;
    }
    
    .cge-popup-main-image {
        min-height: 250px;
        max-height: 40vh;
    }
    
    .cge-popup-main-image-nav {
        width: 35px;
        height: 35px;
        font-size: 16px;
    }
    
    .cge-popup-thumbnails {
        padding: 12px 5px;
    }
    
    .cge-popup-thumbnail-item {
        width: 70px;
        height: 70px;
    }
    
    .cge-popup-thumbnails-nav {
        display: none; /* Hide nav arrows on very small screens, use swipe instead */
    }
    
    /* Better touch targets on mobile */
    .cge-popup-main-image-nav {
        width: 44px;
        height: 44px;
    }
    
    .cge-popup-thumbnail-item {
        min-width: 70px;
        min-height: 70px;
    }
}

/* Landscape mobile orientation */
@media (max-width: 768px) and (orientation: landscape) {
    .cge-popup-main-image {
        max-height: 50vh;
        min-height: 300px;
    }
    
    .cge-popup-thumbnails {
        padding: 10px;
    }
    
    .cge-popup-thumbnail-item {
        width: 60px;
        height: 60px;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

