/* MN Gallery Widget Styles */

/* Base Wrapper */
.mn-gallery-wrapper {
    width: 100%;
    position: relative;
}

.mn-gallery-empty {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-style: italic;
}

/* Gallery Item Base */
.mn-gallery-item {
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.mn-gallery-image {
    position: relative;
    overflow: hidden;
    display: block;
    width: 100%;
    height: 100%;
}

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

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

/* Overlay for Lightbox */
.mn-gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mn-gallery-item:hover .mn-gallery-overlay {
    opacity: 1;
}

.mn-gallery-overlay i {
    color: white;
    font-size: 24px;
}

/* Caption */
.mn-gallery-caption {
    padding: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    font-size: 14px;
    text-align: center;
}

/* ===== STANDARD GRID LAYOUT ===== */
.mn-gallery-layout-grid .mn-gallery-grid {
    display: grid;
    gap: 15px;
    margin: 0 auto;
}

.mn-gallery-layout-grid .mn-gallery-item {
    aspect-ratio: 1;
    width: 100%;
}

/* ===== JUSTIFIED LAYOUT ===== */
.mn-gallery-layout-justified .mn-gallery-justified {
    position: relative;
    width: 100%;
    margin: 0 auto;
    overflow: hidden;
}

.mn-gallery-layout-justified .mn-gallery-justified-container {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: flex-start;
}

.mn-gallery-layout-justified .mn-gallery-item {
    flex: 1 1 auto;
    height: 200px;
    min-width: 150px;
}

.mn-gallery-layout-justified .mn-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mn-slideshow-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.mn-slideshow-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.mn-slideshow-slide.active {
    opacity: 1;
}

.mn-slideshow-slide .mn-gallery-item {
    width: 100%;
    height: 100%;
}

.mn-slideshow-slide .mn-gallery-image {
    height: 100%;
}

/* Gallery Navigation Arrows */
.mn-gallery-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: background 0.3s ease;
    z-index: 10;
}

.mn-gallery-arrow:hover {
    background: rgba(0, 0, 0, 0.9);
}

.mn-gallery-prev {
    left: 20px;
}

.mn-gallery-next {
    right: 20px;
}

/* Slideshow specific arrows (backward compatibility) */
.mn-slideshow-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: background 0.3s ease;
    z-index: 10;
}

.mn-slideshow-arrow:hover {
    background: rgba(0, 0, 0, 0.9);
}

.mn-slideshow-prev {
    left: 20px;
}

.mn-slideshow-next {
    right: 20px;
}

/* Gallery Navigation Dots */
.mn-gallery-dots {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 10;
}

.mn-gallery-dots.inside {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
}

.mn-gallery-dots.outside {
    position: relative;
    display: flex;
    justify-content: left;
    margin-top: 20px;
    transform: none;
    left: auto;
}

.mn-gallery-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
}

.mn-gallery-dot.circle {
    border-radius: 50%;
}

.mn-gallery-dot.square {
    border-radius: 0;
}

.mn-gallery-dot.line {
    width: 30px;
    height: 3px;
    border-radius: 2px;
}

.mn-gallery-dot.active,
.mn-gallery-dot:hover {
    background: white;
    transform: scale(1.2);
}

.mn-gallery-dot.line.active,
.mn-gallery-dot.line:hover {
    transform: scaleX(1.2);
}

/* Slideshow Dots (backward compatibility) */
.mn-slideshow-dots {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 10;
}

.mn-slideshow-dots.inside {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
}

.mn-slideshow-dots.outside {
    position: relative;
    display: flex;
    justify-content: left;
    margin-top: 20px;
    transform: none;
}

.mn-slideshow-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
}

.mn-slideshow-dot.circle {
    border-radius: 50%;
}

.mn-slideshow-dot.square {
    border-radius: 0;
}

.mn-slideshow-dot.line {
    width: 30px;
    height: 3px;
    border-radius: 2px;
}

.mn-slideshow-dot.active,
.mn-slideshow-dot:hover {
    background: white;
    transform: scale(1.2);
}

.mn-slideshow-dot.line.active,
.mn-slideshow-dot.line:hover {
    transform: scaleX(1.2);
}

/* ===== MIXED LAYOUT (1 Big + 4 Grid) ===== */
.mn-gallery-layout-mixed .mn-gallery-mixed {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    height: 400px;
}

.mn-gallery-main {
    grid-row: 1 / 3;
}

.mn-gallery-main .mn-gallery-item {
    height: 100%;
}

