/**
 * MEDUP Product Gallery - Frontend Styles
 * Version: 3.0.0
 */

/* ============================================
   Reset & Box Sizing
   ============================================ */

.medup-gallery *,
.medup-gallery *::before,
.medup-gallery *::after {
    box-sizing: border-box;
}

/* ============================================
   Main Gallery Container
   ============================================ */

.medup-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    width: 100%;
    margin-top: 20px;
}

/* ============================================
   Gallery Main Image / Container
   ============================================ */

.medup-gallery-figure {
    margin: 0;
    padding: 0;
    display: block;
    height: auto;
    align-items: normal;
    justify-content: normal;
}

.medup-gallery-main {
    width: 100%;
    overflow: hidden;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
}

#medup-main-image {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    cursor: pointer;
    background: #f9f9f9;
}

/* ============================================
   Thumbnails Container
   ============================================ */

.medup-gallery-thumbs {
    display: flex;
    flex-direction: row-reverse;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
    user-select: none;
}

/* ============================================
   Individual Thumbnails
   ============================================ */

.medup-thumb {
    width: 78px;
    height: 78px;
    overflow: hidden;
    cursor: pointer;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    transition: border-color 0.2s ease, transform 0.2s ease;
    flex-shrink: 0;
}

.medup-thumb:hover {
    border-color: #2271b1;
    transform: scale(1.05);
}

.medup-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ============================================
   Active Thumbnail
   ============================================ */

.medup-thumb.active {
    border-color: #2271b1;
    box-shadow: 0 0 0 2px #2271b1;
}

/* ============================================
   "More" Thumbnail (Overlay)
   ============================================ */

.medup-thumb.more {
    position: relative;
    overflow: hidden;
}

.medup-thumb.more:hover {
    transform: scale(1.05);
}

.medup-more-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.6;
    text-align: center;
    transition: background 0.2s ease;
}

.medup-thumb.more:hover .medup-more-overlay {
    background: rgba(0, 0, 0, 0.7);
}

/* ============================================
   RTL Support (راست‌نویسی)
   ============================================ */

.rtl .medup-gallery-thumbs {
    flex-direction: row;
}

/* ============================================
   Responsive: Mobile & Tablet
   ============================================ */

@media (max-width: 768px) {
    .medup-thumb {
        width: 60px;
        height: 60px;
    }

    .medup-gallery {
        gap: 8px;
        margin-top: 15px;
    }
}

@media (max-width: 480px) {
    .medup-thumb {
        width: 50px;
        height: 50px;
    }

    .medup-gallery-thumbs {
        gap: 6px;
    }

    .medup-gallery {
        gap: 6px;
        margin-top: 10px;
    }

    .medup-more-overlay {
        font-size: 11px;
    }
}

/* ============================================
   Accessibility: Reduced Motion
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    .medup-thumb,
    .medup-thumb.more,
    .medup-more-overlay {
        transition: none;
    }

    .medup-thumb:hover {
        transform: none;
    }
}