/* ========== GALLERY SPECIFIC STYLES ========== */

/* Gallery Layout */
.gallery-container {
    position: relative;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

.gallery-viewport {
    width: 100%;
    height: 600px;
    overflow: hidden;
    border-radius: 20px;
    margin-bottom: 20px;
    background: var(--bg-tertiary);
    position: relative;
}

.gallery-main-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: var(--bg-tertiary);
    cursor: zoom-in;
    transition: transform 0.3s ease;
}

.gallery-main-image:hover {
    transform: scale(1.02);
}

.gallery-thumbnails {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 10px 0;
    margin-bottom: 20px;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-primary) var(--bg-tertiary);
}

.gallery-thumbnails::-webkit-scrollbar {
    height: 8px;
}

.gallery-thumbnails::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

.gallery-thumbnails::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 4px;
}

.gallery-thumbnail {
    flex: 0 0 auto;
    width: 120px;
    height: 90px;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.3s ease;
    position: relative;
}

.gallery-thumbnail:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.gallery-thumbnail.active {
    border-color: var(--accent-primary);
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
}

.gallery-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gallery-thumbnail:hover img {
    transform: scale(1.1);
}

/* Gallery Navigation */
.gallery-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 30px;
}

.gallery-counter {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.gallery-nav-buttons {
    display: flex;
    gap: 15px;
}

.gallery-nav-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.gallery-nav-btn:hover {
    border-color: var(--accent-primary);
    background: var(--accent-primary);
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.2);
}

/* Gallery Info */
.gallery-info-section {
    margin-bottom: 40px;
}

.gallery-title {
    font-size: 1.8rem;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.gallery-meta {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.gallery-meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.gallery-description {
    line-height: 1.8;
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Gallery Grid Modes */
.gallery-grid-mode {
    display: none;
}

.gallery-grid-mode.active {
    display: grid;
}

.gallery-grid-compact {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.gallery-grid-spacious {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
}

/* Gallery Loading States */
.gallery-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.gallery-loading::after {
    content: '';
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: loadingSpin 1s linear infinite;
    margin-left: 15px;
}

@keyframes loadingSpin {
    to {
        transform: rotate(360deg);
    }
}

/* Gallery Empty State */
.gallery-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 20px;
}

.gallery-empty-icon {
    font-size: 4rem;
    color: var(--text-tertiary);
    margin-bottom: 20px;
}

.gallery-empty h3 {
    margin-bottom: 15px;
    color: var(--text-primary);
}

.gallery-empty p {
    color: var(--text-secondary);
    max-width: 500px;
    margin: 0 auto 30px;
    font-size: 1rem;
}

/* Gallery Tags */
.gallery-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 30px;
}

.gallery-tag {
    padding: 8px 15px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.gallery-tag:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    transform: translateY(-2px);
}

.gallery-tag.active {
    background: var(--accent-gradient);
    border-color: transparent;
    color: white;
    transform: translateY(-2px);
}

/* Gallery Lightbox */
.gallery-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 3000;
    display: none;
    flex-direction: column;
    animation: lightboxFadeIn 0.3s ease;
}

@keyframes lightboxFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.gallery-lightbox.active {
    display: flex;
}

.lightbox-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    position: sticky;
    top: 0;
    z-index: 2;
}

.lightbox-title {
    font-size: 1.2rem;
    font-weight: 600;
}

.lightbox-close {
    font-size: 2rem;
    color: white;
    cursor: pointer;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.lightbox-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
}

