﻿/* ===============================
    Structure générale
=============================== */
.scenario-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
    width: 100%;
    font-family: "Segoe UI", Roboto, Arial, sans-serif;
}

.step {
    display: none;
    flex-direction: column;
    width: 100%;
}
    .step.active {
        display: flex;
    }

.step-content {
    display: flex;
    gap: 24px;
    width: 100%;
    align-items: flex-start;
    box-sizing: border-box;
    flex-wrap: nowrap;
    min-height: 20vh;
}

.step-box {
    border: 2px solid #b51217;
    border-radius: 14px;
    padding: 32px 28px;
    background-color: #fff;
    box-shadow: 0 6px 16px rgba(0,0,0,0.08);
    position: relative;
    transition: all 0.3s ease-in-out;
}
    .step-box:hover {
        box-shadow: 0 8px 20px rgba(0,0,0,0.12);
    }

.step-title {
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #fff;
    padding: 4px 16px;
    border: 2px solid #b51217;
    border-radius: 20px;
    font-size: 1.1rem;
    font-weight: 500;
    color: #b51217;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
}

.step-card {
    border: 2px solid #b51217;
    border-radius: 10px;
    padding: 20px;
    background-color: #fff;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
}
/* ===============================
    Sous-sections du choix matière
=============================== */
.subsection {
    border: 1.5px solid #ccc;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 24px;
    background-color: #fafafa;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
}
    .subsection:hover {
        border-color: #b51217;
        box-shadow: inset 0 1px 4px rgba(181,18,23,0.15);
    }

.subsection-separator {
    border: 0;
    border-top: 2px dashed #bbb;
    margin: 32px 0;
}

.subsection-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #213864;
    margin-bottom: 16px;
    text-transform: uppercase;
}

.placeholder {
    font-style: italic;
    color: #666;
}

/* ===============================
    Colonnes
=============================== */
.step-left {
    flex: 0 0 38%;
    max-width: 38%;
    position: relative;
    box-sizing: border-box;
}
    .step-left input.form-control,
    .step-right input.form-control,
    .autocomplete-input {
        padding: 10px 14px;
        border: 1.5px solid #ccc;
        border-radius: 6px;
        font-size: 0.95rem;
        transition: border-color 0.2s ease, box-shadow 0.2s ease;
        box-sizing: border-box;
        margin: 0;
    }
        .step-left input.form-control:focus,
        .step-right input.form-control:focus,
        .autocomplete-input:focus {
            border-color: #b51217;
            box-shadow: 0 0 4px rgba(181, 18, 23, 0.18);
            outline: none;
        }

.step-right {
    flex: 1 1 62%;
    max-width: 62%;
    box-sizing: border-box;
    background-color: #f8f9fa;
    border: 2px solid #b51217;
    border-radius: 8px;
    padding: 16px;
    min-height: 200px;
    overflow: visible;
}
    .step-right.slide-in {
        transform: translateX(25px);
        opacity: 0;
    }

/* ===============================
    Boutons
=============================== */
.step-buttons {
    display: flex;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-top: 12px;
}

.btn-step {
    background-color: #e0e0e0;
    color: #000;
    border: 2px solid #b51217;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: 6px;
    transition: all 0.2s ease-in-out;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-top: 20px;
}

    .btn-step.btn-prev::before {
        content: "←";
        margin-right: 6px;
        font-size: 1.1em;
        color: #b51217;
    }

    .btn-step.btn-next::after {
        content: "→";
        margin-left: 6px;
        font-size: 1.1em;
        color: #b51217;
    }

    .btn-step:hover {
        background-color: #c0c0c0;
        border-color: #999;
    }

/* ===============================
    Autocomplete
=============================== */
.autocomplete-container {
    position: relative;
    width: 100%;
}
.autocomplete-input {
    width: 100%;
    padding: 8px 10px;
    border: 1.5px solid #ccc;
    border-radius: 6px 6px 0 0;
    font-size: 0.95rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
    margin: 0;
}
    .autocomplete-input:focus {
        border-color: #b51217;
        box-shadow: 0 0 4px rgba(181, 18, 23, 0.3);
        outline: none;
    }

