/**
 * FICHE-PAIE.FR — Styles spécifiques : Page Contact
 *
 * @copyright 2025-2026 Purple Telecom EURL
 * @license   Proprietary - All Rights Reserved
 * @author    Fabien HIRIART <contact@polygonlab.ai>
 * @link      https://fiche-paie.fr
 */

/* ====================================
   HERO
   ==================================== */
.contact-hero {
    background: linear-gradient(135deg, #EEF3FA 0%, #E8F7F9 100%);
    border-bottom: 1px solid #D6E4F7;
    padding: 3rem 1.5rem;
    text-align: center;
}

.contact-hero-inner {
    max-width: 700px;
    margin: 0 auto;
}

.contact-hero h1 {
    font-size: clamp(1.75rem, 3.5vw, 2.5rem);
    font-weight: 700;
    color: #1D458C;
    margin-bottom: 0.75rem;
    line-height: 1.25;
}

.contact-hero-subtitle {
    font-size: 1.05rem;
    color: #4A5568;
    line-height: 1.6;
    margin: 0;
}

/* ====================================
   SECTION PRINCIPALE
   ==================================== */
.contact-section {
    padding: 3rem 1.5rem 4rem;
    background: #f8f9fa;
}

.contact-container {
    max-width: 900px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 768px) {
    .contact-container {
        grid-template-columns: 1fr 340px;
        gap: 2.5rem;
        align-items: start;
    }
}

/* ====================================
   WRAPPER FORMULAIRE
   ==================================== */
.contact-form-wrapper {
    background: #fff;
    border-radius: 12px;
    padding: 2rem 2rem 2.5rem;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
}

/* ====================================
   ALERTES SUCCÈS / ERREUR
   ==================================== */
.contact-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-radius: 8px;
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
}

.contact-alert svg {
    flex-shrink: 0;
    margin-top: 1px;
}

.contact-alert-success {
    background: #f0faf5;
    border: 1px solid #6fcf97;
    color: #1a7a45;
}

.contact-alert-error {
    background: #fff5f5;
    border: 1px solid #fc8181;
    color: #c53030;
}

/* ====================================
   CHAMPS DU FORMULAIRE
   ==================================== */
.contact-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Honeypot anti-spam */
.contact-honeypot {
    position: absolute;
    left: -9999px;
    top: -9999px;
    opacity: 0;
    pointer-events: none;
    tab-size: 0;
    height: 0;
    overflow: hidden;
}

.contact-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.contact-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #2D3748;
}

.contact-required {
    color: #E53E3E;
    margin-left: 2px;
}

.contact-input,
.contact-select,
.contact-textarea {
    width: 100%;
    padding: 0.65rem 0.9rem;
    font-size: 0.95rem;
    color: #2D3748;
    background: #fff;
    border: 1.5px solid #CBD5E0;
    border-radius: 8px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
    font-family: inherit;
    appearance: none;
}

.contact-input:focus,
.contact-select:focus,
.contact-textarea:focus {
    outline: none;
    border-color: #41BCC9;
    box-shadow: 0 0 0 3px rgba(65, 188, 201, 0.18);
}

.contact-input.is-invalid,
.contact-select.is-invalid,
.contact-textarea.is-invalid {
    border-color: #E53E3E;
    box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.12);
}

.contact-select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%231D458C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
}

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

.contact-field-error {
    font-size: 0.82rem;
    color: #E53E3E;
    min-height: 1rem;
}

/* ====================================
   BOUTON SUBMIT
   ==================================== */
.contact-submit-wrapper {
    margin-top: 0.5rem;
}

.contact-btn-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background: #41BCC9;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
    font-family: inherit;
    width: 100%;
}

.contact-btn-submit:hover:not(:disabled) {
    background: #31a9b7;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(65, 188, 201, 0.35);
}

.contact-btn-submit:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: none;
}

.contact-btn-submit:disabled {
    background: #7DA4D7;
    cursor: not-allowed;
    opacity: 0.75;
}

/* ====================================
   ENCART INFORMATIONS DE CONTACT
   ==================================== */
.contact-info-card {
    background: #fff;
    border-radius: 12px;
    padding: 1.75rem;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
    border-top: 3px solid #41BCC9;
}

.contact-info-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1D458C;
    margin-bottom: 1.5rem;
}

.contact-info-item {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    margin-bottom: 1.25rem;
    color: #4A5568;
}

.contact-info-item:last-child {
    margin-bottom: 0;
}

.contact-info-item svg {
    flex-shrink: 0;
    color: #41BCC9;
    margin-top: 2px;
}

.contact-info-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.2rem;
}

.contact-info-value {
    font-size: 0.95rem;
    color: #2D3748;
    text-decoration: none;
    font-weight: 500;
}

a.contact-info-value:hover {
    color: #41BCC9;
    text-decoration: underline;
}

/* ====================================
   RESPONSIVE MOBILE
   ==================================== */
@media (max-width: 480px) {
    .contact-form-wrapper {
        padding: 1.5rem 1.25rem;
    }

    .contact-info-card {
        padding: 1.5rem 1.25rem;
    }

    .contact-btn-submit {
        font-size: 0.95rem;
    }
}


/* Fix: forcer masquage des alertes par défaut */
.contact-alert[hidden] { display: none !important; }

/* ====================================
   BANDEAU IDENTITÉ SSO
   ==================================== */

.contact-identity-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #EEF3FA;
    border: 1px solid #C5D5EA;
    border-radius: 8px;
    margin-bottom: 0;
    font-size: 0.95rem;
    color: #1D458C;
    flex-wrap: wrap;
}

