/**
 * Tadoch Lightbox Gallery - Layout Styles
 * CSS for different gallery layout types
 * 
 * @package Tadoch_Lightbox_Gallery
 * @since 1.1.0
 * @file assets/css/layouts.css
 */

/* ==========================================================================
   BASE LAYOUT STYLES
   ========================================================================== */

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

.tadoch-gallery-item {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.tadoch-gallery-item img {
    transition: all 0.3s ease;
    display: block;
}

/* ==========================================================================
   GRID LAYOUT (DEFAULT)
   ========================================================================== */

.layout-grid .tadoch-gallery-grid {
    display: grid;
    gap: 15px;
}

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

/* ==========================================================================
   MASONRY LAYOUT
   ========================================================================== */

.layout-masonry {
    overflow: hidden;
}

.layout-masonry .tadoch-gallery-masonry {
    column-fill: balance;
}

.layout-masonry .masonry-item {
    break-inside: avoid;
    page-break-inside: avoid;
    display: inline-block;
    width: 100%;
}

.layout-masonry .tadoch-gallery-item {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.layout-masonry .tadoch-gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.layout-masonry .tadoch-gallery-item img {
    width: 100%;
    height: auto;
    display: block;
}

/* ==========================================================================
   CAROUSEL LAYOUT
   ========================================================================== */

.layout-carousel .tadoch-gallery-carousel-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.layout-carousel .tadoch-gallery-carousel {
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 10px 0;
}

.layout-carousel .tadoch-gallery-carousel::-webkit-scrollbar {
    display: none;
}

.layout-carousel .carousel-item {
    min-width: 300px;
    max-width: 400px;
}

.layout-carousel .tadoch-gallery-item {
    border-radius: 8px;
    overflow: hidden;
    height: 250px;
}

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

.layout-carousel .carousel-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;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.layout-carousel .carousel-nav:hover {
    background: white;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.layout-carousel .carousel-prev {
    left: 15px;
}

.layout-carousel .carousel-next {
    right: 15px;
}

/* ==========================================================================
   JUSTIFIED LAYOUT
   ========================================================================== */

.layout-justified .tadoch-gallery-justified {
    align-items: flex-end;
}

.layout-justified .justified-item {
    overflow: hidden;
    border-radius: 6px;
    position: relative;
}

.layout-justified .tadoch-gallery-item {
    height: 100%;
}

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

/* ==========================================================================
   MOSAIC LAYOUT
   ========================================================================== */

.layout-mosaic .tadoch-gallery-mosaic {
    grid-auto-rows: 120px;
}

.layout-mosaic .mosaic-item {
    overflow: hidden;
    border-radius: 12px;
    position: relative;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.layout-mosaic .mosaic-item:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    z-index: 2;
}

.layout-mosaic .tadoch-gallery-item {
    height: 100%;
}

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

/* Different sizes for mosaic */
.layout-mosaic .mosaic-large {
    grid-column: span 2;
    grid-row: span 2;
}

.layout-mosaic .mosaic-wide {
    grid-column: span 2;
    grid-row: span 1;
}

.layout-mosaic .mosaic-regular {
    grid-column: span 1;
    grid-row: span 1;
}

/* ==========================================================================
   OVERLAY LAYOUT
   ========================================================================== */

.layout-overlay .tadoch-gallery-overlay {
    display: grid;
    gap: 15px;
}

.layout-overlay .overlay-item {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.layout-overlay .tadoch-gallery-item {
    height: 250px;
}

.layout-overlay .tadoch-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.3s ease;
}

.layout-overlay .image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(transparent 60%, rgba(0, 0, 0, 0.8) 100%);
    opacity: 0;
    transition: all 0.3s ease;
    display: flex;
    align-items: flex-end;
    padding: 20px;
}

.layout-overlay .overlay-item:hover .image-overlay {
    opacity: 1;
}

.layout-overlay .overlay-item:hover .tadoch-gallery-item img {
    transform: scale(1.05);
}

.layout-overlay .overlay-text {
    color: white;
    text-align: left;
}

.layout-overlay .overlay-text h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* ==========================================================================
   POLAROID LAYOUT
   ========================================================================== */

.layout-polaroid .tadoch-gallery-polaroid {
    display: grid;
    gap: 20px;
    padding: 20px;
}

.layout-polaroid .polaroid-item {
    transition: all 0.3s ease;
    transform-origin: center;
}

.layout-polaroid .polaroid-item:hover {
    transform: rotate(0deg) scale(1.05) !important;
    z-index: 10;
}

.layout-polaroid .polaroid-frame {
    background: white;
    padding: 15px 15px 45px 15px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    position: relative;
}

.layout-polaroid .tadoch-gallery-item img {
    width: 100%;
    height: auto;
    display: block;
}

.layout-polaroid .polaroid-caption {
    position: absolute;
    bottom: 10px;
    left: 15px;
    right: 15px;
    text-align: center;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

/* ==========================================================================
   MAGAZINE LAYOUT
   ========================================================================== */

.layout-magazine .tadoch-gallery-magazine {
    grid-auto-rows: 150px;
    max-width: 1200px;
    margin: 0 auto;
}

.layout-magazine .magazine-item {
    overflow: hidden;
    border-radius: 8px;
    position: relative;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.layout-magazine .magazine-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.layout-magazine .tadoch-gallery-item {
    height: 100%;
}

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

.layout-magazine .magazine-hero {
    grid-column: span 8;
    grid-row: span 2;
}

.layout-magazine .magazine-side {
    grid-column: span 4;
    grid-row: span 1;
}

.layout-magazine .magazine-bottom {
    grid-column: span 4;
    grid-row: span 1;
}

/* ==========================================================================
   FILM STRIP LAYOUT
   ========================================================================== */

.layout-film-strip .tadoch-gallery-film-strip {
    background: #222;
    padding: 20px 0;
    overflow-x: auto;
    position: relative;
}

.layout-film-strip .film-strip-container {
    position: relative;
    background: #333;
    min-height: 200px;
}

.layout-film-strip .film-perforations {
    position: absolute;
    left: 0;
    right: 0;
    height: 20px;
    background: #222;
    background-image: repeating-linear-gradient(
        90deg,
        transparent 0px,
        transparent 10px,
        #000 10px,
        #000 15px
    );
}

.layout-film-strip .film-perforations-top {
    top: 0;
}

.layout-film-strip .film-perforations-bottom {
    bottom: 0;
}

.layout-film-strip .film-images {
    display: flex;
    gap: 5px;
    padding: 25px 20px;
    overflow-x: auto;
    scroll-behavior: smooth;
}

.layout-film-strip .film-frame {
    flex: 0 0 auto;
    width: 150px;
    height: 150px;
    background: #000;
    border: 2px solid #111;
    position: relative;
}

.layout-film-strip .tadoch-gallery-item {
    width: 100%;
    height: 100%;
}

.layout-film-strip .tadoch-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: sepia(0.1) contrast(1.1);
    transition: all 0.3s ease;
}

.layout-film-strip .film-frame:hover .tadoch-gallery-item img {
    filter: none;
    transform: scale(1.05);
}

/* ==========================================================================
   CIRCLE LAYOUT
   ========================================================================== */

.layout-circle .tadoch-gallery-circle {
    display: grid;
    gap: 20px;
    padding: 20px;
}

.layout-circle .circle-item {
    display: flex;
    justify-content: center;
    align-items: center;
}

.layout-circle .circle-frame {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid white;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    position: relative;
}

.layout-circle .circle-frame:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.2);
}

.layout-circle .tadoch-gallery-item {
    width: 100%;
    height: 100%;
}

.layout-circle .tadoch-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.3s ease;
}

