/* Reset basique pour un rendu propre et moderne */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #ffffff;
    color: #1d1d1f;
    line-height: 1.5;
    padding: 40px 20px;
}

.main-container {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

/* Alignement du logo et du slogan principal */
.hero-section {
    margin-bottom: 50px;
}

.main-logo {
    max-width: 100%;
    height: auto;
    max-height: 280px;
    object-fit: contain;
}

.main-slogan {
    font-size: 1.8rem;
    font-weight: 700;
    margin-top: 20px;
    color: #000000;
}

/* Zone grise inspirée de la maquette mais épurée */
.search-section {
    margin-top: 30px;
}

.search-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: #1d1d1f;
}

.search-box-container {
    background-color: #f5f5f7;
    border-radius: 12px;
    padding: 30px 20px;
    border: 1px solid #e8e8ed;
}

.search-subtitle {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 15px;
    color: #515154;
}

/* Bloc d'entrée et bouton de validation alignés */
.search-form {
    max-width: 500px;
    margin: 0 auto;
}

.input-group {
    display: flex;
    flex-wrap: wrap; /* Permet le passage à la ligne sur mobile */
    background: #ffffff;
    border: 2px solid #d2d2d7;
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.2s ease;
}

.input-group:focus-within {
    border-color: #0071e3;
}

#certification-code {
    flex: 1 1 300px; /* Prend toute la place, mais bascule si l'espace est < 300px */
    border: none;
    padding: 14px 16px;
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    text-transform: uppercase;
}

#search-submit-btn {
    background-color: #ffffff;
    color: #000000;
    border: none;
    border-top: 2px solid #d2d2d7; /* Bordure par défaut pour le mobile (empilé) */
    padding: 14px 24px; /* Ajout d'un padding vertical pour le mobile */
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    cursor: pointer;
    flex: 1 1 auto; /* Permet au bouton de prendre toute la largeur sur mobile */
    min-width: 170px;
    transition: background-color 0.2s ease;
}

#search-submit-btn:disabled {
    background-color: #e8e8ed;
    color: #999999;
    cursor: not-allowed;
}

#search-submit-btn:hover {
    background-color: #f5f5f7;
}

/* Version Bureau / Écrans larges (côte à côte) */
@media (min-width: 768px) {
    #certification-code {
        flex: 1; /* Reprend son comportement d'étirement classique */
    }

    #search-submit-btn {
        flex: 0 0 auto; /* Ne s'étire plus inutilement */
        border-top: none; /* Supprime la bordure du haut */
        border-left: 2px solid #d2d2d7; /* Remet la bordure de séparation à gauche */
        padding: 0 24px; /* Restaure le padding d'origine */
    }
}

#trigger-form-btnb {
    border: 2px solid #d2d2d7;
    border-radius: 8px;
    padding: 14px 16px;
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    text-transform: uppercase;
    cursor: pointer;
}

/* États et messages de retour d'analyse de la BDD */
.result-display {
    margin-top: 20px;
    font-size: 1.25rem;
    font-weight: 700;
    padding: 10px;
    border-radius: 6px;
    animation: fadeIn 0.3s ease forwards;
}

.result-certified {
    color: #248a3d; /* Vert de certification propre */
}

.result-uncertified {
    color: #de350b; /* Rouge d'erreur propre */
}

.hidden {
    display: none !important;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}


/* Classes d'affichage pour la bascule d'éléments */
.hidden-element {
    display: none !important;
}

.fade-in-form {
    display: block !important;
    animation: fadeInForm 0.4s ease-out forwards;
    max-width: 600px;
    margin: 0 auto;
}

.form-instructions {
    text-align: center; 
    margin-bottom: 30px; 
    color: #515154;
}

/* -------------------------------------------------------------------------
   HOMOGÉNÉISATION ET DESIGN DU FORMULAIRE
   ------------------------------------------------------------------------- */