.contact-identity-banner[hidden] { display: none !important; }

.contact-identity-banner svg {
    flex-shrink: 0;
}

.contact-not-connected-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #FFF8E1;
    border: 1px solid #F9A825;
    border-radius: 8px;
    margin-bottom: 0;
    font-size: 0.9rem;
    color: #795548;
    flex-wrap: wrap;
}

.contact-not-connected-banner[hidden] { display: none !important; }

.contact-not-connected-banner svg {
    flex-shrink: 0;
}

/* ====================================
   SPINNER PLEIN ÉCRAN — ANALYSE IA
   ==================================== */

.contact-ia-spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.85);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: all;
}

.contact-ia-spinner-overlay[hidden] { display: none !important; }

.contact-ia-spinner-overlay.active {
    opacity: 1;
}

.contact-ia-spinner-content {
    text-align: center;
}

.contact-ia-spinner-ring {
    width: 48px;
    height: 48px;
    border: 4px solid #E2E8F0;
    border-top-color: #1D458C;
    border-radius: 50%;
    animation: contact-spinner-rotate 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes contact-spinner-rotate {
    to { transform: rotate(360deg); }
}

.contact-ia-spinner-text {
    color: #1D458C;
    font-size: 1rem;
    font-weight: 500;
}


/* ====================================
   SIRET — BLOC AUTO-COMPLÉTION
   ==================================== */

.contact-siret-section {
    background: #f8fbff;
    border: 1.5px solid #D6E4F7;
    border-radius: 10px;
    padding: 1.25rem 1.25rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.contact-siret-section[hidden] { display: none !important; }

.contact-siret-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.88rem;
    font-weight: 700;
    color: #1D458C;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.15rem;
}

.contact-siret-header svg {
    flex-shrink: 0;
    color: #41BCC9;
}

/* Wrapper relatif pour positionnement du loader */
.contact-siret-input-wrapper {
    position: relative;
}

.contact-siret-input-wrapper .contact-input {
    padding-right: 2.5rem;
}

/* Spinner de chargement */
.contact-siret-loader {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid #e5e7eb;
    border-top-color: #1D458C;
    border-radius: 50%;
    animation: contact-siret-spin 0.8s linear infinite;
    position: absolute;
    right: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
}

.contact-siret-loader.active {
    display: block;
}

@keyframes contact-siret-spin {
    to { transform: translateY(-50%) rotate(360deg); }
}

/* Message de statut sous le champ SIRET */
.contact-siret-message {
    font-size: 0.82rem;
    margin-top: 0.25rem;
    display: none;
}

.contact-siret-message.contact-siret-success {
    display: block;
    color: #22c55e;
    font-weight: 600;
}

.contact-siret-message.contact-siret-error {
    display: block;
    color: #9ca3af;
}

/* Résultats (champs auto-remplis) */
.contact-siret-results {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    padding-top: 0.25rem;
    border-top: 1px solid #D6E4F7;
    margin-top: 0.25rem;
}

.contact-siret-results[hidden] { display: none !important; }

/* Ligne CP + Ville côte à côte */
.contact-siret-row {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 0.75rem;
}

@media (max-width: 400px) {
    .contact-siret-row {
        grid-template-columns: 1fr;
    }
}

/* Champs auto-remplis via API */
.contact-input.contact-auto-filled {
    background: #f0fdf4 !important;
    border-color: #86efac !important;
    color: #166534;
    cursor: default;
}


/* ====================================
   CHAMP HINT (aide sous les inputs)
   ==================================== */
.contact-field-hint {
    font-size: 0.8rem;
    color: #718096;
    line-height: 1.4;
}

/* ====================================
   SECTION N° COMMANDE ("Problème sur une commande")
   ==================================== */
.contact-commande-section {
    background: #fffbf0;
    border: 1.5px solid #f6d860;
    border-radius: 10px;
    padding: 1.25rem 1.25rem 1rem;
}

.contact-commande-section[hidden] { display: none !important; }

/* ====================================
   MODAL IA GARDE-FOU
   ==================================== */

/* Overlay */
.contact-ia-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.contact-ia-overlay.contact-ia-overlay-visible {
    opacity: 1;
}

/* Modal elle-même */
.contact-ia-modal {
    background: #fff;
    border-radius: 12px;
    padding: 2rem;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* En-tête : icône + titre */
.contact-ia-modal-header {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.contact-ia-modal-icon {
    flex-shrink: 0;
}

.contact-ia-modal-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1D458C;
    margin: 0;
    line-height: 1.3;
}

/* Corps */
.contact-ia-modal-body {
    font-size: 0.95rem;
    color: #4A5568;
    line-height: 1.6;
    white-space: pre-wrap;
}

/* Pied de page : boutons */
.contact-ia-modal-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: flex-end;
}

/* Boutons */
.contact-ia-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: background 0.2s ease, opacity 0.2s ease;
    font-family: inherit;
}

.contact-ia-btn-primary {
    background: #41BCC9;
    color: #fff;
}

.contact-ia-btn-primary:hover {
    background: #31a9b7;
}

.contact-ia-btn-secondary {
    background: #EEF3FA;
    color: #1D458C;
}

.contact-ia-btn-secondary:hover {
    background: #D6E4F7;
}

/* Responsive mobile */
@media (max-width: 540px) {
    .contact-ia-modal {
        padding: 1.5rem 1.25rem;
        max-width: 90vw;
    }

    .contact-ia-modal-footer {
        flex-direction: column;
    }

    .contact-ia-btn {
        width: 100%;
        justify-content: center;
    }
}