.mn-gallery-grid-small {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 15px;
}

.mn-gallery-grid-small .mn-gallery-item {
    height: 100%;
}

/* ===== MASONRY LAYOUT ===== */
.mn-gallery-layout-masonry .mn-gallery-masonry {
    position: relative;
    width: 100%;
    margin: 0 auto;
    overflow: auto;
}

.mn-gallery-layout-masonry .mn-gallery-masonry-container {
    columns: 3;
    column-gap: 15px;
}

.mn-gallery-layout-masonry .mn-gallery-item {
    display: inline-block;
    width: 100%;
    margin-bottom: 15px;
    break-inside: avoid;
}

.mn-gallery-layout-masonry .mn-gallery-image {
    height: auto;
}

.mn-gallery-layout-masonry .mn-gallery-image img {
    width: 100%;
    height: auto;
    object-fit: cover;
}

/* ===== LIGHTBOX STYLES ===== */
.mn-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

.mn-lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.mn-lightbox-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
}

.mn-lightbox-caption {
    color: white;
    text-align: center;
    padding: 15px;
    font-size: 16px;
    max-width: 600px;
}

.mn-lightbox-close {
    position: absolute;
    top: -50px;
    right: -50px;
    background: none;
    border: none;
    color: white;
    font-size: 30px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mn-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: background 0.3s ease;
}

.mn-lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.3);
}

.mn-lightbox-prev {
    left: -80px;
}

.mn-lightbox-next {
    right: -80px;
}

.mn-lightbox-counter {
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 14px;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1024px) {
    .mn-gallery-layout-masonry .mn-gallery-masonry-container {
        columns: 2;
    }
    
    .mn-gallery-layout-justified .mn-gallery-item {
        height: 180px;
        min-width: 120px;
    }
    
    .mn-slideshow-arrow {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .mn-slideshow-prev {
        left: 15px;
    }
    
    .mn-slideshow-next {
        right: 15px;
    }
}

@media (max-width: 768px) {
    .mn-gallery-layout-mixed .mn-gallery-mixed {
        grid-template-columns: 1fr;
        height: auto;
    }
    
    .mn-gallery-main {
        grid-row: auto;
        height: 250px;
    }
    
    .mn-gallery-grid-small {
        grid-template-columns: 1fr 1fr;
        height: 200px;
    }
    
    .mn-gallery-layout-masonry .mn-gallery-masonry-container {
        columns: 1;
    }
    
    .mn-gallery-layout-justified .mn-gallery-item {
        height: 150px;
        min-width: 100px;
    }
    
    .mn-slideshow-arrow {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
    
    .mn-slideshow-prev {
        left: 10px;
    }
    
    .mn-slideshow-next {
        right: 10px;
    }
    
    .mn-slideshow-dots {
        bottom: 15px;
    }
    
    .mn-slideshow-dot {
        width: 10px;
        height: 10px;
    }
    
    /* Lightbox Mobile */
    .mn-lightbox-close {
        top: 20px;
        right: 20px;
    }
    
    .mn-lightbox-nav {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
    
    .mn-lightbox-prev {
        left: 20px;
    }
    
    .mn-lightbox-next {
        right: 20px;
    }
    
    .mn-lightbox-counter {
        bottom: 20px;
    }
}

@media (max-width: 480px) {
    .mn-gallery-layout-slideshow .mn-gallery-slideshow {
        height: 250px;
    }
    
    .mn-gallery-grid-small {
        grid-template-columns: 1fr;
        height: auto;
    }
    
    .mn-gallery-grid-small .mn-gallery-item {
        height: 150px;
    }
    
    .mn-slideshow-arrow {
        display: none;
    }
    
    .mn-lightbox-nav {
        display: none;
    }
}

/* ===== ANIMATION EFFECTS ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mn-gallery-item {
    animation: fadeInUp 0.6s ease-out;
}

.mn-gallery-item:nth-child(1) { animation-delay: 0.1s; }
.mn-gallery-item:nth-child(2) { animation-delay: 0.2s; }
.mn-gallery-item:nth-child(3) { animation-delay: 0.3s; }
.mn-gallery-item:nth-child(4) { animation-delay: 0.4s; }
.mn-gallery-item:nth-child(5) { animation-delay: 0.5s; }
.mn-gallery-item:nth-child(6) { animation-delay: 0.6s; }

/* Loading Animation */
.mn-gallery-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
}

.mn-gallery-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
