/* ==========================================================================
   1. VARIABLES GLOBALES (Couleurs et Polices)
   ========================================================================== */
:root {
    --bordeaux-fond: #56191c;
    --ivoire-carte: #fdf8f4;
    --rouge-titre: #c42b31;
    --rouge-texte: #b53135;
    --noir-pur: #000000;
    --police-titre: 'Great Vibes', cursive;
    --police-texte: 'Cormorant Garamond', serif;
}

/* ==========================================================================
   2. RÉINITIALISATION ET CORPS DE PAGE (FIX STRICT ANTI-SCROLL)
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    background-color: var(--bordeaux-fond);
    font-family: var(--police-texte);
    position: relative;
    min-height: 100vh;
}

/* ==========================================================================
   3. GESTION DES PAGES (Navigation)
   ========================================================================== */
.page {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    min-height: 100vh;
    opacity: 0;
    pointer-events: none;
    transition: opacity 1s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
}

.page.active {
    opacity: 1;
    pointer-events: auto;
    /* CORRECTION : auto est préférable à all */
}

/* ==========================================================================
   4. PAGE 1 : L'ACCUEIL DISCO
   ========================================================================== */
.fond-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

.btn-verre {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    background: rgba(30, 30, 30, 0.75);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.6);
    padding: 18px 40px;
    border-radius: 40px;
    font-family: var(--police-texte);
    font-size: clamp(0.9rem, 3vw, 1.2rem);
    white-space: nowrap;
    letter-spacing: 2px;
    cursor: pointer;
    transition: 0.3s;
}

.btn-verre:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: translate(-50%, -50%) scale(1.05);
}

/* ==========================================================================
   5. PAGE 2 : LA CARTE D'INVITATION
   ========================================================================== */
.carte-a4 {
    background-color: var(--ivoire-carte);
    height: 95vh;
    width: auto;
    aspect-ratio: 1 / 1.35;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    /* Les marges internes sont maintenant en vh pour suivre la carte */
    padding: 22vh 2vh 4vh 2vh;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.5);
    text-align: center;
}

.ruban-contour {
    position: absolute;
    top: -2%;
    left: -2%;
    width: 104%;
    height: 104%;
    background: url('ruban-noir.png') center/contain no-repeat;
    pointer-events: none;
    z-index: 1;
}

.contenu-texte {
    z-index: 2;
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 0;
}

/* -- Typographie -- */
.titre-cursif {
    font-family: var(--police-titre);
    font-size: 6vh;
    color: var(--rouge-titre);
    font-weight: normal;
    margin-bottom: 1vh;
    margin-top: 4vh;
}

.titre-cursif-sous-titre {
    font-family: var(--police-titre);
    font-size: 3.5vh;
    color: var(--rouge-titre);
    font-weight: normal;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    margin-top: 4vh;
    margin-bottom: 1vh;
}

.texte-standard {
    font-size: 2vh;
    color: var(--rouge-texte);
    line-height: 1.6;
}

.texte-petit {
    font-size: 1.6vh;
    font-style: italic;
    color: var(--rouge-texte);
    opacity: 0.8;
}

.gras {
    font-weight: 600;
}

.date-event {
    font-size: 2.5vh;
}

.shining-text {
    animation: glow 2s ease-in-out infinite alternate;
}

/* ==========================================================================
   ANIMATIONS CHRONOLOGIQUES
   ========================================================================== */
@keyframes apparitionInit {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page:nth-child(2) .asset-deco,
.page:nth-child(2) .contenu-texte,
.page:nth-child(2) .titre-cursif-sous-titre,
.page:nth-child(2) .bouton-coeur {
    opacity: 0;
}

.page.active .asset-deco,
.page.active .contenu-texte,
.page.active .titre-cursif-sous-titre,
.page.active .bouton-coeur {
    animation: apparitionInit 0.8s ease-out forwards;
}

.page.active #anim-4 {
    animation-delay: 0.5s;
}

.page.active #anim-5 {
    animation-delay: 1.0s;
}

.page.active #anim-6 {
    animation-delay: 1.5s;
}

.page.active #anim-7 {
    animation-delay: 2.0s;
}

.page.active #anim-8 {
    animation-delay: 2.5s;
}

.page.active .contenu-texte {
    animation-delay: 3.5s;
}

