/* Heia Ambassador Plugin Styles */

/* Grid d'ambassadeurs */
.heia-ambassadors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

/* Card ambassadeur */
.ambassador-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    position: relative;
}

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

.ambassador-card-image {
    position: relative;
    width: 100%;
    height: 250px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f5f5f5;
}

.ambassador-card-image img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.ambassador-card:hover .ambassador-card-image img {
    transform: scale(1.05);
}

/* Placeholder pour les images manquantes */
.ambassador-card-image.no-image {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.placeholder-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
    color: #666;
}

.placeholder-icon {
    font-size: 3em;
    margin-bottom: 10px;
    opacity: 0.7;
}

.placeholder-text {
    font-size: 0.9em;
    font-weight: 500;
    max-width: 200px;
    line-height: 1.3;
}

.ambassador-card-content {
    padding: 20px;
}

.ambassador-card-content h3 {
    margin: 0;
    font-size: 1.2em;
    font-weight: 600;
    color: #333;
    text-align: center;
}

/* Popup */
.ambassador-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.popup-content {
    position: relative;
    background: white;
    border-radius: 12px;
    max-width: 95vw;
    max-height: 90vh;
    width: 1200px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

.popup-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 30px;
    color: #666;
    cursor: pointer;
    z-index: 10;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.popup-close:hover {
    background-color: rgba(0, 0, 0, 0.1);
    color: #333;
}

.popup-inner {
    display: flex;
    min-height: 400px;
    flex: 1;
    overflow: hidden;
}

.popup-text {
    flex: 1;
    padding: 30px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    overflow-y: auto;
    max-height: calc(90vh - 60px);
}

.popup-title {
    margin: 0 0 15px 0;
    font-size: 2em;
    color: #333;
    font-weight: 700;
}

.popup-discipline {
    margin: 0 0 20px 0;
    font-size: 1.1em;
    color: #666;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.popup-description {
    font-size: 1em;
    line-height: 1.6;
    color: #555;
}

.popup-description p {
    margin: 0 0 15px 0;
}

/* Scrollbar personnalisée pour le texte de la popup */
.popup-text::-webkit-scrollbar {
    width: 8px;
}

.popup-text::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.popup-text::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.popup-text::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Galerie slider */
.popup-gallery {
    flex: 1;
    position: relative;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f8f9fa;
}

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

.slider-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.slider-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.slider-image.active {
    display: block;
}

.slider-prev,
.slider-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    z-index: 5;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.slider-prev {
    left: 15px;
}

.slider-next {
    right: 15px;
}

.slider-prev:hover,
.slider-next:hover {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* Responsive design */

/* Écrans larges - affichage desktop étendu */
@media (min-width: 1400px) {
    .popup-content {
        width: 1400px;
        max-width: 90vw;
    }
    
    .popup-text {
        padding: 40px;
    }
}

/* Tablette large et desktop moyen */
@media (max-width: 1200px) and (min-width: 769px) {
    .popup-content {
        width: 95vw;
        max-width: 1000px;
    }
    
    .popup-text {
        padding: 25px;
    }
}

/* Tablette */
@media (max-width: 768px) {
    .heia-ambassadors-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 15px;
        padding: 15px 0;
    }
    
    .popup-content {
        width: 96vw;
        max-height: 96vh;
        max-width: none;
    }
    
    .popup-inner {
        flex-direction: column;
    }
    
    .popup-text {
        padding: 20px;
        max-height: 45vh;
        overflow-y: auto;
    }
    
    .popup-gallery {
        min-height: 350px;
        flex: 1;
    }
    
    .popup-title {
        font-size: 1.6em;
    }
    
    .ambassador-card-image {
        height: 200px;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .heia-ambassadors-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .ambassador-card-content {
        padding: 15px;
    }
    
    .popup-content {
        width: 98vw;
        max-height: 98vh;
        border-radius: 8px;
    }
    
    .popup-text {
        padding: 15px;
        max-height: 40vh;
    }
    
    .popup-title {
        font-size: 1.4em;
        margin-bottom: 10px;
    }
    
    .popup-discipline {
        font-size: 1em;
        margin-bottom: 15px;
    }
    
    .popup-gallery {
        min-height: 280px;
    }
    
    .slider-prev,
    .slider-next {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .popup-close {
        top: 10px;
        right: 10px;
        width: 35px;
        height: 35px;
        font-size: 24px;
    }
}

/* Compatibilité Astra Theme */
.ast-container .heia-ambassadors-grid,
.site-content .heia-ambassadors-grid {
    margin: 0;
}

.ast-single-post .heia-ambassadors-grid,
.ast-page .heia-ambassadors-grid {
    max-width: none;
}

/* Forcer le z-index pour Astra */
body.ast-desktop .ambassador-popup,
body.astra-theme .ambassador-popup {
    z-index: 9999999 !important;
}

/* S'assurer que la popup reste au-dessus des éléments Astra */
.ambassador-popup {
    z-index: 9999999 !important;
}

.popup-content {
    z-index: 10000000 !important;
    position: relative;
}

/* Forcer l'arrêt du scroll quand popup ouverte */
body.popup-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
}

/* Spécifique pour Astra - empêcher les conflits */
.ast-container,
.site-content,
.ast-separate-container .ast-article-post,
.ast-separate-container .ast-article-single {
    position: static !important;
}

/* Animation de fade-in pour les cards */
.ambassador-card {
    opacity: 0;
    animation: fadeInUp 0.6s ease forwards;
}

.ambassador-card:nth-child(1) { animation-delay: 0.1s; }
.ambassador-card:nth-child(2) { animation-delay: 0.2s; }
.ambassador-card:nth-child(3) { animation-delay: 0.3s; }
.ambassador-card:nth-child(4) { animation-delay: 0.4s; }
.ambassador-card:nth-child(5) { animation-delay: 0.5s; }
.ambassador-card:nth-child(6) { animation-delay: 0.6s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Animation popup */
.ambassador-popup {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ambassador-popup.show {
    opacity: 1;
}

.popup-content {
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.ambassador-popup.show .popup-content {
    transform: scale(1);
}

/* Indicateurs slider */
.slider-indicators {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 5;
}

.slider-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: background 0.3s ease;
}

.slider-indicator.active {
    background: rgba(255, 255, 255, 1);
}

/* États de chargement */
.ambassador-card.loading {
    pointer-events: none;
    opacity: 0.7;
}

.popup-content.loading::before {
    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;
}
