/**
 * Enhanced Gallery Styles
 * Grid, List, Compact, and Masonry view modes
 * Lightbox with thumbnails
 */

/* ============================================
   GALLERY CONTROLS
   ============================================ */

.gallery-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 30px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Search */
.gallery-search {
    flex: 1 1 300px;
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 12px;
    width: 20px;
    height: 20px;
    color: #9ca3af;
    pointer-events: none;
}

.gallery-search-input {
    width: 100%;
    padding: 12px 12px 12px 44px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.gallery-search-input:focus {
    outline: none;
    border-color: #D4A574;
    box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.1);
}

.search-results-count {
    position: absolute;
    right: 12px;
    font-size: 12px;
    color: #6b7280;
}

/* Category Filters */
.gallery-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 2 1 400px;
}

.gallery-tags {
    margin-top: 8px;
}

.filter-btn {
    padding: 8px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    background: white;
    color: #4b5563;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-btn:hover {
    border-color: #D4A574;
    color: #D4A574;
}

.filter-btn.active {
    background: #D4A574;
    border-color: #D4A574;
    color: white;
}

.filter-btn .count {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.filter-btn.active .count {
    background: rgba(255,255,255,0.3);
    color: white;
}

/* View Switcher */
.view-switcher {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: #f3f4f6;
    border-radius: 8px;
}

.view-btn {
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: #6b7280;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.view-btn svg {
    width: 20px;
    height: 20px;
}

.view-btn:hover {
    color: #D4A574;
}

.view-btn.active {
    background: white;
    color: #2D5A3D;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* ============================================
   GALLERY VIEWS
   ============================================ */

.ekovac-gallery {
    display: grid;
    gap: 16px;
}

/* Grid View (Default) - 4 columns */
.view-grid {
    grid-template-columns: repeat(4, 1fr);
}

.view-grid .gallery-item {
    aspect-ratio: 1;
}

/* List View - Full width rows */
.view-list {
    grid-template-columns: 1fr;
    gap: 12px;
}

.view-list .gallery-item {
    display: flex;
    gap: 20px;
    padding: 16px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    text-align: left;
}

.view-list .gallery-image-wrapper {
    width: 200px;
    height: 150px;
    flex-shrink: 0;
    border-radius: 8px;
}

.view-list .gallery-item-info {
    flex: 1;
}

.view-list .gallery-item-info h4 {
    font-size: 18px;
    font-weight: 600;
    color: #2D3142;
    margin: 0 0 8px 0;
}

.view-list .gallery-item-info p {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
}

/* Compact View - 6 columns */
.view-compact {
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
}

.view-compact .gallery-item {
    aspect-ratio: 1;
}

.view-compact .gallery-overlay {
    opacity: 1;
    background: rgba(0,0,0,0.3);
}

.view-compact .zoom-icon {
    width: 24px;
    height: 24px;
}

.view-compact .view-text {
    display: none;
}

/* Masonry View */
.view-masonry {
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 10px;
}

.view-masonry .gallery-item:nth-child(4n+1) { grid-row: span 15; }
.view-masonry .gallery-item:nth-child(4n+2) { grid-row: span 12; }
.view-masonry .gallery-item:nth-child(4n+3) { grid-row: span 18; }
.view-masonry .gallery-item:nth-child(4n+4) { grid-row: span 14; }

.view-masonry .gallery-image-wrapper {
    height: 100%;
}

/* ============================================
   GALLERY ITEMS
   ============================================ */

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    background: #f3f4f6;
    cursor: pointer;
    border: none;
    padding: 0;
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
}

.gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

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

.gallery-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

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

.gallery-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
    color: white;
}

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

.zoom-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 8px;
}

