/* ==========================================================================
   CONTACT.CSS
   ========================================================================== */

/* ===========================
   Contact container
=========================== */
.contact-container {
    padding: 6rem 2rem;
    display: flex;
    justify-content: center;
}

/* ===========================
   Boîte avec contour SVG animé (fluide)
=========================== */
.contact-line-box {
    position: relative;
    max-width: 780px;
    width: 100%;
}

/* SVG animé */
.contact-border {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

.contact-border rect {
    fill: none;
    stroke: #3b82f6;
    stroke-width: 1.5;
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    animation: borderLoopContact 8s linear infinite;
    filter: drop-shadow(0 0 6px #3b82f6);
    rx: 12;
    ry: 12;
}

@keyframes borderLoopContact {
    to { stroke-dashoffset: 0; }
}

/* ===========================
   Formulaire Contact
=========================== */
.contact-form {
    position: relative;
    z-index: 1;

    /* Optimisation : chemin relatif pour la production */
    background-image: url('../MEDIA/IMG/fond-contact.jpg');
    background-size: cover;
    background-position: center;

    border-radius: 1.25rem;
    padding: 5rem;
    width: 100%;

    /* Ombre néon comme les autres pages */
    box-shadow:
        0 0 20px rgba(0,0,0,0.15),
        0 0 35px rgba(59,130,246,0.25),
        0 0 55px rgba(96,165,250,0.18);

    border: 1px solid rgba(96,165,250,0.3);

    display: flex;
    flex-direction: column;
    gap: 2rem;

    overflow: hidden;
    animation: floatContact 6s ease-in-out infinite;
}

/* Overlay très léger */
.contact-form::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.06);
    border-radius: 1.25rem;
    z-index: 0;
}

@keyframes floatContact {
    0%,100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* ===========================
   Champs
=========================== */
.contact-form .form-row {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    position: relative;
    z-index: 1;
}

/* Labels */
.contact-form label {
    font-size: 1.35rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.3;
    text-shadow: 0 0 2px rgba(59,130,246,0.35);
}

/* Inputs, textarea & select (AJOUT DU SELECT) */
.contact-form input,
.contact-form textarea,
.contact-form select {
    padding: 1.05rem 3rem 1.05rem 1.3rem;
    font-size: 1.15rem;
    border-radius: 0.75rem;

    background-color: rgba(255,255,255,0.85);
    color: #0f172a;

    border: 1px solid rgba(59,130,246,0.4);
    outline: none;

    transition: border-color 0.3s, box-shadow 0.3s, transform 0.2s;
}

.contact-form textarea {
    min-height: 170px;
    resize: vertical;
}

/* AJOUT : Design premium du menu déroulant (masque la flèche par défaut, ajoute chevron SVG) */
.contact-form select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg fill='%233b82f6' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 28px;
    cursor: pointer;
}

.contact-form select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Focus */
.contact-form input:focus,
.contact-form textarea:focus,
.contact-form select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 8px rgba(59,130,246,0.5);
    transform: scale(1.01);
}

/* Invalide */
.contact-form input:invalid,
.contact-form textarea:invalid,
.contact-form select:invalid {
    border-color: #ef4444;
    box-shadow: 0 0 4px rgba(239,68,68,0.35);
}

/* ===========================
   Champ valide + animation
=========================== */
.contact-form input:valid,
.contact-form textarea:valid,
.contact-form select:valid {
    border-color: #22c55e;
    box-shadow: 0 0 6px rgba(34,197,94,0.45);
    animation: validPulse 0.4s ease-out;
}

@keyframes validPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 rgba(34,197,94,0);
    }
    50% {
        transform: scale(1.015);
        box-shadow: 0 0 10px rgba(34,197,94,0.6);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 6px rgba(34,197,94,0.45);
    }
}

/* ===========================
   Coche SVG animée (draw)
=========================== */
.contact-form .form-row::after {
    content: "";
    position: absolute;
    right: 1rem;
    top: calc(50% + 1.1rem);
    width: 18px;
    height: 14px;

    background-repeat: no-repeat;
    background-size: contain;

    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 18'><path d='M2 10 L9 16 L22 2' fill='none' stroke='%2322c55e' stroke-width='3' stroke-linecap='round' stroke-linejoin='round' stroke-dasharray='30' stroke-dashoffset='30'><animate attributeName='stroke-dashoffset' from='30' to='0' dur='0.35s' fill='freeze' /></path></svg>");

    transform: translateY(-50%) scale(0.6);
    opacity: 0;

    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
}

