/**
 * Swipeable Image Gallery Styles
 * Modern, touch-friendly image carousel
 * Version: 1.0.0
 * Date: 2026-01-03
 */

/* ============================================
   GALLERY CONTAINER
   ============================================ */
.image-gallery {
    width: 100%;
    max-width: 100%;
    position: relative;
    background: var(--romb-bg-gray, #F7F7F7);
    border-radius: var(--radius-lg, 16px);
    overflow: hidden;
}

/* ============================================
   MAIN GALLERY
   ============================================ */
.gallery-main {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    background: var(--romb-black, #222);
    overflow: hidden;
}

@media (min-width: 768px) {
    .gallery-main {
        aspect-ratio: 16 / 9;
    }
}

.gallery-slides {
    width: 100%;
    height: 100%;
    position: relative;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
}

.gallery-slides:active {
    cursor: grabbing;
}

.gallery-slide {
    width: 100%;
    height: 100%;
    display: none;
    position: relative;
}

.gallery-slide.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.gallery-slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background: var(--romb-black, #222);
}

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

/* ============================================
   NAVIGATION BUTTONS
   ============================================ */
.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.gallery-nav:hover {
    background: white;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.gallery-nav:active {
    transform: translateY(-50%) scale(0.95);
}

.gallery-nav:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.gallery-prev {
    left: 12px;
}

.gallery-next {
    right: 12px;
}

.gallery-nav i {
    font-size: 18px;
    color: var(--romb-black, #222);
}

/* Hide navigation buttons on very small screens */
@media (max-width: 480px) {
    .gallery-nav {
        width: 36px;
        height: 36px;
    }

    .gallery-nav i {
        font-size: 16px;
    }
}

/* ============================================
   IMAGE COUNTER
   ============================================ */
.gallery-counter {
    position: absolute;
    bottom: 16px;
    right: 16px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 6px 12px;
    border-radius: var(--radius-full, 9999px);
    font-size: 14px;
    font-weight: 600;
    z-index: 10;
    pointer-events: none;
}

@media (max-width: 480px) {
    .gallery-counter {
        bottom: 12px;
        right: 12px;
        font-size: 12px;
        padding: 4px 10px;
    }
}

/* ============================================
   THUMBNAILS
   ============================================ */
.gallery-thumbnails {
    display: flex;
    gap: 8px;
    padding: 12px;
    background: var(--romb-white, #fff);
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--romb-light-gray, #ddd) transparent;
}

.gallery-thumbnails::-webkit-scrollbar {
    height: 4px;
}

.gallery-thumbnails::-webkit-scrollbar-track {
    background: transparent;
}

.gallery-thumbnails::-webkit-scrollbar-thumb {
    background: var(--romb-light-gray, #ddd);
    border-radius: 2px;
}

.gallery-thumbnail {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: var(--radius-sm, 8px);
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
    background: var(--romb-bg-gray, #f7f7f7);
}

.gallery-thumbnail:hover {
    border-color: var(--romb-gray, #767676);
}

.gallery-thumbnail.active {
    border-color: var(--romb-primary, #FF385C);
    box-shadow: 0 0 0 1px var(--romb-primary, #FF385C);
}

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

@media (max-width: 480px) {
    .gallery-thumbnail {
        width: 60px;
        height: 60px;
    }

    .gallery-thumbnails {
        gap: 6px;
        padding: 8px;
    }
}

/* ============================================
   FULLSCREEN MODE (Optional Enhancement)
   ============================================ */
.gallery-fullscreen-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10;
}

.gallery-fullscreen-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

.gallery-fullscreen-btn i {
    font-size: 16px;
}

/* ============================================
   LOADING STATE
   ============================================ */
.gallery-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--romb-primary, #FF385C);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    z-index: 5;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* ============================================
   ZOOM MODE (Optional Enhancement)
   ============================================ */
.gallery-slide.zoom {
    cursor: zoom-out;
}

.gallery-slide.zoom img {
    object-fit: cover;
    transform: scale(1.5);
    cursor: move;
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
.gallery-nav:focus {
    outline: 2px solid var(--romb-primary, #FF385C);
    outline-offset: 2px;
}

.gallery-thumbnail:focus {
    outline: 2px solid var(--romb-primary, #FF385C);
    outline-offset: 2px;
    border-color: var(--romb-primary, #FF385C);
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ============================================
   MOBILE ENHANCEMENTS
   ============================================ */
@media (max-width: 767px) {
    /* Larger touch area for mobile */
    .gallery-nav {
        width: 48px;
        height: 48px;
    }

    /* Hide thumbnails on very small screens (optional) */
    @media (max-width: 360px) {
        .gallery-thumbnails {
            display: none;
        }
    }

    /* Swipe indicator (optional) */
    .gallery-swipe-hint {
        position: absolute;
        bottom: 60px;
        left: 50%;
        transform: translateX(-50%);
        background: rgba(0, 0, 0, 0.7);
        color: white;
        padding: 8px 16px;
        border-radius: var(--radius-full, 9999px);
        font-size: 12px;
        z-index: 10;
        animation: fadeOut 3s forwards;
        pointer-events: none;
    }

    @keyframes fadeOut {
        0%, 70% {
            opacity: 1;
        }
        100% {
            opacity: 0;
        }
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .gallery-nav,
    .gallery-counter,
    .gallery-thumbnails,
    .gallery-fullscreen-btn {
        display: none;
    }

    .gallery-slide {
        display: block !important;
        page-break-inside: avoid;
    }

    .gallery-slide img {
        max-width: 100%;
        height: auto;
    }
}