.view-text {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Lazy load state */
.gallery-item.lazy-load .gallery-image {
    filter: blur(10px);
    transform: scale(1.1);
}

/* ============================================
   GALLERY PLACEHOLDER (no featured image)
   ============================================ */

.gallery-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 4/3;
    background: linear-gradient(135deg, #e8f5e9 0%, #f3e5f5 100%);
    padding: 1.5rem;
    gap: 0.75rem;
    text-align: center;
}

.gallery-placeholder[data-category="matematika-i-logika"] {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
}

.gallery-placeholder[data-category="jezici"] {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
}

.gallery-placeholder[data-category="kreativne-radionice"] {
    background: linear-gradient(135deg, #fce4ec 0%, #f8bbd0 100%);
}

.gallery-placeholder[data-category="stem-i-robotika"] {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
}

.gallery-placeholder .placeholder-icon {
    width: 2.5rem;
    height: 2.5rem;
    color: #9e9e9e;
    flex-shrink: 0;
}

.gallery-placeholder .placeholder-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #4a4a4a;
    line-height: 1.3;
    max-width: 12ch;
}

.gallery-item--no-image {
    cursor: default;
}

.gallery-item--no-image .gallery-item-info {
    display: block !important;
}

.gallery-item--no-image .gallery-item-info h4 {
    font-size: 0.95rem;
    font-weight: 700;
    color: #2D3142;
}

.gallery-item--no-image .gallery-item-info p {
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

/* ============================================
   LOAD MORE & NO RESULTS
   ============================================ */

.load-more-wrapper {
    text-align: center;
    margin-top: 40px;
}

.load-more-btn {
    padding: 12px 32px;
    background: #2D5A3D;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.load-more-btn:hover {
    background: #234830;
}

.load-more-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.no-results,
.no-images {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
}

.clear-filters-btn {
    margin-top: 20px;
    padding: 10px 24px;
    background: #D4A574;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

/* ============================================
   ENHANCED LIGHTBOX
   ============================================ */

.lightbox-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: rgba(0,0,0,0.5);
    color: white;
}

.lightbox-info {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 14px;
}

.image-title {
    font-weight: 600;
}

.image-category {
    padding: 4px 12px;
    background: rgba(255,255,255,0.2);
    border-radius: 20px;
    font-size: 12px;
}

.lightbox-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    padding: 10px;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: background 0.2s;
}

.action-btn:hover {
    background: rgba(255,255,255,0.2);
}

.action-btn svg {
    width: 20px;
    height: 20px;
}

.action-btn.close-btn:hover {
    background: #dc2626;
}

.lightbox-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    padding: 0 80px;
}

.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    padding: 16px;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10;
}

.nav-btn:hover:not(.disabled) {
    background: rgba(255,255,255,0.3);
}

.nav-btn.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.nav-btn.prev { left: 20px; }
.nav-btn.next { right: 20px; }

.nav-btn svg {
    width: 24px;
    height: 24px;
}

.lightbox-image-container {
    max-width: 100%;
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: zoom-in;
}

.lightbox-image-container.zoomed {
    cursor: zoom-out;
    overflow: auto;
}

.lightbox-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    transition: transform 0.3s;
}

.lightbox-thumbnails {
    display: flex;
    gap: 8px;
    padding: 16px 24px;
    background: rgba(0,0,0,0.5);
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.3) transparent;
}

.lightbox-thumbnails::-webkit-scrollbar {
    height: 6px;
}

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

.lightbox-thumbnails::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 3px;
}

.thumb-btn {
    flex-shrink: 0;
    width: 80px;
    height: 60px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.2s;
}

.thumb-btn:hover {
    opacity: 0.9;
}

.thumb-btn.active {
    border-color: #D4A574;
    opacity: 1;
}

.thumb-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

@media (max-width: 1200px) {
    .view-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .view-masonry {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .view-compact {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .gallery-controls {
        flex-direction: column;
    }
    
    .view-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .view-masonry {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .view-compact {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .view-list .gallery-image-wrapper {
        width: 120px;
        height: 90px;
    }
    
    .lightbox-main {
        padding: 0 60px;
    }
    
    .nav-btn {
        padding: 12px;
    }
    
    .lightbox-thumbnails {
        padding: 12px 16px;
    }
    
    .thumb-btn {
        width: 60px;
        height: 45px;
    }
}

/* Full-width gallery page */
.gallery-page--full .gallery-page__inner {
    width: 100%;
    max-width: min(100%, 1600px);
    margin: 0 auto;
    padding-left: clamp(16px, 3vw, 40px);
    padding-right: clamp(16px, 3vw, 40px);
}

.gallery-pagination {
    margin-top: 2rem;
}

.gallery-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    height: 2.5rem;
    margin: 0 4px;
    padding: 0 10px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    color: #4b5563;
    text-decoration: none;
    transition: all 0.2s;
}

.gallery-pagination .page-numbers.current,
.gallery-pagination .page-numbers:hover {
    background: #D4A574;
    border-color: #D4A574;
    color: #fff;
}

.gallery-pagination ul {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
    padding: 0;
    margin: 0;
    justify-content: center;
}

@media (max-width: 480px) {
    .view-grid,
    .view-masonry,
    .view-compact {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .gallery-filters {
        gap: 6px;
    }
    
    .filter-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .view-list .gallery-item {
        flex-direction: column;
        gap: 12px;
    }
    
    .view-list .gallery-image-wrapper {
        width: 100%;
        height: 200px;
    }
    
    .lightbox-info {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }
    
    .lightbox-actions {
        gap: 4px;
    }
    
    .action-btn {
        padding: 8px;
    }
}
