/* ==========================================
   DIVISION SANTÉ - SLIDES PRESENTATION STYLE
   Version Responsive Optimisée
   ========================================== */

/* Variables d'animation globales pour contrôle centralisé */
:root {
    --anim-duration: 420ms;
    --anim-ease: cubic-bezier(.22,.9,.35,1);
    --slide-duration: 520ms;
    --stagger: 120ms;
    --nav-height: 100px;
}

/* Respecter la préférence pour réduire les animations */
@media (prefers-reduced-motion: reduce) {
    :root {
        --anim-duration: 0ms;
        --slide-duration: 0ms;
        --stagger: 0ms;
    }
}

/* Container principal pour les slides */
.slides-container {
    position: relative;
    width: 100%;
    overflow: hidden;
}

/* Chaque slide prend 100vh avec padding adaptatif */
.slide {
    box-sizing: border-box;
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    scroll-snap-align: start;
    padding: clamp(1rem, 5vw, 3rem);
    opacity: 0;
    transform: translateY(30px);
    transition: opacity var(--slide-duration) var(--anim-ease),
                transform var(--slide-duration) var(--anim-ease);
}

.slide:first-child {
    margin-top: 0;
}

/* Slide visible */
.slide.active {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================
   SLIDE D'INTRODUCTION
   ========================================== */
.slide-intro {
    background: linear-gradient(135deg, var(--pantone-293) 0%, var(--pantone-3125) 100%);
    color: white;
}

.slide-intro::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('../img/Symbols-MPM-grey.png');
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
    opacity: 0.15;
    z-index: 0;
}

.slide-intro .content {
    position: relative;
    z-index: 1;
    max-width: min(1000px, 90vw);
    padding: clamp(1rem, 3vw, 2rem);
    margin: auto;
}

.slide-intro h1 {
    font-size: clamp(1.8rem, 5vw, 2.8rem);
    margin-bottom: clamp(1rem, 3vw, 1.5rem);
    animation: fadeInDown 1s ease;
}

.slide-intro p {
    font-size: clamp(1rem, 2vw, 1.1rem);
    line-height: 1.6;
    opacity: 0;
}

/* ==========================================
   SLIDES DE PROGRAMME
   ========================================== */
.slide-program {
    background: white;
}

.program-layout {
    margin-top: 10vh;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
    gap: clamp(1.5rem, 4vw, 3rem);
    max-width: min(1400px, 95vw);
    width: 100%;
    align-items: center;
    padding: clamp(1rem, 2vw, 2rem);
    box-sizing: border-box;
}

/* Inverse l'ordre pour alterner (desktop uniquement) */
@media (min-width: 1024px) {
    .program-layout.reverse {
        direction: rtl;
    }
    
    .program-layout.reverse > * {
        direction: ltr;
    }
}

/* Zone de contenu texte */
.program-text {
    padding: clamp(1rem, 2vw, 1.5rem);
}

.program-text h2 {
    color: var(--pantone-293);
    font-size: clamp(1.5rem, 3vw, 2rem);
    margin-bottom: clamp(1rem, 2vw, 1.5rem);
    position: relative;
    padding-left: clamp(1rem, 2vw, 1.5rem);
}

.program-text h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: clamp(4px, 0.5vw, 6px);
    background: linear-gradient(180deg, var(--pantone-3125), var(--pantone-293));
    border-radius: 3px;
}

.program-text p {
    font-size: clamp(0.95rem, 1.8vw, 1.05rem);
    line-height: 1.6;
    text-align: justify;
    margin-bottom: 1rem;
}

/* ==========================================
   ZONE IMAGE ET INFO BOX
   ========================================== */
.program-image {
    position: relative;
    height: clamp(250px, 40vh, 500px);
    width: 100%;
    border-radius: clamp(12px, 2vw, 20px);
    overflow: hidden;
    display: flex;
    align-items: stretch;
}

.program-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Info box flottante avec comportement responsive */
.image-info-box {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: clamp(0.8rem, 2vw, 1.2rem);
    background: rgba(0, 61, 165, 0.82);
    backdrop-filter: blur(8px);
    border-radius: 0 0 16px 16px;
    max-height: 4.5rem;
    overflow: hidden;
    cursor: pointer;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity var(--anim-duration) var(--anim-ease),
                transform var(--anim-duration) var(--anim-ease),
                max-height calc(var(--anim-duration) * 1.2) var(--anim-ease),
                padding calc(var(--anim-duration) * 0.9) var(--anim-ease);
}

.slide.active .image-info-box {
    opacity: 0.9;
    transform: translateY(0);
}

/* Expansion au hover/focus (desktop) */
@media (min-width: 768px) {
    .program-image:hover .image-info-box,
    .program-image .image-info-box:focus,
    .program-image:focus-within .image-info-box {
        max-height: 500px;
        opacity: 1;
        padding: clamp(1rem, 2vw, 1.5rem);
    }
}

/* Sur mobile, expansion au tap */
@media (max-width: 767px) {
    .image-info-box.expanded {
        max-height: 500px;
        opacity: 1;
        padding: 1.2rem;
    }
}

