/**
 * ENGIM - Modale Contact
 * Styles de la modale de contact
 * 
 * @version 1.2
 */

/* ============================================================================
   VARIABLES
   ============================================================================ */
.contact-modal {
    --modal-blue-800: #0f2744;
    --modal-blue-600: #1a4d7c;
    --modal-blue-500: #1e5f99;
    --modal-accent: #f6c644;
    --modal-text: #333;
    --modal-text-light: #666;
    --modal-border: #e2e8f0;
    --modal-bg: #f8fafc;
    --modal-bg-white: #ffffff;
    --modal-success: #22c55e;
    --modal-error: #ef4444;
    --modal-radius: 16px;
    --modal-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
}

/* ============================================================================
   STRUCTURE PRINCIPALE
   ============================================================================ */

.contact-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.contact-modal--open {
    opacity: 1;
    visibility: visible;
}

/* Overlay gris/noir flouté */
.contact-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    cursor: pointer;
}

/* Container de la modale */
.contact-modal__container {
    position: relative;
    width: 94%;
    max-width: 640px;
    max-height: 90vh;
    background: var(--modal-bg);
    border-radius: var(--modal-radius);
    box-shadow: var(--modal-shadow);
    overflow: hidden;
    transform: translateY(20px) scale(0.95);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.contact-modal--open .contact-modal__container {
    transform: translateY(0) scale(1);
}

/* ============================================================================
   BOUTON FERMER
   ============================================================================ */

.contact-modal__close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    z-index: 10;
}

.contact-modal__close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

/* ============================================================================
   HEADER STYLE HERO (identique à la page d'accueil)
   ============================================================================ */

.contact-modal__header {
    position: relative;
    padding: 40px 32px 0;
    /* Gradient identique au hero */
    background: 
        url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.03)" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>'),
        linear-gradient(135deg, #0f2744 0%, #1a4d7c 50%, #1e5f99 100%);
    background-size: 100px 100px, cover;
    text-align: center;
    overflow: visible;
}

/* Overlay avec effets de lumière comme le hero */
.contact-modal__header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: 
        radial-gradient(ellipse at 30% 20%, rgba(245, 184, 0, 0.12) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 80%, rgba(41, 128, 185, 0.15) 0%, transparent 50%);
    pointer-events: none;
}

.contact-modal__header-content {
    position: relative;
    z-index: 2;
    padding-bottom: 50px;
}

.contact-modal__title {
    margin: 0 0 8px;
    font-size: 28px;
    font-weight: 700;
    color: #ffffff;
}

.contact-modal__title span {
    color: var(--modal-accent);
}

.contact-modal__subtitle {
    margin: 0;
    font-size: 15px;
    color: rgba(255, 255, 255, 0.8);
}

/* Vague SVG identique au hero */
.contact-modal__wave {
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    width: 100%;
    height: 40px;
    overflow: hidden;
}

.contact-modal__wave svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* ============================================================================
   FORMULAIRE
   ============================================================================ */

.contact-modal__form {
    padding: 16px 32px 32px;
    overflow-y: auto;
    flex: 1;
    background: var(--modal-bg);
}

/* Quand le formulaire est envoyé, cache les champs */
.contact-modal__form--sent .contact-modal__field,
.contact-modal__form--sent .contact-modal__row,
.contact-modal__form--sent .contact-modal__checkbox,
.contact-modal__form--sent .contact-modal__submit {
    display: none;
}

/* Champ individuel */
.contact-modal__field {
    margin-bottom: 14px;
}

.contact-modal__field--hidden {
    display: none;
}

.contact-modal__field label {
    display: block;
    margin-bottom: 5px;
    font-size: 13px;
    font-weight: 600;
    color: var(--modal-text);
}

.contact-modal__field label .required {
    color: var(--modal-error);
}

.contact-modal__field input,
.contact-modal__field select,
.contact-modal__field textarea {
    width: 100%;
    padding: 11px 14px;
    font-size: 14px;
    font-family: inherit;
    color: var(--modal-text);
    background: var(--modal-bg-white);
    border: 1px solid var(--modal-border);
    border-radius: 8px;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.contact-modal__field input:focus,
.contact-modal__field select:focus,
.contact-modal__field textarea:focus {
    outline: none;
    border-color: var(--modal-blue-600);
    box-shadow: 0 0 0 3px rgba(26, 77, 124, 0.1);
}

.contact-modal__field input::placeholder,
.contact-modal__field textarea::placeholder {
    color: #a0aec0;
}

.contact-modal__field select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

.contact-modal__field textarea {
    resize: vertical;
    min-height: 70px;
}

/* Ligne avec 2 champs côte à côte */
.contact-modal__row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}

/* Ligne avec 3 champs */
.contact-modal__row--three {
    grid-template-columns: 1fr 1fr 1fr;
}

/* ============================================================================
   CHECKBOX RGPD
   ============================================================================ */

.contact-modal__checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 18px 0;
    padding: 12px 14px;
    background: var(--modal-bg-white);
    border: 1px solid var(--modal-border);
    border-radius: 8px;
}

.contact-modal__checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 1px;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: var(--modal-blue-600);
}

.contact-modal__checkbox label {
    font-size: 12px;
    line-height: 1.5;
    color: var(--modal-text-light);
    cursor: pointer;
}

.contact-modal__checkbox label a {
    color: var(--modal-blue-600);
    text-decoration: underline;
}

.contact-modal__checkbox label a:hover {
    color: var(--modal-blue-500);
}

.contact-modal__checkbox .required {
    color: var(--modal-error);
}

/* ============================================================================
   BOUTON SUBMIT
   ============================================================================ */

.contact-modal__submit {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    color: var(--modal-blue-800);
    background: var(--modal-accent);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 14px rgba(246, 198, 68, 0.4);
}

.contact-modal__submit:hover:not(:disabled) {
    background: #e5b63d;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(246, 198, 68, 0.5);
}

.contact-modal__submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Spinner de chargement */
.contact-modal__spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ============================================================================
   MESSAGE DE SUCCÈS
   ============================================================================ */

.contact-modal__success {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 50px 20px;
    animation: fadeIn 0.4s ease;
}

.contact-modal__success svg {
    color: var(--modal-success);
    margin-bottom: 16px;
}

.contact-modal__success h3 {
    margin: 0 0 8px;
    font-size: 22px;
    font-weight: 700;
    color: var(--modal-text);
}

.contact-modal__success p {
    margin: 0;
    font-size: 15px;
    color: var(--modal-text-light);
}

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

/* ============================================================================
   STYLE BOUTON FOOTER (pour le lien Contact dans le footer)
   ============================================================================ */

.footer__contact-link {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
    color: inherit;
    cursor: pointer;
    text-decoration: none;
    display: inline;
}

.footer__contact-link:hover {
    text-decoration: underline;
}

/* ============================================================================
   STYLE BOUTON TOP BAR (pour le bouton Contactez-nous en haut)
   ============================================================================ */

button.top-bar__cta {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
    color: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 600px) {
    .contact-modal__container {
        width: 96%;
        max-height: 94vh;
        border-radius: 12px;
    }

    .contact-modal__header {
        padding: 28px 20px 0;
    }

    .contact-modal__header-content {
        padding-bottom: 40px;
    }

    .contact-modal__form {
        padding: 12px 20px 24px;
    }

    .contact-modal__row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .contact-modal__row--three {
        grid-template-columns: 1fr;
    }

    .contact-modal__title {
        font-size: 22px;
    }

    .contact-modal__close {
        top: 12px;
        right: 12px;
        width: 36px;
        height: 36px;
    }

    .contact-modal__wave {
        height: 35px;
    }
}
