/* Import de la police moderne Inter */
@import url('https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,300;14..32,400;14..32,500;14..32,600&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #1a0b2e 0%, #0f172a 100%);
    position: relative;
    overflow-x: hidden;
    padding: 1.5rem;
    perspective: 1200px;
}

/* Animation de fond */
body::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 40%, rgba(160, 140, 255, 0.15) 0%, transparent 30%),
                radial-gradient(circle at 80% 70%, rgba(120, 200, 255, 0.12) 0%, transparent 35%),
                radial-gradient(circle at 10% 80%, rgba(230, 180, 255, 0.1) 0%, transparent 40%);
    pointer-events: none;
    z-index: 0;
    animation: fondPulse 15s infinite alternate;
}

@keyframes fondPulse {
    0% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Particules flottantes */
.particles {
    position: absolute;
    inset: 0;
    overflow: hidden;
    z-index: 1;
}

.particle {
    position: absolute;
    width: 3px;
    height: 3px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    box-shadow: 0 0 8px 2px rgba(200, 180, 255, 0.5);
    animation: float 20s infinite linear;
    opacity: 0;
}

/* Étoiles filantes */
.shooting-star {
    position: absolute;
    width: 150px;
    height: 2px;
    background: linear-gradient(90deg, rgba(255,255,255,0.8), rgba(255,255,255,0));
    border-radius: 50%;
    filter: drop-shadow(0 0 10px #ffe9bb);
    animation: shoot 4s linear infinite;
    z-index: 5;
    opacity: 0;
}

.shooting-star::after {
    content: '';
    position: absolute;
    top: -3px;
    right: 0;
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 0 20px #ffd966;
}

@keyframes shoot {
    0% {
        transform: translateX(100vw) translateY(-10vh) rotate(25deg);
        opacity: 1;
    }
    100% {
        transform: translateX(-50vw) translateY(50vh) rotate(25deg);
        opacity: 0;
    }
}

@keyframes float {
    0% {
        transform: translateY(100vh) translateX(0);
        opacity: 0.2;
    }
    100% {
        transform: translateY(-20vh) translateX(15vw);
        opacity: 0;
    }
}

/* Animation d'apparition de la carte */
@keyframes apparitionCarte {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(0.95) rotateX(5deg);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1) rotateX(0);
    }
}

/* Carte principale avec animation 3D */
.carte-voeux {
    position: relative;
    z-index: 10;
    max-width: 600px;
    width: 100%;
    background: rgba(20, 15, 40, 0.4);
    backdrop-filter: blur(14px) saturate(180%);
    -webkit-backdrop-filter: blur(14px) saturate(180%);
    border: 1px solid rgba(220, 210, 255, 0.15);
    border-radius: 48px;
    padding: 3rem 2.2rem 2.8rem;
    box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(180, 160, 255, 0.1) inset;
    transition: all 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.1);
    animation: apparitionCarte 1.2s ease-out forwards;
    transform-style: preserve-3d;
    transform-origin: center center;
    will-change: transform;
}

/* Effet 3D au survol */
.carte-voeux:hover {
    transform: 
        perspective(1200px)
        rotateX(2deg)
        rotateY(4deg)
        translateZ(10px);
    box-shadow: 
        0 40px 80px -20px rgba(0, 0, 0, 0.9),
        0 0 0 1px rgba(220, 200, 255, 0.3) inset,
        20px 20px 40px rgba(0, 0, 0, 0.4);
}

/* Effet 3D encore plus prononcé selon l'ambiance */
.carte-voeux.ambiance-priere:hover {
    transform: 
        perspective(1200px)
        rotateX(2.5deg)
        rotateY(5deg)
        translateZ(15px);
    box-shadow: 
        0 40px 80px -20px rgba(0, 0, 0, 0.9),
        0 0 30px rgba(150, 130, 255, 0.5),
        20px 20px 40px rgba(0, 0, 0, 0.4);
}

