/* Testimonianze Video Grid Styles */
.testimonianze {
    background-color: var(--primary-bg-color);
    padding: var(--pad-section) 0;
}

.video-card {
    background: #fff;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    height: 100%;
    position: relative;
}

.video-card h4,
.video-card h6 {
    transition: color 0.3s ease;
}

.video-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.video-thumbnail {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16/9;
}

.video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

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

.video-card:hover h4,
.video-card:hover h6 {
    color: var(--primary-color);
}

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

.play-button {
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(214, 66, 71, 0.3);
}

.video-card:hover .play-button {
    transform: scale(1.1);
    background: #b5353a;
    box-shadow: 0 6px 20px rgba(214, 66, 71, 0.4);
}

.video-info {
    padding: 1.5rem;
}

.video-info h4 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.video-info p {
    color: #666;
    margin-bottom: 0;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Paginazione personalizzata */
.pagination {
    margin-bottom: 0;
}

.pagination .page-item .page-link {
    color: var(--primary-color);
    background-color: #fff;
    border: 2px solid var(--primary-color);
    margin: 0 0.25rem;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    min-width: 45px;
    text-align: center;
}

.pagination .page-item .page-link:hover {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(214, 66, 71, 0.3);
}

.pagination .page-item.active .page-link {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(214, 66, 71, 0.3);
}

.pagination .page-item.disabled .page-link {
    color: #6c757d;
    background-color: #fff;
    border-color: #dee2e6;
    cursor: not-allowed;
    opacity: 0.6;
}

.pagination .page-item.disabled .page-link:hover {
    background-color: #fff;
    color: #6c757d;
    border-color: #dee2e6;
    transform: none;
    box-shadow: none;
}

/* Animazione per il cambio di pagina */
.video-item {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.video-item.fade-out {
    opacity: 0;
    transform: translateY(20px);
}

.video-item.fade-in {
    opacity: 1;
    transform: translateY(0);
}

/* Loading state per la paginazione */
.pagination.loading .page-link {
    pointer-events: none;
    opacity: 0.7;
}

/* Responsive per la paginazione */
@media (max-width: 576px) {
    .pagination .page-item .page-link {
        padding: 0.5rem 0.75rem;
        min-width: 40px;
        font-size: 0.9rem;
        margin: 0 0.125rem;
    }
}

/* Modal Styles */
#videoModal .modal-content {
    border: none;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    /* Disabilita la centratura automatica */
    margin-top: 0 !important;
}

#videoModal .modal-dialog {
    max-width: 800px;
    /* Disabilita la centratura automatica */
    margin: 1rem auto !important;
}

/* Override per la funzione centerModals() */
#videoModal .modal-content {
    margin-top: 0 !important;
}

#videoModal {
    --bs-modal-margin: 0;
}

#videoModal .modal-header {
    background: var(--primary-color);
    color: #fff;
    border-bottom: none;
    padding: 1rem 1.5rem;
}

#videoModal .modal-title {
    font-weight: 600;
    font-size: 1.1rem;
}

#videoModal .close {
    color: #fff;
    opacity: 0.8;
    font-size: 1.5rem;
    transition: opacity 0.3s ease;
    background: none;
    border: none;
    padding: 0;
    width: auto;
    height: auto;
}

#videoModal .close:hover {
    opacity: 1;
}

#videoModal .modal-body {
    background: #000;
    padding: 0;
}

#videoModal .ratio {
    background: #000;
}

#videoModal iframe {
    border: none;
}

/* Loading state */
.video-card.loading {
    pointer-events: none;
}

.video-card.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

/* Responsive */
@media (max-width: 768px) {
    .video-info {
        padding: 1rem;
    }
    
    .video-info h4 {
        font-size: 1.1rem;
    }
    
    .play-button {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
    
    #videoModal .modal-dialog {
        margin: 1rem;
        max-width: calc(100% - 2rem);
    }
}

@media (max-width: 576px) {
    .video-card {
        margin-bottom: 1rem;
    }
    
    .video-info h4 {
        font-size: 1rem;
    }
    
    .video-info p {
        font-size: 0.8rem;
    }
}

/* Animation classes */
.g-fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease;
}

.g-fade-in.animate {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger animation for cards */
.video-card:nth-child(1) { transition-delay: 0.1s; }
.video-card:nth-child(2) { transition-delay: 0.2s; }
.video-card:nth-child(3) { transition-delay: 0.3s; }
.video-card:nth-child(4) { transition-delay: 0.4s; }
.video-card:nth-child(5) { transition-delay: 0.5s; }
.video-card:nth-child(6) { transition-delay: 0.6s; }

/* Accessibility improvements */
.video-card:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.video-card:focus .video-overlay {
    opacity: 1;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .video-card {
        border: 2px solid #000;
    }
    
    .play-button {
        border: 2px solid #fff;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .video-card,
    .video-thumbnail img,
    .video-overlay,
    .play-button,
    .g-fade-in,
    .video-item,
    .pagination .page-item .page-link {
        transition: none;
    }
    
    .video-card:hover {
        transform: none;
    }
    
    .video-card:hover .video-thumbnail img {
        transform: none;
    }
    
    .video-card:hover .play-button {
        transform: none;
    }
    
    .pagination .page-item .page-link:hover {
        transform: none;
    }
}