.page.active .titre-cursif-sous-titre {
    animation-delay: 4.2s;
}

.page.active .bouton-coeur:nth-child(1) {
    animation-delay: 4.8s;
}

.page.active .bouton-coeur:nth-child(2) {
    animation-delay: 5.2s;
}

.page.active .bouton-coeur:nth-child(3) {
    animation-delay: 5.6s;
}

/* ==========================================================================
   6. LES BOUTONS CŒURS (Carte principale)
   ========================================================================== */
.choix-rsvp {
    display: flex;
    justify-content: center !important;
    gap: 2vh !important;
    width: 100%;
    max-width: none;
    margin-top: 1vh;
    z-index: 10;
}

.bouton-coeur {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: max-content !important;
    margin: 0;
    padding: 0 1vh;
    cursor: pointer;
    transition: 0.2s;
}

.bouton-coeur:hover {
    transform: translateY(-3px);
}

.icone-coeur {
    width: 4vh;
    height: 4vh;
    fill: var(--noir-pur);
    margin-bottom: 1vh;
    filter: drop-shadow(0px 4px 5px rgba(0, 0, 0, 0.15));
}

.bouton-coeur span {
    font-size: 1.8vh;
    color: var(--rouge-texte);
    font-weight: 600;
}

/* ==========================================================================
   7. LES VISUELS ANIMÉS (Placement Bureau)
   ========================================================================== */
.asset-deco {
    position: absolute;
    z-index: 5;
    pointer-events: none;
}

#anim-4 {
    top: 12%;
    left: 15%;
    width: 26%;
    /* Remplacé de 130px */
}

/* Fille */
#anim-5 {
    bottom: 8%;
    left: -12%;
    width: 55%;
    z-index: 9;
}

/* Courronne */
#anim-6 {
    bottom: 48%;
    left: -12%;
    width: 25%;
    z-index: 10;
    transform: rotate(-15deg);
}

#anim-7 {
    top: -4%;
    right: -10%;
    width: 31%;
    /* Remplacé de 155px */
    z-index: 9;
}

/* Cocktail */
#anim-8 {
    bottom: 5%;
    right: -30%;
    width: 58%;
    /* Remplacé de 290px */
    z-index: 9;
}

.element-anime {
    opacity: 0;
    transition: opacity 1s ease-out;
}

.element-anime.visible {
    opacity: 1;
}

/* ==========================================================================
   8. LES MODALES (Formulaires)
   ========================================================================== */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.3s;
}

.overlay.cache {
    opacity: 0;
    pointer-events: none;
}

.boite-modale {
    background-color: var(--ivoire-carte);
    padding: 30px 40px;
    border-radius: 15px;
    width: 90%;
    max-width: 450px;
    color: var(--rouge-texte);
    position: relative;
    border: 12px solid var(--bordeaux-fond);
    box-sizing: border-box;
}

.centre {
    text-align: center;
}

.titre-avec-icone {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 25px;
}

.titre-form {
    font-family: var(--police-titre);
    font-size: 2.4rem;
    color: var(--rouge-titre);
    font-weight: normal;
    margin: 0;
}

.icone-coeur-titre {
    width: 35px;
    height: 35px;
    fill: var(--noir-pur);
    margin-left: 12px;
    filter: drop-shadow(0px 4px 5px rgba(0, 0, 0, 0.15));
}

#modal-non .icone-broken-heart svg path {
    fill: black !important;
}

form {
    display: flex;
    flex-direction: column;
    text-align: left;
    gap: 15px;
}

form label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--rouge-texte);
    margin-bottom: 2px;
    display: block;
}

form input,
form textarea {
    padding: 12px;
    border: 1px solid var(--rouge-texte);
    background-color: var(--ivoire-carte);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    color: var(--rouge-texte);
    width: 100%;
    box-sizing: border-box;
}

form input::placeholder,
form textarea::placeholder {
    color: rgba(181, 49, 53, 0.5);
}

form input:focus,
form textarea:focus {
    outline: none;
    border-color: var(--rouge-titre);
}

.actions-formulaire {
    display: flex;
    justify-content: space-between;
    margin-top: 25px;
    gap: 20px;
}

.btn-annuler,
.btn-confirmer {
    padding: 12px 30px;
    border-radius: 25px;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    transition: 0.3s;
    flex: 1;
    text-align: center;
}