.carte-voeux.ambiance-reussite:hover {
    transform: 
        perspective(1200px)
        rotateX(2deg)
        rotateY(4deg)
        translateZ(15px);
    box-shadow: 
        0 40px 80px -20px rgba(0, 0, 0, 0.9),
        0 0 30px rgba(255, 200, 80, 0.5),
        20px 20px 40px rgba(0, 0, 0, 0.4);
}

.carte-voeux.ambiance-tendresse:hover {
    transform: 
        perspective(1200px)
        rotateX(2deg)
        rotateY(4deg)
        translateZ(15px);
    box-shadow: 
        0 40px 80px -20px rgba(0, 0, 0, 0.9),
        0 0 30px rgba(255, 130, 200, 0.5),
        20px 20px 40px rgba(0, 0, 0, 0.4);
}

/* Classes pour les couleurs d'ambiance */
.carte-voeux.ambiance-priere {
    border-color: rgba(170, 150, 255, 0.5);
    box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.8), 0 0 30px rgba(150, 130, 255, 0.3);
}

.carte-voeux.ambiance-reussite {
    border-color: rgba(255, 215, 100, 0.5);
    box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.8), 0 0 30px rgba(255, 200, 80, 0.3);
}

.carte-voeux.ambiance-tendresse {
    border-color: rgba(255, 150, 200, 0.5);
    box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.8), 0 0 30px rgba(255, 130, 200, 0.3);
}

/* Titre principal */
.titre {
    font-size: clamp(2.5rem, 8vw, 3.4rem);
    font-weight: 300;
    letter-spacing: -0.02em;
    color: rgba(255, 255, 255, 0.95);
    line-height: 1.1;
    margin-bottom: 0.3rem;
    text-shadow: 0 0 15px rgba(210, 190, 255, 0.6);
    animation: titreApparition 1s ease-out 0.3s both;
    transform: translateZ(5px);
}

@keyframes titreApparition {
    0% {
        opacity: 0;
        transform: translateX(-20px) translateZ(-10px);
    }
    100% {
        opacity: 1;
        transform: translateX(0) translateZ(5px);
    }
}