/* Apparition coche – moderne (AJOUT DU SELECT) */
.contact-form .form-row:has(input:valid)::after,
.contact-form .form-row:has(textarea:valid)::after,
.contact-form .form-row:has(select:valid)::after {
    opacity: 1;
    transform: translateY(-50%) scale(1);
}

/* Ajustement spécifique pour que la coche ne superpose pas le chevron du select */
.contact-form .form-row:has(select:valid)::after {
    right: 3rem;
}

/* Fallback sans :has() */
.contact-form input:valid,
.contact-form textarea:valid {
    background-image:
        linear-gradient(rgba(255,255,255,0.85), rgba(255,255,255,0.85)),
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 18'><path d='M2 10 L9 16 L22 2' fill='none' stroke='%2322c55e' stroke-width='3' stroke-linecap='round' stroke-linejoin='round' stroke-dasharray='30' stroke-dashoffset='30'><animate attributeName='stroke-dashoffset' from='30' to='0' dur='0.35s' fill='freeze' /></path></svg>");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 18px 14px;
}

/* ===========================
   Bouton
=========================== */
.contact-button {
    margin-top: 1.5rem;
    align-self: center;

    padding: 1rem 2.8rem;
    font-size: 1.15rem;
    font-weight: 600;

    color: #ffffff;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);

    border: none;
    border-radius: 0.75rem;
    cursor: pointer;

    box-shadow:
        0 0 12px rgba(59,130,246,0.4),
        0 0 22px rgba(96,165,250,0.3);

    transition: transform 0.3s, box-shadow 0.3s;
    z-index: 1;
    position: relative;
    overflow: hidden;
}

/* Hover */
.contact-button:hover {
    transform: translateY(-3px);
    box-shadow:
        0 0 18px rgba(59,130,246,0.5),
        0 0 28px rgba(96,165,250,0.4);   
}

/* ===========================
   Bouton désactivé si formulaire invalide
=========================== */
.contact-form:has(:invalid) .contact-button {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
    box-shadow: none;
}

/* ===========================
   Animation "Envoi..." au clic
=========================== */
.contact-button::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle, #fff 20%, transparent 21%) center / 8px 8px;
    opacity: 0;
    pointer-events: none;
}

.contact-button:active::after {
    opacity: 1;
    animation: sendLoader 1s linear infinite;
}

@keyframes sendLoader {
    from { background-position: 0 0; }
    to { background-position: 24px 0; }
}

/* ===========================
   AJOUT : Honeypot anti-spam (champ caché)
   - Le champ existe dans le DOM mais n'impacte pas le layout
   - À vérifier côté serveur : si rempli => spam probable
=========================== */
.hp-field{
    position: absolute;
    left: -10000px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* ===========================
   AJOUT : Ligne RGPD / confidentialité (sobre, pro)
=========================== */
.contact-legal{
    margin-top: 1rem;
    text-align: center;
    font-size: 0.95rem;
    color: #0f172a;
    opacity: 0.9;
    text-shadow: 0 0 2px rgba(59,130,246,0.20);
}

.contact-legal a{
    color: #0f172a;
    font-weight: 700;
    text-decoration: none;
    border-bottom: 1px solid rgba(59,130,246,0.35);
}

.contact-legal a:hover{
    border-bottom-color: rgba(59,130,246,0.70);
}

/* ===========================
   Responsive
=========================== */
@media (max-width: 750px) {
    .contact-form {
        padding: 3.5rem 2.5rem;
    }
}

@media (max-width: 480px) {
    .contact-form input,
    .contact-form textarea,
    .contact-form select {
        font-size: 1rem;
    }

    .contact-form label {
        font-size: 1.15rem;
    }
}

/* ===========================
   Confort : réduit les animations si demandé par l'utilisateur
=========================== */
@media (prefers-reduced-motion: reduce) {
    .contact-form,
    .contact-border rect,
    .contact-form input,
    .contact-form textarea,
    .contact-form select,
    .contact-button {
        animation: none !important;
        transition: none !important;
    }
}