/* ==============================================
   VIDEO CARDS - CSS COMPLETO Y MEJORADO
   ============================================== */

/* Grid de videos - Responsive */
#videosGrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    padding: 1rem;
}

/* Tarjeta de video */
.video-card {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.video-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

/* Contenedor de la miniatura */
.video-thumbnail {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* Ratio 16:9 */
    overflow: hidden;
    background: #000;
}

/* Imagen de la miniatura */
.video-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.video-thumbnail img.loading {
    opacity: 0.6;
    background: linear-gradient(90deg, #374151 0%, #4b5563 50%, #374151 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: -100% 0; }
    100% { background-position: 100% 0; }
}

.video-card:hover .video-thumbnail img {
    transform: scale(1.05);
}

/* Overlay oscuro al hacer hover */
.video-thumbnail::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 0%, transparent 50%, rgba(0, 0, 0, 0.7) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 1;
}

.video-card:hover .video-thumbnail::before {
    opacity: 1;
}

/* Botón de play */
.play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 68px;
    height: 48px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.play-overlay i {
    color: #000;
    font-size: 1.75rem;
    margin-left: 4px;
}

.video-card:hover .play-overlay {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.15);
}

/* Duración del video */
.video-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.9);
    color: #ffffff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8125rem;
    font-weight: 700;
    z-index: 10;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Información del video */
.video-info {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

/* Título del video */
.video-title {
    color: #1f2937;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 2.8em;
}

/* Descripción del video */
.video-description {
    color: #6b7280;
    font-size: 0.875rem;
    line-height: 1.4;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Metadatos (vistas, likes) */
.video-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.875rem;
    color: #9ca3af;
    margin-top: auto;
}

.video-meta span {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.video-meta i {
    font-size: 0.875rem;
    opacity: 0.7;
}

/* Categoría */
.video-category {
    display: inline-block;
    background: #ef4444;
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    margin-top: 0.5rem;
    width: fit-content;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Responsive - Tablets */
@media (max-width: 1024px) {
    #videosGrid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1.25rem;
    }
    
    .video-title {
        font-size: 0.9375rem;
    }
}

/* Responsive - Móviles */
@media (max-width: 640px) {
    #videosGrid {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 0.75rem;
    }
    
    .video-card {
        border-radius: 8px;
    }
    
    .video-info {
        padding: 0.875rem;
    }
    
    .video-title {
        font-size: 0.875rem;
        -webkit-line-clamp: 2;
    }
    
    .video-description {
        font-size: 0.8125rem;
    }
    
    .video-meta {
        font-size: 0.8125rem;
    }
    
    .play-overlay {
        width: 56px;
        height: 40px;
    }
    
    .play-overlay i {
        font-size: 1.5rem;
    }
}

/* Modo sin videos */
.loading-spinner {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 1rem;
    color: #9ca3af;
}

.loading-spinner i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #ef4444;
}

.loading-spinner p {
    font-size: 1.125rem;
    font-weight: 500;
}

/* Animación de entrada para las tarjetas */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.video-card {
    animation: fadeInUp 0.4s ease backwards;
}

/* Retraso escalonado para las tarjetas */
.video-card:nth-child(1) { animation-delay: 0.05s; }
.video-card:nth-child(2) { animation-delay: 0.1s; }
.video-card:nth-child(3) { animation-delay: 0.15s; }
.video-card:nth-child(4) { animation-delay: 0.2s; }
.video-card:nth-child(5) { animation-delay: 0.25s; }
.video-card:nth-child(6) { animation-delay: 0.3s; }
.video-card:nth-child(7) { animation-delay: 0.35s; }
.video-card:nth-child(8) { animation-delay: 0.4s; }
.video-card:nth-child(9) { animation-delay: 0.45s; }
.video-card:nth-child(10) { animation-delay: 0.5s; }
.video-card:nth-child(11) { animation-delay: 0.55s; }
.video-card:nth-child(12) { animation-delay: 0.6s; }

/* MODO OSCURO */
@media (prefers-color-scheme: dark) {
    .video-card {
        background: #1f2937;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }
    
    .video-card:hover {
        box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
    }
    
    .video-title {
        color: #f9fafb;
    }
    
    .video-description {
        color: #9ca3af;
    }
    
    .video-meta {
        color: #6b7280;
    }
}