.titre span {
    font-weight: 500;
    background: linear-gradient(130deg, #e0c9ff, #b1e5ff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 0 25px #b7a5ff;
    animation: titreGlow 3s infinite alternate;
}

@keyframes titreGlow {
    0% { text-shadow: 0 0 15px #b7a5ff; }
    100% { text-shadow: 0 0 30px #d4b5ff, 0 0 15px #a68eff; }
}

.sous-titre {
    font-size: 1rem;
    font-weight: 300;
    color: rgba(220, 210, 255, 0.7);
    letter-spacing: 1px;
    margin-bottom: 2.8rem;
    border-left: 2px solid rgba(200, 180, 255, 0.5);
    padding-left: 1rem;
    animation: sousTitreApparition 1s ease-out 0.5s both;
    transform: translateZ(3px);
}

@keyframes sousTitreApparition {
    0% {
        opacity: 0;
        transform: translateX(-15px) translateZ(-5px);
    }
    100% {
        opacity: 1;
        transform: translateX(0) translateZ(3px);
    }
}

/* Groupes de champs */
.groupe-champ {
    margin-bottom: 1.8rem;
    animation: champApparition 0.8s ease-out forwards;
    opacity: 0;
    transform: translateZ(2px);
}

.groupe-champ:nth-child(1) { animation-delay: 0.6s; }
.groupe-champ:nth-child(2) { animation-delay: 0.7s; }
.groupe-champ:nth-child(3) { animation-delay: 0.8s; }

@keyframes champApparition {
    0% {
        opacity: 0;
        transform: translateY(20px) translateZ(-10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0) translateZ(2px);
    }
}

.label-icone {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0.5rem;
    color: #cfc5ff;
    font-weight: 300;
    font-size: 0.95rem;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    transition: color 0.3s ease;
}

.label-icone span {
    font-size: 1.3rem;
    filter: drop-shadow(0 0 6px #bfa5ff);
    transition: transform 0.3s ease, filter 0.3s ease;
}

.groupe-champ:hover .label-icone span {
    transform: scale(1.2) rotate(5deg) translateZ(5px);
}

/* Champs de saisie */
input, textarea {
    width: 100%;
    background: rgba(12, 8, 25, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 26px;
    padding: 1rem 1.5rem;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 300;
    color: white;
    outline: none;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    box-shadow: 0 8px 18px -8px rgba(0,0,0,0.4);
    transform: translateZ(1px);
}

input::placeholder, textarea::placeholder {
    color: rgba(200, 190, 240, 0.45);
    font-weight: 300;
    font-style: italic;
}

input:focus, textarea:focus {
    border-color: #bcaaff;
    box-shadow: 0 0 22px -2px #a68eff, 0 0 0 1px #c8b5ff inset;
    background: rgba(22, 15, 40, 0.8);
    transform: scale(1.02) translateZ(5px);
}

textarea {
    min-height: 130px;
    resize: vertical;
    border-radius: 32px;
    line-height: 1.5;
}

/* Compteur de caractères */
.compteur-msg {
    text-align: right;
    font-size: 0.75rem;
    color: rgba(200, 190, 255, 0.5);
    margin-top: 6px;
    padding-right: 8px;
    font-weight: 300;
    letter-spacing: 0.2px;
    transition: color 0.3s ease;
}

.compteur-msg.proche-limite {
    color: #ffb5a0;
}

.compteur-msg.limite-atteinte {
    color: #ff7b7b;
    font-weight: 400;
}

/* Sélecteur d'ambiance */
.selecteur-ambiance {
    margin: 2.5rem 0 2.8rem;
    animation: selecteurApparition 0.8s ease-out 0.9s both;
    opacity: 0;
    transform: translateZ(4px);
}

@keyframes selecteurApparition {
    0% {
        opacity: 0;
        transform: translateY(20px) translateZ(-5px);
    }
    100% {
        opacity: 1;
        transform: translateY(0) translateZ(4px);
    }
}

.label-ambiance {
    display: block;
    margin-bottom: 1.2rem;
    color: #cbbfff;
    font-weight: 300;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-align: center;
    opacity: 0.8;
}

.pastilles {
    display: flex;
    justify-content: center;
    gap: 1.8rem;
    flex-wrap: wrap;
}

.pastille {
    background: rgba(25, 20, 45, 0.6);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(220, 200, 255, 0.15);
    padding: 0.7rem 1.6rem;
    border-radius: 60px;
    font-size: 1.2rem;
    font-weight: 400;
    color: #ece5ff;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: translateZ(2px);
}

.pastille input[type="radio"] {
    display: none;
}

.pastille:has(input:checked) {
    transform: scale(1.02) translateZ(8px);
    animation: pastilleSelection 0.4s ease;
}

/* Couleurs spécifiques pour chaque ambiance sélectionnée */
.pastille:has(input[value="priere"]:checked) {
    background: rgba(150, 130, 240, 0.35);
    border-color: #c6b3ff;
    box-shadow: 0 0 20px #906eff, 0 0 0 1px #dac3ff;
    color: white;
}

.pastille:has(input[value="reussite"]:checked) {
    background: rgba(240, 200, 80, 0.35);
    border-color: #ffd966;
    box-shadow: 0 0 20px #ffb347, 0 0 0 1px #ffe599;
    color: white;
}

.pastille:has(input[value="tendresse"]:checked) {
    background: rgba(255, 130, 200, 0.35);
    border-color: #ffa5d2;
    box-shadow: 0 0 20px #ff80bf, 0 0 0 1px #ffc0e0;
    color: white;
}

@keyframes pastilleSelection {
    0% { transform: scale(1) translateZ(2px); }
    50% { transform: scale(1.08) translateZ(15px); }
    100% { transform: scale(1.02) translateZ(8px); }
}

.pastille:hover {
    transform: translateY(-3px) translateZ(10px);
}

/* Bouton */
.bouton-envoi {
    display: flex;
    justify-content: center;
    margin: 2.2rem 0 1.8rem;
    animation: boutonApparition 0.8s ease-out 1s both;
    opacity: 0;
    transform: translateZ(6px);
}

@keyframes boutonApparition {
    0% {
        opacity: 0;
        transform: scale(0.9) translateZ(-10px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateZ(6px);
    }
}

.btn-etoile {
    background: rgba(0, 0, 0, 0.35);
    border: 1.5px solid rgba(240, 225, 255, 0.25);
    border-radius: 120px;
    padding: 1.1rem 2.8rem;
    font-size: 1.3rem;
    font-weight: 400;
    color: #f0ebff;
    letter-spacing: 2px;
    backdrop-filter: blur(10px);
    cursor: pointer;
    transition: all 0.4s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    box-shadow: 0 10px 25px -8px #1a0f30;
    text-transform: uppercase;
    width: fit-content;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
    transform: translateZ(5px);
}

.btn-etoile span {
    font-size: 2rem;
    line-height: 1;
    filter: drop-shadow(0 0 8px #ffe9bb);
    transition: transform 0.3s, filter 0.3s;
}

.btn-etoile::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-etoile:hover::before {
    width: 300px;
    height: 300px;
}

.btn-etoile:hover {
    background: rgba(80, 60, 170, 0.5);
    border-color: #e5d0ff;
    box-shadow: 0 0 40px #b492ff, 0 4px 20px #2f1d5e;
    color: white;
    transform: scale(1.02) translateZ(15px);
}

.btn-etoile:hover span {
    transform: rotate(5deg) scale(1.2) translateZ(5px);
    filter: drop-shadow(0 0 15px #ffdd88);
}

.btn-etoile:active {
    transform: scale(0.98) translateZ(2px);
}

/* Pied de page */
.pied-doux {
    text-align: center;
    color: rgba(210, 200, 255, 0.6);
    font-weight: 300;
    font-size: 0.9rem;
    margin-top: 2rem;
    border-top: 1px dashed rgba(200, 180, 255, 0.2);
    padding-top: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.8rem;
    animation: piedApparition 1s ease-out 1.1s both;
    opacity: 0;
    transform: translateZ(2px);
}

@keyframes piedApparition {
    0% {
        opacity: 0;
        transform: translateY(15px) translateZ(-5px);
    }
    100% {
        opacity: 1;
        transform: translateY(0) translateZ(2px);
    }
}

.citation {
    font-style: italic;
    letter-spacing: 0.3px;
}

.annee-lumiere {
    background: rgba(255,255,255,0.02);
    padding: 0.2rem 1rem;
    border-radius: 30px;
    font-weight: 200;
    border: 0.5px solid rgba(255,245,255,0.15);
}

/* Message de succès */
.message-succes {
    text-align: center;
    padding: 1.5rem;
    background: rgba(80, 200, 150, 0.2);
    border: 1px solid rgba(100, 255, 180, 0.3);
    border-radius: 40px;
    margin-top: 1rem;
    color: #b5ffd5;
    font-weight: 300;
    backdrop-filter: blur(10px);
    animation: messageApparition 0.5s ease;
    display: none;
    transform: translateZ(10px);
}

@keyframes messageApparition {
    0% {
        opacity: 0;
        transform: scale(0.8) translateZ(-10px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateZ(10px);
    }
}

.message-succes.visible {
    display: block;
}

.message-succes span {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
}

/* Canvas pour les confettis */
#canvas-confetti {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

/* Responsive */
@media (max-width: 500px) {
    .carte-voeux {
        padding: 2rem 1.3rem;
        border-radius: 36px;
    }
    .pastilles {
        gap: 1rem;
    }
    .pastille {
        padding: 0.6rem 1.2rem;
        font-size: 1rem;
    }
    .btn-etoile {
        padding: 0.9rem 2rem;
        font-size: 1.1rem;
    }
    .pied-doux {
        flex-direction: column;
        text-align: center;
    }
    
    .carte-voeux:hover {
        transform: 
            perspective(800px)
            rotateX(1deg)
            rotateY(2deg)
            translateZ(5px);
    }
}