.autocomplete-suggestions {
    border: 1.5px solid #b51217;
    border-top: none;
    background: #fff;
    position: absolute;
    top: calc(100% - 1px); /* colle proprement l'edge (supprime gap) */
    left: 0;
    z-index: 1200;
    width: 100%;
    max-height: 220px;
    overflow-y: auto;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    margin-top: 0;
    padding: 0;
}
    .autocomplete-suggestions:empty {
        display: none;
    }
    .autocomplete-suggestions div {
        padding: 6px 10px;
        cursor: pointer;
        font-size: 0.9rem;
        color: #333;
        transition: background-color 0.15s ease;
    }
        .autocomplete-suggestions div:hover {
            background-color: #f0f0f0;
        }

.autocomplete-group {
    display: flex;
    flex-direction: column;
}
    .autocomplete-group:first-child {
        flex: 0 0 59%;
    }
    .autocomplete-group:last-child {
        flex: 0 0 39%;
    }

.autocomplete-label {
    font-weight: 600;
    margin-bottom: 5px;
    color: #333;
}
/* ===============================
    Animation fade
=============================== */
.fade-target {
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
}

    .fade-target.visible {
        opacity: 1;
    }

.right-col.slide-in {
    transform: translateX(20px);
    transition: transform 0.4s ease-in-out;
}

.right-col {
    transition: transform 0.4s ease-in-out;
}

/* ===============================
    Table de détails
=============================== */
.table.details-table {
    border-collapse: collapse;
    width: 100%;
    margin-top: 10px;
    border-radius: 8px;
    overflow: hidden;
}

    .table.details-table th,
    .table.details-table td {
        padding: 8px 10px;
        text-align: center;
        border: 2px solid #c0c0c0;
        /* Forcer la couleur de texte si besoin */
        color: inherit !important;
        background-color: inherit !important;
    }

    .table.details-table thead {
        background-color: #f1f1f1 !important;
        color: #213864 !important;
    }

/* Lignes sans groupe : alternance grise pour visibilité */
.details-table tr:not([class*="groupe-"]):nth-child(even) {
    background-color: #f2f2f2;
}

/* ===============================
    Popup (modal)
=============================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}
    .modal-overlay.active {
        display: flex;
    }

.modal-content {
    background: #fff;
    border-radius: 10px;
    padding: 20px 28px;
    width: 90%;
    max-width: 800px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    position: relative;
    /*text-align: center;*/
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    background-color: #f8f9fa; 
    border-bottom: 1px solid #dee2e6;
}
    .modal-header h5 {
        margin: 0;
        color: #b51217;
        font-weight: 600;
    }

.modal-close {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: #666;
}
    .modal-close:hover {
        color: #b51217;
    }

.modal-footer {
    text-align: center;
    margin-top: 20px;
}

.btn-fermer {
    background-color: #b51217;
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
}

    .btn-fermer:hover {
        background-color: #991016;
    }

/* Bloc principal du haut du modal */
.modal-header-section {
    text-align: center;
    margin-bottom: 10px;
}

/* Groupe : fond coloré + grand texte */
.modal-groupe {
    display: inline-block;
    font-size: 2rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 6px 12px;
    border-radius: 8px;
    margin-bottom: 6px;
}

/* Type : texte coloré selon le groupe, sans fond */
.modal-type {
    display: block;
    font-size: 1.4rem;
    font-weight: 600;
    margin-top: 6px;
}
.th-like {
    text-transform: uppercase;
    color: #213864
}

/* Style responsive pour le modal */
.modal-dialog-responsive {
    width: 100%;
    max-width: 900px;
    margin: 1rem auto;
}

.modal-body {
    max-height: 70vh;
    overflow-y: auto;
    padding: 1rem;
}
    .modal-body .table-responsive {
        width: 100%;
        overflow-x: auto; 

    }

/* Responsive pour la première colonne */
.table-responsive .col-sous-groupe {
    min-width: 150px;
    max-width: 35%;
    white-space: normal;
    word-break: break-word;
}
.table-responsive table {
    width: 100%;
    table-layout: auto;
}

/* --- Colonne radio --- */
.table.details-table td:first-child,
.table.details-table th:first-child {
    width: 40px;
}


