/**
 * VEA CAST - Gallery Modal Styles
 */

/* Modal Overlay */
.gallery-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-modal.show {
    display: block;
    opacity: 1;
}

/* Modal Content */
.gallery-content {
    position: relative;
    max-width: 900px;
    margin: 50px auto;
    background-color: #1a1a1a;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    max-height: calc(100vh - 100px);
    display: flex;
    flex-direction: column;
}

/* Modal Header */
.gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    background-color: #252525;
    border-bottom: 1px solid #333;
}

.gallery-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #fff;
}

.gallery-close {
    background: none;
    border: none;
    color: #999;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.gallery-close:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.1);
}

/* Gallery Body */
.gallery-body {
    padding: 25px;
    overflow-y: auto;
    flex: 1;
}

/* Videos Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
}

/* Video Item */
.gallery-item {
    position: relative;
    background-color: #252525;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    user-select: none;
}

.gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.gallery-item:hover .gallery-thumbnail {
    background-color: #333;
}

.gallery-item:active {
    transform: translateY(-2px);
    transition: transform 0.1s ease;
}

/* Thumbnail Container */
.gallery-thumbnail {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
    background-color: #333;
    overflow: hidden;
}

/* Click overlay for thumbnails */
.gallery-thumbnail::after {
    content: attr(data-overlay);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 5;
}

.gallery-item:hover .gallery-thumbnail::after {
    opacity: 1;
}

.gallery-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Placeholder for missing thumbnails */
.gallery-thumbnail.no-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 0;
    height: 101px; /* Reducido para coincidir con 180px width en 16:9 */
}

.gallery-thumbnail.no-thumb::before {
    content: '\1F4F9'; /* Video camera emoji */
    font-size: 36px;
    opacity: 0.3;
}

/* Status Indicator */
.gallery-status {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

/* Delete Button */
.gallery-delete {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 24px;
    height: 24px;
    background-color: rgba(220, 53, 69, 0.9);
    border: none;
    border-radius: 4px;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 10;
}

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

.gallery-delete:hover {
    background-color: #dc3545;
    transform: scale(1.1);
}

.gallery-delete:active {
    transform: scale(0.95);
}

.gallery-status.processed {
    background-color: #28a745; /* Verde - Video procesado */
}

.gallery-status.processing {
    background-color: #17a2b8; /* Azul claro/celeste - Video en proceso */
    animation: pulse-blue 2s infinite;
}

.gallery-status.live {
    background-color: #dc3545; /* Rojo - Video en vivo */
    animation: pulse-red 2s infinite;
}

/* Video Info */
.gallery-info {
    padding: 10px 12px;
}

.gallery-title {
    margin: 0;
    font-size: 13px;
    font-weight: 500;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gallery-meta {
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
    font-size: 11px;
    color: #999;
}

.gallery-size,
.gallery-date {
    white-space: nowrap;
}

/* Empty State */
.gallery-empty {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.gallery-empty-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.3;
}

.gallery-empty-text {
    font-size: 18px;
    margin-bottom: 10px;
}

.gallery-empty-subtext {
    font-size: 14px;
    color: #555;
}

/* Loading State */
.gallery-loading {
    text-align: center;
    padding: 60px 20px;
}

.gallery-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.gallery-loading-text {
    margin-top: 20px;
    font-size: 16px;
    color: #999;
}

/* Animations */
@keyframes pulse-blue {
    0% {
        box-shadow: 0 0 0 0 rgba(23, 162, 184, 0.7);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(23, 162, 184, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(23, 162, 184, 0);
    }
}

@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(220, 53, 69, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .gallery-content {
        margin: 20px;
        max-height: calc(100vh - 40px);
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
    }
    
    .gallery-header {
        padding: 15px 20px;
    }
    
    .gallery-body {
        padding: 20px;
    }
    
    .gallery-info {
        padding: 8px 10px;
    }
    
    .gallery-title {
        font-size: 12px;
    }
    
    .gallery-meta {
        font-size: 10px;
    }
}