.btn-annuler {
    background: var(--ivoire-carte);
    color: var(--rouge-texte);
    border: 2px solid var(--rouge-texte);
}

.btn-annuler:hover {
    background: rgba(181, 49, 53, 0.1);
}

.btn-confirmer {
    background: var(--rouge-texte);
    color: white;
    border: 2px solid var(--rouge-texte);
}

.btn-confirmer:hover {
    background: var(--rouge-titre);
    border-color: var(--rouge-titre);
}

.bisou-merci {
    width: 60px;
    margin: 20px 0;
}

.margin-bottom {
    margin-bottom: 20px;
}

.margin-top {
    margin-top: 15px;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 5px;
    margin-bottom: 5px;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--rouge-texte);
}

.checkbox-group label {
    margin: 0;
    font-weight: 500;
    cursor: pointer;
}

/* ==========================================================================
   9. ADAPTATION POUR LES TÉLÉPHONES (MOBILE)
   ========================================================================== */
@media (max-width: 768px) {
    .page {
        align-items: flex-start;
        overflow-y: auto;
    }

    .carte-a4 {
        width: 100%;
        height: auto;
        min-height: 100vh;
        margin: 0;
        aspect-ratio: auto;
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding: 140px 25px 220px 25px;
        overflow-x: hidden;
    }

    .texte-standard {
        font-size: 19px;
    }

    .texte-petit {
        font-size: 15px;
    }

    .date-event {
        font-size: 22px;
    }

    .ruban-contour {
        display: none;
    }

    .contenu-texte {
        z-index: 2;
        width: 100%;
        max-width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        margin-top: 0;
    }

    #anim-4 {
        top: 25px;
        left: 10px;
        width: 120px;
    }

    #anim-7 {
        top: -10px;
        right: -15px;
        width: 110px;
    }

    #anim-8 {
        bottom: 15px;
        right: -30px;
        width: 220px;
    }

    #anim-5 {
        bottom: 10px;
        left: -15px;
        width: 180px;
    }

    #anim-6 {
        bottom: 189px;
        left: -13px;
        width: 80px;
        transform: rotate(-15deg);
    }

    .choix-rsvp {
        flex-direction: column !important;
        align-items: center !important;
        gap: 15px !important;
        margin-top: 25px;
    }

    .bouton-coeur {
        width: 280px !important;
        max-width: 85vw;
        flex-direction: row;
        justify-content: flex-start;
        box-sizing: border-box;
        gap: 15px;
        background: var(--ivoire-carte);
        padding: 12px 20px;
        border-radius: 15px;
        border: 1px solid var(--rouge-texte);
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    }

    .bouton-coeur span {
        font-size: 1.1rem;
        line-height: 1.2;
        text-align: left;
    }

    .icone-coeur {
        width: 28px;
        height: 28px;
        margin-bottom: 0;
    }

    /* 🚨 ADAPTATION FORMULAIRE MOBILE */
    .boite-modale {
        width: 100%;
        height: 100%;
        max-width: none;
        border-radius: 0;
        border: none;
        padding: 40px 20px 25px 20px;
        /* Espace en haut pour le clavier */
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        /* Contenu aligné en haut */
        overflow-y: auto;
    }

    form {
        gap: 10px;
    }

    form input,
    form textarea {
        padding: 8px 10px;
        font-size: 0.95rem;
    }

    .titre-form {
        font-size: 2rem;
    }

    .actions-formulaire {
        margin-top: 15px;
        gap: 10px;
        flex-direction: column;
    }

    /* Règle générale pour les boutons de formulaire sur mobile */
    .btn-annuler,
    .btn-confirmer {
        width: 100%;
        padding: 10px;
        flex: none;
        /* Empêche l'étirement flexible */
    }

    /* 🚨 CORRECTION SPÉCIFIQUE POUR LE BOUTON "FERMER" DES POP-UPS DE SUCCÈS */
    .boite-modale .btn-fermer-popup {
        width: auto !important;
        /* Annule le 100% de largeur, s'adapte au texte */
        padding: 10px 30px;
        /* Redonne un padding correct */
        margin: 20px auto 0 auto !important;
        /* Centre le bouton horizontalement avec une marge en haut */
        align-self: center;
        /* Centre le bouton dans son conteneur flex */
    }
}