/* Étape 4 : disposition centrée */
.step-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 25px 15px;
}

/* Texte d’intro */
.proposition-text {
    font-size: 1.1rem;
    color: #213864;
    font-weight: bold;
    margin-bottom: 20px;
}

/* Bloc résultat */
/* Conteneur global de la proposition */
.proposition-result {
    border: 1px solid #b51217;
    padding: 12px 16px;
    border-radius: 8px;
    background-color: #f9f9f9;
    max-width: 900px;
    margin: 16px auto;
    font-family: Arial, sans-serif;
}

.prop-title {
    font-size: 1.5em;
    color: #b51217;
    margin-bottom: 16px;
}
.prop-label {
    margin-right: 8px;
}
.prop-details {
    font-size: 1.2em;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
    color: #333;
}
.prop-matiere {
    font-size: 1.2em;
    color: #333;
    margin-top: 4px;
}
#propRef {
    color: #b51217;
}

/* Conteneur pour Scenario 2 */
.step3-center {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px;
}
#step3 #propositionResult h4 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap; /* important !!! */
}
#step3 #propositionResult img {
    height: 45px;
    width: auto;
    max-width: 100%;
    flex-shrink: 0;
}

/* ===============================
   =============================== */

/* Petits écrans : smartphones portrait (<= 576px) */
@media (max-width: 576px) {
    .step-content {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .step-left, .step-right {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        width: 100% !important;
    }

    .plaquette-info {
        display: flex;
        align-items: center;
        gap: 16px;
        justify-content: flex-start;
        flex-wrap: nowrap;
    }

    #plaquetteImageContainer img {
        width: 140px;
        max-width: 100%;
        height: auto;
        filter: drop-shadow(0 2px 3px rgba(0,0,0,0.18));
    }

    .step-right {
        padding: 12px;
        min-height: auto;
    }

    .autocomplete-suggestions {
        max-height: 35vh;
    }

    .btn-step {
        font-size: 0.85rem !important;
        padding: 2px 6px !important;
        width: auto;
    }
        .btn-step.btn-prev::before,
        .btn-step.btn-next::after {
            font-size: 0.85em !important;
        }

    .subsection {
        padding: 12px;
        margin-bottom: 30px;
        border-radius: 8px;
    }
    .subsection-title {
        font-size: 0.9rem;
        margin-bottom: 10px;
    }
    .subsection-separator {
        margin: 18px 0;
        border-top-width: 1.5px;
    }

    .step-title {
        font-size: 0.9rem !important; 
        padding: 2px 10px !important;
    }

    #step3 .step-content {
        gap: 12px !important;
    }
    #step3 .step-left,
    #step3 .step-right {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
        padding: 12px !important;
    }

    #step3 .form-group {
        flex-direction: column !important;
        align-items: flex-start !important;
        width: 100%;
    }
    #step3 .label-cond {
        max-width: 100% !important;
        width: 100% !important;
        text-align: left !important;
        margin-bottom: 4px !important;
    }    
    #step3 .form-control,
    #step3 .input-cond {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 100% !important;
        font-size: 1rem;
    }
    #step3 .unit {
        margin-left: 0 !important;
        margin-top: 3px;
    }

    .step-center {
        padding: 10px 5px !important;
    }
    .proposition-text {
        font-size: 0.9rem !important;
    }
    .proposition-result {
        padding: 10px !important;
        max-width: 100% !important;
    }
    .prop-title {
        font-size: 1em !important;
        flex-direction: column;
        gap: 4px;
    }

    .step-center img {
        height: 28px !important;
        max-width: 100%;
    }
    .prop-details {
        font-size: 0.9em !important;
        flex-direction: column;
        align-items: center;
    }
    .prop-matiere {
        font-size: 0.9em !important;
    }

    #step3 #propositionResult h4 {
        flex-direction: column !important;
        align-items: center;
        gap: 4px;
    }
    #step3 #propositionResult img {
        height: 28px !important;
    }
    #propRef {
        font-size: 0.9rem !important;
    }

    .autocomplete-group {
        flex: 0 0 100% !important;
        width: 100% !important;
    }

    .autocomplete-label {
        font-size: 0.85rem !important;
        margin-bottom: 4px !important;
    }
    .autocomplete-input {
        font-size: 0.85rem !important;
        padding: 6px 9px !important;
        min-height: 34px !important;
    }
    .autocomplete-suggestions div {
        font-size: 0.85rem !important;
        padding: 6px 8px !important;
    }
    .autocomplete-container,
    .autocomplete-input,
    .autocomplete-suggestions {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box;
    }
    .table.details-table {
        font-size: 0.6rem !important;
    }
        .table.details-table th,
        .table.details-table td {
            padding: 2px 4px !important;
        }
    .table-responsive {
        overflow-x: auto !important;
    }

    .d-flex {
        display: block !important;
    }
}