.lightbox-image {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.lightbox-controls {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    pointer-events: none;
}

.lightbox-nav {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    pointer-events: auto;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.lightbox-footer {
    padding: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    text-align: center;
    position: sticky;
    bottom: 0;
    z-index: 2;
}

.lightbox-counter {
    font-size: 1rem;
    margin-bottom: 10px;
    color: rgba(255, 255, 255, 0.8);
}

.lightbox-description {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Product Gallery Modal Specific */
.gallery-wrapper {
    display: flex;
    flex-direction: column;
    height: 90vh;
    width: 90vw;
    max-width: 1400px;
    background: var(--bg-secondary);
    border-radius: 20px;
    overflow: hidden;
}

.thumb-strip {
    display: flex;
    gap: 10px;
    padding: 15px;
    background: var(--bg-tertiary);
    overflow-x: auto;
    border-bottom: 1px solid var(--border-color);
    min-height: 120px;
}

.thumb-box {
    flex: 0 0 auto;
    width: 150px;
    height: 100px;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.3s ease;
}

.thumb-box.active {
    border-color: var(--accent-primary);
    transform: scale(1.05);
}

.thumb-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.thumb-box:hover img {
    transform: scale(1.1);
}

.main-display {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
    background: var(--bg-primary);
    position: relative;
}

.main-display img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.no-media-message {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1.2rem;
}

.no-media-message i {
    font-size: 4rem;
    margin-bottom: 20px;
    color: var(--text-tertiary);
}

/* Gallery Responsive */
@media (max-width: 1200px) {
    .gallery-viewport {
        height: 500px;
    }
    
    .gallery-wrapper {
        width: 95vw;
        height: 85vh;
    }
}

@media (max-width: 768px) {
    .gallery-viewport {
        height: 400px;
    }
    
    .gallery-thumbnail {
        width: 100px;
        height: 75px;
    }
    
    .lightbox-controls {
        padding: 0 10px;
    }
    
    .lightbox-nav {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    .gallery-wrapper {
        height: 80vh;
    }
    
    .thumb-box {
        width: 120px;
        height: 80px;
    }
}

@media (max-width: 576px) {
    .gallery-viewport {
        height: 300px;
    }
    
    .gallery-thumbnail {
        width: 80px;
        height: 60px;
    }
    
    .gallery-grid-compact {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .gallery-grid-spacious {
        grid-template-columns: 1fr;
    }
    
    .gallery-nav-btn {
        width: 40px;
        height: 40px;
    }
    
    .thumb-box {
        width: 100px;
        height: 70px;
    }
    
    .main-display {
        padding: 15px;
    }
}

/* Mobile specific */
@media (max-width: 480px) {
    .gallery-title {
        font-size: 1.5rem;
    }
    
    .gallery-meta {
        flex-direction: column;
        gap: 10px;
    }
    
    .thumb-strip {
        min-height: 100px;
        padding: 10px;
    }
    
    .thumb-box {
        width: 80px;
        height: 60px;
    }
}
/* ========== GALLERY MODAL FIXES ========== */
#gallery-modal {
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
}

#gallery-modal .gallery-wrapper {
    width: 95vw;
    height: 95vh;
    max-width: 1400px;
    background: var(--bg-secondary);
    border-radius: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#gallery-modal .thumb-strip {
    display: flex;
    gap: 10px;
    padding: 15px;
    background: var(--bg-tertiary);
    overflow-x: auto;
    border-bottom: 1px solid var(--border-color);
    min-height: 130px;
}

#gallery-modal .thumb-box {
    flex: 0 0 auto;
    width: 150px;
    height: 100px;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.3s ease;
}

#gallery-modal .thumb-box.active {
    border-color: var(--accent-primary);
    transform: scale(1.05);
}

#gallery-modal .thumb-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#gallery-modal .main-display {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
}

#gallery-modal .main-display img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease;
}

#gallery-modal .gallery-loading {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1.2rem;
}

#gallery-modal .gallery-loading i {
    font-size: 2rem;
    margin-bottom: 10px;
}

.no-media-message {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px;
}

.no-media-message i {
    font-size: 4rem;
    color: var(--text-tertiary);
    margin-bottom: 20px;
}

/* Gallery navigation buttons */
.gallery-nav-buttons {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    z-index: 10;
}

.gallery-nav-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.gallery-nav-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

.gallery-counter {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    backdrop-filter: blur(10px);
}

/* Close button */
#gallery-modal .close-modal {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    cursor: pointer;
    z-index: 10;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

#gallery-modal .close-modal:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: rotate(90deg);
}

/* Mobile responsive for gallery */
@media (max-width: 768px) {
    #gallery-modal .gallery-wrapper {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
    }
    
    #gallery-modal .thumb-strip {
        min-height: 100px;
        padding: 10px;
    }
    
    #gallery-modal .thumb-box {
        width: 100px;
        height: 70px;
    }
    
    #gallery-modal .main-display {
        padding: 15px;
    }
    
    .gallery-nav-buttons {
        bottom: 10px;
    }
    
    .gallery-nav-btn {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    /* ========== FACTORY GALLERY IMPROVEMENTS ========== */

/* Factory Image Captions */
.factory-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.9));
    color: white;
    padding: 20px 15px 15px;
    font-size: 0.95rem;
    transform: translateY(100%);
    transition: transform 0.4s ease;
    text-align: center;
}

.showcase-item:hover .factory-caption {
    transform: translateY(0);
}

/* Factory Image Counter */
.factory-counter {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
}

/* Factory Category Tabs */
.factory-tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 30px 0;
    flex-wrap: wrap;
}

.factory-tab {
    padding: 10px 20px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 30px;
    color: var(--text-primary);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.factory-tab.active,
.factory-tab:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
    transform: translateY(-3px);
}

/* Enhanced Factory Grid */
.factory-showcase-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

.factory-showcase-grid .showcase-item {
    position: relative;
    border-radius: 15px;
    overflow: hidden;
    height: 250px;
}

/* Factory Modal View */
.factory-modal-view {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.95);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.factory-modal-view.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.factory-modal-content {
    max-width: 1200px;
    width: 100%;
    background: var(--bg-secondary);
    border-radius: 20px;
    overflow: hidden;
    max-height: 90vh;
}

.factory-modal-img {
    width: 100%;
    max-height: 70vh;
    object-fit: contain;
    padding: 20px;
}

/* Responsive Factory */
@media (max-width: 768px) {
    .factory-showcase-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 15px;
    }
    
    .factory-tabs {
        gap: 8px;
    }
    
    .factory-tab {
        padding: 8px 16px;
        font-size: 0.85rem;
    }
}
}