.layout-circle .circle-frame:hover .tadoch-gallery-item img {
    transform: scale(1.1);
}

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

@media (max-width: 768px) {
    /* Masonry responsive */
    .layout-masonry .tadoch-gallery-masonry {
        column-count: 2;
    }
    
    /* Carousel responsive */
    .layout-carousel .carousel-item {
        min-width: 250px;
        max-width: 300px;
    }
    
    .layout-carousel .carousel-nav {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
    
    /* Mosaic responsive */
    .layout-mosaic .tadoch-gallery-mosaic {
        grid-template-columns: repeat(4, 1fr);
        grid-auto-rows: 100px;
    }
    
    /* Magazine responsive */
    .layout-magazine .tadoch-gallery-magazine {
        grid-template-columns: repeat(8, 1fr);
        grid-auto-rows: 120px;
    }
    
    .layout-magazine .magazine-hero {
        grid-column: span 8;
        grid-row: span 2;
    }
    
    .layout-magazine .magazine-side,
    .layout-magazine .magazine-bottom {
        grid-column: span 4;
        grid-row: span 1;
    }
    
    /* Hexagon responsive */
    .layout-hexagon .tadoch-gallery-hexagon {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .layout-hexagon .hexagon-shape {
        width: 120px;
        height: 105px;
    }
    
    .layout-hexagon .hexagon-shape:before,
    .layout-hexagon .hexagon-shape:after {
        border-left-width: 60px;
        border-right-width: 60px;
    }
    
    .layout-hexagon .hexagon-shape:before {
        border-bottom-width: 30px;
    }
    
    .layout-hexagon .hexagon-shape:after {
        border-top-width: 30px;
    }
    
    .layout-hexagon .tadoch-gallery-item {
        width: 120px;
        height: 105px;
    }
    
    /* Circle responsive */
    .layout-circle .tadoch-gallery-circle {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .layout-circle .circle-frame {
        width: 150px;
        height: 150px;
    }
    
    /* Film strip responsive */
    .layout-film-strip .film-frame {
        width: 120px;
        height: 120px;
    }
    
    /* Polaroid responsive */
    .layout-polaroid .tadoch-gallery-polaroid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        padding: 15px;
    }
    
    .layout-polaroid .polaroid-frame {
        padding: 10px 10px 35px 10px;
    }
}

@media (max-width: 480px) {
    /* Single column for most layouts on mobile */
    .layout-masonry .tadoch-gallery-masonry {
        column-count: 1;
    }
    
    .layout-overlay .tadoch-gallery-overlay,
    .layout-polaroid .tadoch-gallery-polaroid,
    .layout-circle .tadoch-gallery-circle,
    .layout-hexagon .tadoch-gallery-hexagon {
        grid-template-columns: 1fr;
    }
    
    /* Carousel very small screens */
    .layout-carousel .carousel-item {
        min-width: 200px;
        max-width: 250px;
    }
    
    /* Mosaic single column pattern */
    .layout-mosaic .tadoch-gallery-mosaic {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .layout-mosaic .mosaic-large,
    .layout-mosaic .mosaic-wide {
        grid-column: span 2;
    }
    
    /* Magazine stacked */
    .layout-magazine .tadoch-gallery-magazine {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .layout-magazine .magazine-hero {
        grid-column: span 4;
        grid-row: span 2;
    }
    
    .layout-magazine .magazine-side,
    .layout-magazine .magazine-bottom {
        grid-column: span 2;
        grid-row: span 1;
    }
}

/* ==========================================================================
   ANIMATION ENHANCEMENTS
   ========================================================================== */

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

.layout-masonry .masonry-item,
.layout-mosaic .mosaic-item,
.layout-overlay .overlay-item {
    animation: fadeInUp 0.6s ease-out;
    animation-fill-mode: both;
}

/* Stagger animation delays */
.layout-masonry .masonry-item:nth-child(1) { animation-delay: 0.1s; }
.layout-masonry .masonry-item:nth-child(2) { animation-delay: 0.2s; }
.layout-masonry .masonry-item:nth-child(3) { animation-delay: 0.3s; }
.layout-masonry .masonry-item:nth-child(4) { animation-delay: 0.4s; }
.layout-masonry .masonry-item:nth-child(5) { animation-delay: 0.5s; }
.layout-masonry .masonry-item:nth-child(6) { animation-delay: 0.6s; }

.layout-mosaic .mosaic-item:nth-child(odd) { animation-delay: 0.1s; }
.layout-mosaic .mosaic-item:nth-child(even) { animation-delay: 0.3s; }

/* ==========================================================================
   ACCESSIBILITY ENHANCEMENTS
   ========================================================================== */

.tadoch-gallery-item {
    position: relative;
}

.tadoch-gallery-item:focus-visible {
    outline: 3px solid #3498db;
    outline-offset: 2px;
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    .tadoch-gallery-item,
    .tadoch-gallery-item img,
    .layout-polaroid .polaroid-item,
    .layout-hexagon .hexagon-shape,
    .layout-circle .circle-frame {
        transition: none;
        animation: none;
    }
    
    .layout-masonry .masonry-item,
    .layout-mosaic .mosaic-item,
    .layout-overlay .overlay-item {
        animation: none;
    }
}