/* Tablettes (<= 768px) */
@media (max-width: 768px) {
    .step-content {
        flex-direction: column;
        gap: 14px;
    }

    .plaquette-info {
        gap: 12px;
    }

    #plaquetteImageContainer img {
        width: 130px;
    }

    .btn-step {
        font-size: 0.8rem !important;
        padding: 2px 6px !important;
        width: auto;
    }
        .btn-step.btn-prev::before,
        .btn-step.btn-next::after {
            font-size: 1em !important;
        }

    .subsection {
        padding: 16px;
        margin-bottom: 40px;
    }
    .subsection-separator {
        margin: 24px 0;
    }
    .subsection-title {
        font-size: 0.9rem !important;
        margin-bottom: 12px;
    }
    .step-title {
        font-size: 1rem !important;
        padding: 3px 12px !important;
    }

    #step3 .step-content {
        flex-direction: column;
        gap: 16px !important;        
    }

    #step3 .step-left,
    #step3 .step-right {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        width: 100% !important;
        padding: 14px !important;
        min-height: auto;
    }

    #step3 .form-group {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        width: 100%;
    }

    #step3 .label-cond {
        max-width: 160px;
        font-size: 0.9rem;
    }

    #step3 .form-control,
    #step3 .input-cond {
        flex: 1 1 auto;
        max-width: 160px;
        font-size: 0.9rem;
        height: 1.9rem;
    }

    #step3 .unit {
        font-size: 0.9rem;
        margin-left: 6px;
        white-space: nowrap;
    }

    .proposition-result {
        max-width: 95% !important;
        padding: 8px !important;
    }
    .prop-title {
        font-size: 1.05em !important;
        display: flex;
        flex-wrap: wrap;
        text-align: center;
        gap: 6px;
    }

    .prop-details {
        font-size: 0.9em !important;
    }
    .prop-matiere {
        font-size: 0.9em !important;
    }
    .step-center img {
        height: 30px !important;
        max-width: 100%;
    }

    #step3 #propositionResult h4 {
        flex-direction: row;
        flex-wrap: wrap !important;
        text-align: center;
    }
    #step3 #propositionResult img {
        height: 35px !important;
    }
    #propRef {
        font-size: 1rem !important;
    }

    .autocomplete-row {
        flex-direction: column;
        gap: 14px;
    }
    .autocomplete-group {
        flex: 0 0 100% !important;
        width: 100% !important;
    }
    .autocomplete-input {
        font-size: 0.9rem !important;
        padding: 7px 10px;
    }
    .autocomplete-suggestions {
        max-height: 35vh !important;
        font-size: 0.9rem !important;
    }

    .table.details-table {
        font-size: 0.6rem !important;
    }
        .table.details-table th,
        .table.details-table td {
            padding: 2px 4px !important;
        }
    .table-responsive {
        overflow-x: auto !important;
    }

    .d-flex {
        display: block !important;
    }
}

/* Desktop : à partir de 769px on reprend côte-à-côte */
@media (min-width: 769px) {
    .step-content {
        flex-direction: row;
        flex-wrap: nowrap;
    }

    .step-left {
        flex: 0 0 38%;
        max-width: 38%;
    }

    .step-right {
        flex: 1 1 62%;
        max-width: 62%;
    }
}

/* Large screens: ajustements cosmétiques */
@media (min-width: 1200px) {
    .step-left {
        max-width: 36%;
        flex-basis: 36%;
    }

    .step-right {
        max-width: 64%;
        flex-basis: 64%;
        padding: 18px;
    }
}