/* Dook Media Gallery Frontend Styles */
.dook-media-gallery-frontend {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 0;
}

/* Gallery Controls */
.dook-gallery-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Tab Filters */
.dook-gallery-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.dook-tab-filter {
    background: #f5f5f5;
    border: 1px solid #ddd;
    color: #666;
    padding: 10px 16px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.dook-tab-filter:hover {
    background: #e8e8e8;
    border-color: #151b29;
    color: #151b29;
}

.dook-tab-filter.active {
    background: #151b29;
    border-color: #151b29;
    color: #fff;
}

.dook-tab-filter .tab-count {
    background: rgba(255,255,255,0.2);
    color: inherit;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    min-width: 20px;
    text-align: center;
}

.dook-tab-filter.active .tab-count {
    background: rgba(255,255,255,0.2);
}

/* Type Filters */
.dook-gallery-type-filters {
    display: flex;
    gap: 8px;
}

.dook-type-filter {
    background: #f5f5f5;
    border: 1px solid #ddd;
    color: #666;
    padding: 10px 12px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.dook-type-filter:hover {
    background: #e8e8e8;
    border-color: #151b29;
    transform: translateY(-2px);
}

.dook-type-filter.active {
    background: #151b29;
    border-color: #151b29;
    color: #fff;
}

.dook-type-filter .filter-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.dook-type-filter .filter-icon img {
    width: 18px;
    height: 18px;
    filter: invert(0.4);
    transition: filter 0.3s ease;
}

.dook-type-filter:hover .filter-icon img {
    filter: invert(0.2);
}

.dook-type-filter.active .filter-icon img {
    filter: invert(1);
}

/* Gallery Grid */
.dook-gallery-grid {
    display: grid;
    gap: 20px;
    transition: all 0.3s ease;
}

/* Dynamic column classes */
.dook-media-gallery-frontend[data-columns="1"] .dook-gallery-grid {
    grid-template-columns: 1fr;
}

.dook-media-gallery-frontend[data-columns="2"] .dook-gallery-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.dook-media-gallery-frontend[data-columns="3"] .dook-gallery-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.dook-media-gallery-frontend[data-columns="4"] .dook-gallery-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.dook-media-gallery-frontend[data-columns="5"] .dook-gallery-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

/* Gallery Items */
.dook-gallery-item {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    opacity: 1;
    transform: scale(1);
}

.dook-gallery-item:hover {
    border-color: #151b29;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    transform: translateY(-4px);
}

.dook-gallery-item.hidden {
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
}

/* Item Preview */
.gallery-item-preview {
    position: relative;
    height: 220px;
    overflow: hidden;
    background: #f8f8f8;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-item-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.dook-gallery-item:hover .gallery-item-preview img {
    transform: scale(1.05);
}

.video-preview {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

.play-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.play-icon img {
    width: 48px;
    height: 48px;
    filter: invert(1);
    drop-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.file-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #666;
    text-align: center;
}

.file-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    opacity: 0.7;
}

.file-icon img {
    width: 64px;
    height: 64px;
    filter: invert(0.4);
}

.file-extension {
    background: #151b29;
    color: #fff;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    margin-top: 10px;
}

/* Item Overlay */
.gallery-item-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(21, 27, 41, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

.view-btn,
.download-btn {
    background: rgba(255,255,255,0.9);
    color: #151b29;
    border: none;
    padding: 12px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
}

.view-btn img,
.download-btn img {
    width: 20px;
    height: 20px;
    filter: invert(0.2);
}

.view-btn:hover,
.download-btn:hover {
    background: #fff;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* Item Info */
.gallery-item-info {
    padding: 15px;
}

.item-title {
    font-size: 14px;
    font-weight: 500;
    color: #151b29;
    margin: 0 0 8px 0;
    line-height: 1.4;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.item-description {
    color: #666;
    margin-bottom: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.item-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #666;
    margin-bottom: 10px;
}

.item-tab-badge {
    display: inline-block;
    background: #151b29;
    color: #fff;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

/* Loading & No Results */
.dook-gallery-loading,
.dook-gallery-no-results {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #151b29;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.dook-gallery-empty {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    font-size: 16px;
    background: #f8f8f8;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

/* Lightbox */
.dook-gallery-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.9);
    cursor: pointer;
}

.lightbox-content {
    position: relative;
    background: #fff;
    border-radius: 8px;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.lightbox-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0,0,0,0.7);
    color: #fff;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
}

.lightbox-close:hover {
    background: rgba(0,0,0,0.9);
    transform: scale(1.1);
}

.lightbox-media {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    min-height: 400px;
}

.lightbox-media img,
.lightbox-media video {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
}

.lightbox-info {
    width: 300px;
    padding: 20px;
    background: #fff;
    display: flex;
    flex-direction: column;
}

.media-title {
    font-size: 16px;
    font-weight: 600;
    color: #151b29;
    margin: 0 0 10px 0;
    word-break: break-word;
}

.lightbox-info .media-meta {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 13px;
    color: #666;
    margin-bottom: 20px;
}

.media-actions {
    margin-top: auto;
}

.media-actions .download-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #151b29;
    color: #fff;
    padding: 12px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    width: 100%;
    justify-content: center;
}

.media-actions .download-btn:hover {
    background: #0f1520;
    transform: translateY(-2px);
}

.download-icon {
    font-size: 16px;
}

/* Lightbox Navigation */
.lightbox-navigation {
    position: absolute;
    top: 50%;
    left: 20px;
    right: 20px;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    pointer-events: none;
}

.nav-prev,
.nav-next {
    background: rgba(0,0,0,0.7);
    color: #fff;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    pointer-events: auto;
}

.nav-prev:hover,
.nav-next:hover {
    background: rgba(0,0,0,0.9);
    transform: scale(1.1);
}

.nav-prev:disabled,
.nav-next:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .dook-gallery-controls {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .dook-gallery-tabs {
        justify-content: center;
    }
    
    .dook-gallery-type-filters {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .dook-media-gallery-frontend {
        padding: 15px;
    }
    
    .dook-gallery-grid {
        gap: 15px;
    }
    
    .dook-gallery-controls {
        padding: 15px;
        margin-bottom: 20px;
    }
    
    .dook-tab-filter {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .dook-type-filter {
        width: 40px;
        height: 40px;
    }
    
    .gallery-item-preview {
        height: 180px;
    }
    
    .lightbox-content {
        flex-direction: column;
        max-width: 95vw;
        max-height: 95vh;
    }
    
    .lightbox-info {
        width: 100%;
        max-height: 200px;
        overflow-y: auto;
    }
    
    .lightbox-navigation {
        left: 10px;
        right: 10px;
    }
    
    .nav-prev,
    .nav-next {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .dook-media-gallery-frontend[data-columns="2"] .dook-gallery-grid,
    .dook-media-gallery-frontend[data-columns="3"] .dook-gallery-grid,
    .dook-media-gallery-frontend[data-columns="4"] .dook-gallery-grid,
    .dook-media-gallery-frontend[data-columns="5"] .dook-gallery-grid {
        grid-template-columns: 1fr;
    }
    
    .dook-gallery-tabs {
        flex-direction: column;
    }
    
    .dook-tab-filter {
        justify-content: center;
    }
    
    .gallery-item-preview {
        height: 160px;
    }
    
    .item-title {
        font-size: 13px;
    }
    
    .item-meta {
        font-size: 11px;
    }
}