/* Conteneur global du formulaire */
#certification-form-block {
    background-color: #f5f5f7; /* Même fond gris clair que la recherche */
    border-radius: 12px;
    padding: 40px 30px;
    border: 1px solid #e8e8ed;
    max-width: 650px;
    margin: 30px auto 0 auto;
}

/* Grille de mise en page */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px 24px;
    margin-top: 20px;
    text-align: left; /* Aligne les textes et labels à gauche */
}

.grid-full {
    grid-column: span 2;
}

/* Structure des champs : Label au-dessus de l'Input */
.form-field {
    display: flex;
    flex-direction: column;
}

.form-field label {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: #515154; /* Gris textuel élégant */
    letter-spacing: 0.02em;
}

/* Style des inputs calqué sur la barre de recherche */
.form-field input {
    width: 100%;
    padding: 12px 16px;
    font-size: 1rem;
    font-family: inherit;
    background: #ffffff;
    border: 2px solid #d2d2d7;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Effet focus au clic identique à la recherche */
.form-field input:focus {
    border-color: #0071e3;
    background-color: #ffffff;
}


.infos-necessaires {
    font-size: 0.8rem;
}

/* -------------------------------------------------------------------------
   UNIFORMISATION DES CTA (BOUTONS)
   ------------------------------------------------------------------------- */

/* Bouton final de soumission du paiement */
.submit-payment-btn,
#trigger-form-btn {
    width: 100%;
    background-color: #000000; /* Unifié sur un style sobre et haut de gamme */
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 16px;
    border: 2px solid #000000;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 15px;
    text-transform: uppercase;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

#trigger-form-btn {
    width: auto;
    margin-left: auto;
    margin-right: auto;
}

.submit-payment-btn:hover,
#trigger-form-btn:hover {
    background-color: #ffffff;
    color: #000000;
}

.submit-payment-btn-price {
    white-space: nowrap;
}

/* Ajustement responsive pour les smartphones */
@media (max-width: 600px) {
    #certification-form-block {
        padding: 25px 15px;
    }
    .form-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .grid-full {
        grid-column: span 1;
    }
    .submit-payment-btn {
        font-size: 1rem;
        padding: 14px;
    }
}


/* -------------------------------------------------------------------------
   MODULE DE DÉPÔT DE MANUSCRIT (UPLOAD)
   ------------------------------------------------------------------------- */

.upload-box {
    background-color: #f5f5f7;
    border-radius: 12px;
    padding: 40px 30px;
    border: 1px solid #e8e8ed;
    max-width: 600px;
    margin: 40px auto;
    text-align: left;
}

.upload-info-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 15px;
    color: #1d1d1f;
}

.file-input-wrapper {
    overflow: hidden;
    position: relative;
    margin: 25px 0;
    background: #ffffff;
    border: 2px dashed #d2d2d7;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    transition: border-color 0.2s ease;
}

.file-input-wrapper:focus-within {
    border-color: #0071e3;
}

.file-input-hidden {
    width: 0.1px;
    height: 0.1px;
    opacity: 0;
    overflow: hidden;
    position: absolute;
    z-index: -1;
}

.form-field label.file-input-label {
    display: inline-block;
    background: #000000;
    color: #ffffff;
    padding: 10px 20px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    margin-bottom: 10px;
    transition: background-color 0.2s ease;
}

.file-input-label:hover {
    background: #222222;
}

.progress-container {
    display: none;
    margin-top: 20px;
    background: #e8e8ed;
    border-radius: 6px;
    overflow: hidden;
    height: 12px;
    width: 100%;
}

.progress-bar {
    background: #248a3d;
    height: 100%;
    width: 0%;
    transition: width 0.1s linear;
}

.progress-text {
    display: none;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    margin-top: 8px;
    color: #515154;
}

.status-msg-box {
    text-align: center;
    padding: 20px;
}

.certification-section {
    display: flex;
    flex-direction: column;
    gap:50px;
    padding-top: 50px;
}

