/**
 * Tadoch Lightbox Gallery - Frontend Styles
 * Main lightbox and gallery styling for the frontend
 * 
 * @package Tadoch_Lightbox_Gallery
 * @since 1.0.0
 * @file assets/css/frontend.css
 */

/* ==========================================================================
   LIGHTBOX OVERLAY AND CONTAINER
   ========================================================================== */

.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    display: none;
}

.lightbox-overlay.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

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

.lightbox-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    display: block;
    margin: 0 auto;
}

/* ==========================================================================
   LIGHTBOX CONTROLS - ENHANCED WITH ARROW POSITIONING MODES
   ========================================================================== */

.lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    color: white;
    font-size: 30px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10000;
    background: none;
    border: none;
    padding: 0;
    line-height: 1;
    transition: color 0.3s ease;
}

.lightbox-close:hover {
    color: #ccc;
}

/* DEFAULT ARROW POSITIONING - Relative to Image (arrows-image class) */
.lightbox-overlay.arrows-image .lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    font-size: 24px;
    padding: 10px 15px;
    cursor: pointer;
    border-radius: 4px;
    z-index: 10000;
    transition: background 0.3s ease;
}

.lightbox-overlay.arrows-image .lightbox-nav:hover {
    background: rgba(0, 0, 0, 0.7);
}

.lightbox-overlay.arrows-image .lightbox-prev {
    left: 20px;
}

.lightbox-overlay.arrows-image .lightbox-next {
    right: 20px;
}

/* NEW ARROW POSITIONING - Fixed to Viewport Edges (arrows-viewport class) */
.lightbox-overlay.arrows-viewport .lightbox-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    font-size: 28px;
    padding: 15px 20px;
    cursor: pointer;
    border-radius: 8px;
    z-index: 10001;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.lightbox-overlay.arrows-viewport .lightbox-nav:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.lightbox-overlay.arrows-viewport .lightbox-prev {
    left: 30px; /* Further from edge for better UX */
}

.lightbox-overlay.arrows-viewport .lightbox-next {
    right: 30px; /* Further from edge for better UX */
}

/* Fallback for browsers without explicit class (default to image mode) */
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    font-size: 24px;
    padding: 10px 15px;
    cursor: pointer;
    border-radius: 4px;
    z-index: 10000;
    transition: background 0.3s ease;
}

.lightbox-nav:hover {
    background: rgba(0, 0, 0, 0.7);
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

/* ==========================================================================
   BODY SCROLL PREVENTION
   ========================================================================== */

body.lightbox-open {
    overflow: hidden;
}

/* ==========================================================================
   CUSTOM GALLERY STYLES
   ========================================================================== */

.tadoch-custom-gallery {
    margin: 20px 0;
}

.tadoch-gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    align-items: center;
    display: flex;
    flex-direction: row;
}

.tadoch-gallery-item:has(.tadoch-gallery-caption) {
    flex-direction: column;
}


.tadoch-gallery-item img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

.tadoch-gallery-caption {
    margin: 8px 0 0 0;
    padding: 0;
    font-size: 14px;
    color: #666;
    text-align: center;
    line-height: 1.4;
}

/* ==========================================================================
   HOVER EFFECTS
   ========================================================================== */

.tadoch-custom-gallery.hover-zoom img {
    transition: transform 0.3s ease;
}

.tadoch-custom-gallery.hover-zoom img:hover {
    transform: scale(1.05);
}

.tadoch-custom-gallery.hover-fade img {
    transition: opacity 0.3s ease;
}

.tadoch-custom-gallery.hover-fade img:hover {
    opacity: 0.8;
}

.tadoch-custom-gallery.hover-none img:hover {
    transform: none;
    opacity: 1;
}

/* ==========================================================================
   SPACING VARIATIONS
   ========================================================================== */

.tadoch-custom-gallery.spacing-tight {
    gap: 5px;
}

.tadoch-custom-gallery.spacing-normal {
    gap: 15px;
}

.tadoch-custom-gallery.spacing-loose {
    gap: 25px;
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */

@media (max-width: 768px) {
    .lightbox-nav {
        font-size: 20px;
        padding: 8px 12px;
    }
    
    .lightbox-prev {
        left: 10px;
    }
    
    .lightbox-next {
        right: 10px;
    }
    
    .lightbox-container {
        max-width: 95%;
        max-height: 95%;
    }
    
    .lightbox-close {
        top: -35px;
        font-size: 24px;
    }
    
    .lightbox-counter {
        bottom: -35px;
        font-size: 12px;
    }
    
    /* Responsive galleries */
    .tadoch-custom-gallery {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) !important;
    }
}

@media (max-width: 480px) {
    .lightbox-nav {
        font-size: 18px;
        padding: 6px 10px;
    }
    
    /* Mobile galleries - always 2 columns max */
    .tadoch-custom-gallery {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) !important;
    }
}