.image-info-box p {
    color: #fff;
    font-size: clamp(0.9rem, 1.5vw, 1rem);
    margin: 0;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (min-width: 768px) {
    .program-image:hover .image-info-box p,
    .program-image .image-info-box:focus p,
    .program-image:focus-within .image-info-box p {
        -webkit-line-clamp: unset;
        display: block;
    }
}

@media (max-width: 767px) {
    .image-info-box.expanded p {
        -webkit-line-clamp: unset;
        display: block;
    }
}

/* ==========================================
   NAVIGATION DOTS
   ========================================== */
.slide-navigation {
    position: fixed;
    right: clamp(0.5rem, 2vw, 2rem);
    top: 50%;
    transform: translateY(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: clamp(0.6rem, 1vw, 1rem);
}

.nav-dot {
    width: clamp(8px, 1vw, 12px);
    height: clamp(8px, 1vw, 12px);
    border-radius: 50%;
    background: rgba(0, 61, 165, 0.3);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.nav-dot:hover,
.nav-dot.active {
    background: var(--pantone-293);
    transform: scale(1.2);
}

/* Tooltip pour les dots (desktop uniquement) */
@media (min-width: 768px) {
    .nav-dot::before {
        content: attr(data-title);
        position: absolute;
        right: 120%;
        top: 50%;
        transform: translateY(-50%);
        background: var(--pantone-293);
        color: white;
        padding: 0.5rem 1rem;
        border-radius: 6px;
        white-space: nowrap;
        font-size: 0.9rem;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }
    
    .nav-dot:hover::before {
        opacity: 1;
    }
}

/* ==========================================
   INDICATEUR DE SCROLL
   ========================================== */
.scroll-indicator {
    position: absolute;
    bottom: clamp(1rem, 3vw, 2rem);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: white;
    z-index: 10;
}

.scroll-indicator span {
    font-size: clamp(0.8rem, 1.5vw, 1rem);
    text-transform: uppercase;
    letter-spacing: clamp(1px, 0.2vw, 2px);
}

.slides-wrapper:not(.at-top) .scroll-indicator {
    opacity: 0;
    pointer-events: none;
}

/* ==========================================
   SLIDE NEWSLETTERS
   ========================================== */
.slide-newsletters {
    background: linear-gradient(135deg, #f8f9fa 0%, white 100%);
}

.newsletters-content {
    width: 100%;
    padding: clamp(1rem, 3vw, 2rem);
}

.newsletters-content h2 {
    text-align: center;
    color: var(--pantone-293);
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    margin-bottom: clamp(1.5rem, 3vw, 2.5rem);
}

.newsletters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr));
    gap: clamp(1.2rem, 3vw, 2rem);
}

.newsletter-card {
    background: white;
    padding: clamp(1.2rem, 3vw, 2rem);
    border-radius: clamp(12px, 2vw, 16px);
    box-shadow: 0 8px 25px rgba(0, 61, 165, 0.08);
    text-align: center;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.slide.active .newsletter-card {
    opacity: 1;
    transform: translateY(0);
}

.slide.active .newsletter-card:nth-child(1) { transition-delay: 0.1s; }
.slide.active .newsletter-card:nth-child(2) { transition-delay: 0.2s; }
.slide.active .newsletter-card:nth-child(3) { transition-delay: 0.3s; }
.slide.active .newsletter-card:nth-child(4) { transition-delay: 0.4s; }

.newsletter-card .card-icon {
    margin: 0 auto clamp(0.8rem, 2vw, 1.5rem);
}

.newsletter-card h3 {
    color: var(--pantone-293);
    font-size: clamp(1.2rem, 2.5vw, 1.5rem);
    margin-bottom: clamp(0.5rem, 1vw, 1rem);
}

.newsletter-card p {
    font-size: clamp(0.9rem, 1.5vw, 1rem);
    line-height: 1.5;
    text-align: justify;
}

.newsletter-card h4 a {
    color: var(--pantone-293);
    text-decoration: none;
    font-size: clamp(0.9rem, 1.5vw, 1rem);
}

/* ==========================================
   PROGRESS BAR
   ========================================== */
.slide-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: clamp(3px, 0.5vw, 4px);
    background: rgba(0, 61, 165, 0.1);
    z-index: 999;
}

.slide-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--pantone-3125), var(--pantone-293));
    width: 0%;
    transition: width 0.3s ease;
}

/* ==========================================
   ANIMATIONS
   ========================================== */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-text {
    opacity: 0;
    transform: translateY(25px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.slide.active .fade-in-text {
    opacity: 1;
    transform: translateY(0);
}

.fade-in-text:nth-child(2) { transition-delay: 0.15s; }
.fade-in-text:nth-child(3) { transition-delay: 0.3s; }
.fade-in-text:nth-child(4) { transition-delay: 0.45s; }

.slide.active .program-text {
    animation: fadeInUp 0.8s ease forwards;
}

.slide.active .program-image {
    animation: fadeInUp 0.8s ease forwards;
    animation-delay: 0.2s;
}

/* ==========================================
   MEDIA QUERIES SPÉCIFIQUES
   ========================================== */

/* Tablettes et petits desktops */
@media (max-width: 1024px) {
    .program-layout {
        grid-template-columns: 1fr;
    }
    
    .program-image {
        order: -1; /* Image toujours en haut sur tablette/mobile */
    }
}

/* Smartphones en mode paysage */
@media (max-height: 600px) and (orientation: landscape) {
    .slide {
        min-height: auto;
        padding: 2rem 1rem;
    }
    
    .program-layout {
        gap: 1.5rem;
    }
    
    .program-image {
        height: 280px;
    }
    
    .scroll-indicator {
        display: none;
    }
    
    .newsletters-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

/* Très petits écrans */
@media (max-width: 360px) {
    .slide-intro h1 {
        font-size: 1.6rem;
    }
    
    .program-text h2 {
        font-size: 1.3rem;
    }
    
    .program-image {
        height: 220px;
    }
    
    .newsletter-card {
        padding: 1rem;
    }
}

/*Bulletin*/
.card-img img {
    width: 150px;
    height: auto;
}