.certification-blocs {
    display: flex;
    flex-direction: column;
    gap:50px;
    padding-top: 50px;
}

.certification-bloc {
    max-width: 750px;
    margin-left:auto;
    margin-right:auto;
    display:flex;
    gap:50px;
    flex-direction: column;
    text-align: center;
}

@media (min-width: 768px) {
    .certification-bloc {
        text-align: left;
        flex-direction: row;
        &.img-right {
            flex-direction: row-reverse;
        }
    }
    .certification-section-txts,
    .certification-bloc-media {
        flex:1 1 0%;
        text-align: justify;
        .img-right & {
            text-align: justify;
        }
        .txt-center & {
            text-align: center;
        }
    }
}

.section-title.txt-center {
    text-align: center;
}

.certification-bloc-media img {
    max-width: 100%;
}

#certification-info-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap:30px;
} 

.footer-notes-last {
    text-align: left;
}




/* RETRUN */ 
.success-box {
    background-color: #f5f5f7;
    border-radius: 12px;
    padding: 40px 30px;
    border: 1px solid #e8e8ed;
    max-width: 600px;
    margin: 40px auto;
    text-align: center;
}
.success-icon {
    color: #248a3d;
    font-size: 3.5rem;
    margin-bottom: 20px;
}
.order-reference {
    background: #ffffff;
    border: 2px dashed #d2d2d7;
    padding: 12px;
    font-size: 1.2rem;
    font-weight: 700;
    border-radius: 8px;
    margin: 25px 0;
    display: inline-block;
    letter-spacing: 0.05em;
}
.instructions-text {
    font-size: 1.1rem;
    color: #1d1d1f;
    line-height: 1.6;
    margin-bottom: 20px;
}

footer {
    margin-top: 4rem;
    display: -webkit-flex;
    display: -moz-flex;
    display: -ms-flex;
    display: -o-flex;
    display: flex;
    flex-direction :column;
    gap:0.5rem;
    font-size: 0.8rem;
}
footer a {
    text-decoration: none;
    color: #333;
}


dialog {
    position: relative;
    border: none;
    border-radius: 8px;
    padding: 0;
    max-width: 90vw;
    max-height: 85vh;
    margin: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

dialog::backdrop {
    background: rgba(0, 0, 0, 0.6);
}

.popin-header {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
}

.close-popin {
    background: transparent;
    border: none;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 8px 12px;
    color: #333;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.close-popin:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.popin-content {
    padding: 32px 24px 24px 24px;
    max-height: 85vh;
    overflow-y: auto;
    box-sizing: border-box;
}

.popin-content h1, .popin-content h2 {
    padding-bottom: 1em;
}

.popin-content h2 {
    padding-top: 1em;
}

.popin-content ul, 
.popin-content ol {
    margin-left: 0;
    padding-left: 1.25rem;
}

.popin-content li {
    /*margin-bottom: 0.5rem;*/
}

.legal-checkboxes-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 15px 0 20px 0;
}

.checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.checkbox-group input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    min-width: 16px;
    min-height: 16px;
    box-sizing: border-box;
    border: 1.5px solid #86868b;
    border-radius: 3px;
    outline: none;
    cursor: pointer;
    background-color: #fff;
    transition: border-color 0.15s ease, background-color 0.15s ease;
    margin: 2px 0 0 0;
    padding: 0;
    position: relative;
    flex-shrink: 0;
}

.checkbox-group input[type="checkbox"]:hover {
    border-color: #0071e3;
}

.checkbox-group input[type="checkbox"]:checked {
    background-color: #0071e3;
    border-color: #0071e3;
}

.checkbox-group input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 4px;
    height: 8px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-group input[type="checkbox"]:focus-visible {
    box-shadow: 0 0 0 2px rgba(0, 113, 227, 0.4);
}

.checkbox-group label {
    font-size: 0.85rem;
    line-height: 1.35;
    color: #1d1d1f;
    cursor: pointer;
    user-select: none;
}