/* =============================================================================
   FT Devis — bouton + modale wizard (6 steps accordéon)
   Toutes les règles sont préfixées .ft-devis- pour éviter conflits avec WP.
   ============================================================================= */

:root {
    --ftd-primary: #2563eb;
    --ftd-primary-dark: #1d4ed8;
    --ftd-success: #059669;
    --ftd-success-bg: #f0fdf4;
    --ftd-border: #e5e7eb;
    --ftd-muted: #6b7280;
    --ftd-heading: #111827;
    --ftd-error: #dc2626;
}

/* -- Wrapper toolbar (empile PDF + bouton devis dans la meme cellule) ---- */
.ft-toolbar-pdf-wrap {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    flex: 0 0 260px;      /* largeur fixe sur desktop, laisse la description respirer */
    max-width: 260px;
}

/* Sur mobile/tablette etroite : empile description + toolbar en colonne. */
@media (max-width: 768px) {
    .ft-sheet-wrap .ft-shortdesc-row {
        flex-direction: column !important;
    }
    .ft-toolbar-pdf-wrap {
        flex: 1 1 auto;
        max-width: 100%;
        width: 100%;
    }
}

/* -- Bouton "Demander un devis" — juste sous le bouton PDF --------------- */
.ft-devis-cta {
    display: block;
    text-align: center;
}
.ft-devis-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background: var(--ftd-primary);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background .15s ease, transform .05s ease;
    font-family: inherit;
    width: 100%;
    box-sizing: border-box;
}
.ft-devis-btn:hover { background: var(--ftd-primary-dark); }
.ft-devis-btn:active { transform: translateY(1px); }

/* -- Modale ----------------------------------------------------------------- */
.ft-devis-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: flex-start;
    justify-content: center;
    z-index: 99999;
    padding: 30px 16px;
    overflow-y: auto;
}
.ft-devis-modal.is-open { display: flex; }
.ft-devis-modal__backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .6);
    cursor: pointer;
}
.ft-devis-modal__dialog {
    position: relative;
    background: #fff;
    color: var(--ftd-heading);
    width: 100%;
    max-width: 720px;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .25);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
}
.ft-devis-modal__close {
    position: absolute;
    top: 10px;
    right: 14px;
    width: 32px;
    height: 32px;
    font-size: 26px;
    line-height: 1;
    background: transparent;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    z-index: 2;
}
.ft-devis-modal__close:hover { color: #374151; }

.ft-devis-modal__header {
    padding: 20px 28px 16px;
    border-bottom: 1px solid var(--ftd-border);
}
.ft-devis-modal__title {
    margin: 0 0 14px;
    font-size: 18px;
    font-weight: 700;
    color: var(--ftd-heading);
}

/* -- Récap produit (header) ------------------------------------------------ */
.ft-devis-product {
    display: flex;
    gap: 14px;
    align-items: center;
    padding: 10px;
    background: #f9fafb;
    border-radius: 6px;
}
.ft-devis-product__img {
    flex: 0 0 64px;
    height: 64px;
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ft-devis-product__img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.ft-devis-product__info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
    font-size: 12px;
    min-width: 0;
}
.ft-devis-product__info strong {
    font-size: 14px;
    color: var(--ftd-heading);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ft-devis-product__info span { color: #4b5563; }
.ft-devis-product__info small {
    color: #9ca3af;
    font-family: monospace;
    font-size: 10px;
}

/* -- Corps de la modale (wizard) ------------------------------------------ */
.ft-devis-modal__body {
    padding: 18px 24px 24px;
}

/* -- Steps (accordéon vertical) ------------------------------------------- */
.ft-step {
    border: 1px solid var(--ftd-border);
    border-radius: 8px;
    margin-bottom: 8px;
    overflow: hidden;
    transition: all .2s ease;
}
.ft-step.is-locked { opacity: .45; pointer-events: none; }
.ft-step.is-active { border-color: var(--ftd-primary); box-shadow: 0 1px 8px rgba(37, 99, 235, .12); }
.ft-step.is-done   { border-color: var(--ftd-success); }
.ft-step__header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    user-select: none;
    background: #fff;
}
.ft-step.is-done .ft-step__header { background: var(--ftd-success-bg); }
.ft-step__num {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    background: #d1d5db;
    flex-shrink: 0;
    transition: background .2s;
}
.ft-step.is-active .ft-step__num { background: var(--ftd-primary); }
.ft-step.is-done   .ft-step__num { background: var(--ftd-success); }
.ft-step__label { font-size: 14px; font-weight: 600; flex: 1; }
.ft-step__check {
    font-size: 18px;
    color: var(--ftd-success);
    display: none;
}
.ft-step.is-done .ft-step__check { display: block; }

.ft-step__body {
    display: none;
    padding: 4px 18px 18px;
    animation: ftSlide .25s ease;
}
.ft-step.is-active .ft-step__body { display: block; }
@keyframes ftSlide {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* -- Formulaires ----------------------------------------------------------- */
.ft-field {
    display: block;
    margin-bottom: 12px;
}
.ft-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #374151;
}
.ft-field input,
.ft-field textarea,
.ft-field select {
    width: 100%;
    padding: 9px 11px;
    font-size: 14px;
    border: 1px solid #d1d5db;
    border-radius: 5px;
    background: #fff;
    color: var(--ftd-heading);
    box-sizing: border-box;
    font-family: inherit;
}
.ft-field input:focus,
.ft-field textarea:focus,
.ft-field select:focus {
    outline: none;
    border-color: var(--ftd-primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, .18);
}
.ft-field--row {
    display: flex;
    gap: 12px;
}
.ft-field--row > * { flex: 1; }

/* Honeypot anti-spam */
.ft-hp {
    position: absolute !important;
    left: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* -- Jauge de complexité (step 2) ----------------------------------------- */
.ft-gauge { margin-bottom: 14px; }
.ft-gauge__bar {
    height: 8px;
    background: #f3f4f6;
    border-radius: 4px;
    overflow: hidden;
}
.ft-gauge__fill {
    height: 100%;
    width: 5%;
    background: #10b981;
    transition: width .3s ease, background .3s ease;
}
.ft-gauge__labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--ftd-muted);
    margin-top: 4px;
}

/* -- Options tier (classique / premium / haut de gamme) ------------------- */
.ft-opts {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.ft-opts__col {
    background: #f9fafb;
    border-radius: 6px;
    padding: 10px;
    border-top: 3px solid transparent;
}
.ft-opts__col--std { border-top-color: #10b981; }
.ft-opts__col--prm { border-top-color: #3b82f6; }
.ft-opts__col--hdg { border-top-color: #f59e0b; }
.ft-opts__title {
    font-size: 10px;
    font-weight: 700;
    color: #4b5563;
    margin-bottom: 8px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: .3px;
}
.ft-opt {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding: 6px 4px;
    font-size: 12px;
    cursor: pointer;
    border-radius: 4px;
    transition: background .1s;
}
.ft-opt:hover { background: rgba(0, 0, 0, .03); }
.ft-opt input { margin-top: 2px; flex-shrink: 0; }
.ft-opt.is-checked { background: rgba(37, 99, 235, .06); }

/* -- Matière / coloris ---------------------------------------------------- */
.ft-matcat {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}
.ft-matcat__btn {
    padding: 6px 12px;
    font-size: 12px;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #374151;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    transition: all .15s;
}
.ft-matcat__btn:hover { border-color: #9ca3af; }
.ft-matcat__btn.is-selected {
    background: var(--ftd-primary);
    color: #fff;
    border-color: var(--ftd-primary);
}
.ft-colgrid {
    display: none;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 6px;
}
.ft-colgrid.is-visible { display: grid; }
.ft-col {
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 4px;
    padding: 4px;
    text-align: center;
    transition: border-color .1s;
}
.ft-col:hover { border-color: #d1d5db; }
.ft-col.is-selected { border-color: var(--ftd-success); background: var(--ftd-success-bg); }
.ft-col img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
    border-radius: 3px;
    background: #fafafa;
}
.ft-col span {
    display: block;
    font-size: 10px;
    color: #4b5563;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* -- Recherche SIRENE ------------------------------------------------------ */
.ft-search {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}
.ft-search input { flex: 1; }
.ft-results {
    margin-top: 4px;
}
.ft-results:empty { display: none; }
/* Limite la hauteur UNIQUEMENT pour une liste de resultats SIRENE (scrollable),
   pas pour le mini-formulaire de saisie manuelle qui doit s'afficher entier. */
.ft-results.ft-results--list {
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid var(--ftd-border);
    border-radius: 5px;
}
.ft-result {
    padding: 10px 12px;
    border-bottom: 1px solid #f3f4f6;
    cursor: pointer;
    transition: background .1s;
}
.ft-result:last-child { border-bottom: none; }
.ft-result:hover { background: #f9fafb; }
.ft-result__name { font-weight: 600; color: var(--ftd-heading); }
.ft-result__details { font-size: 11px; color: var(--ftd-muted); margin-top: 2px; }

.ft-recap {
    padding: 10px 12px;
    background: #f9fafb;
    border: 1px solid var(--ftd-border);
    border-radius: 5px;
    margin-bottom: 12px;
    font-size: 12px;
    position: relative;
}
.ft-recap strong {
    display: block;
    font-size: 14px;
    color: var(--ftd-heading);
    margin-bottom: 2px;
}
.ft-recap small { color: var(--ftd-muted); }
.ft-recap-change {
    position: absolute;
    top: 8px;
    right: 10px;
    font-size: 11px;
    color: var(--ftd-primary);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
}

/* -- Boutons "Continuer" et "Envoyer" dans chaque step ------------------- */
.ft-next,
.ft-submit {
    margin-top: 12px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-family: inherit;
    background: var(--ftd-primary);
    color: #fff;
    transition: background .15s;
}
.ft-next:hover,
.ft-submit:hover { background: var(--ftd-primary-dark); }
.ft-next:disabled,
.ft-submit:disabled { background: #9ca3af; cursor: not-allowed; }

/* -- Messages -------------------------------------------------------------- */
.ft-error {
    padding: 10px 12px;
    background: #fef2f2;
    border-left: 3px solid var(--ftd-error);
    color: #991b1b;
    font-size: 13px;
    margin-bottom: 12px;
    border-radius: 3px;
}
.ft-loading {
    text-align: center;
    padding: 20px;
    color: var(--ftd-muted);
    font-size: 13px;
}

/* -- Succès ---------------------------------------------------------------- */
.ft-success {
    text-align: center !important;
    padding: 24px 12px !important;
}
/* Isole la typo du theme WP (Divi/Astra/Kadence peuvent imposer uppercase + custom fonts) */
.ft-success,
.ft-success * {
    font-family: inherit !important;
    text-transform: none !important;
    letter-spacing: normal !important;
}
.ft-success__icon {
    width: 52px !important;
    height: 52px !important;
    margin: 0 auto 16px !important;
    background: var(--ftd-success-bg) !important;
    color: var(--ftd-success) !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 28px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
}
.ft-success__title {
    font-size: 20px !important;
    font-weight: 700 !important;
    line-height: 1.3 !important;
    margin: 0 0 8px !important;
    padding: 0 !important;
    color: var(--ftd-heading) !important;
    text-align: center !important;
}
.ft-success__msg {
    color: var(--ftd-muted) !important;
    font-size: 14px !important;
    font-weight: 400 !important;
    line-height: 1.55 !important;
    margin: 0 0 16px !important;
    padding: 0 !important;
    text-align: center !important;
}
.ft-success__close {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-family: inherit;
    background: var(--ftd-primary);
    color: #fff;
}

/* -- Bandeau info (step 2 personnalisation) -------------------------------- */
.ft-info-banner {
    padding: 10px 12px;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 6px;
    color: #075985;
    font-size: 12px;
    line-height: 1.5;
    margin: 0 0 14px;
}

/* -- Récapitulatif (step 7) ------------------------------------------------ */
/* Layout column : visuel en haut (centre, plus grand), infos dessous.
   Plus lisible sur mobile (largeur etroite) et toujours correct en desktop. */
.ft-recap-product {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--ftd-border);
    border-radius: 8px;
    margin-bottom: 16px;
    background: #f9fafb;
}
.ft-recap-product__img {
    width: 100%;
    max-width: 240px;
    height: 200px;
    margin: 0 auto;
    background: #fff;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ft-recap-product__img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.ft-recap-product__info { display: flex; flex-direction: column; gap: 2px; font-size: 13px; min-width: 0; }
.ft-recap-product__info strong { font-size: 15px; color: var(--ftd-heading); }
.ft-recap-product__info span { color: #4b5563; }
.ft-recap-product__info small { color: #9ca3af; font-family: monospace; font-size: 10px; }
.ft-recap-product__desc {
    font-size: 12px;
    color: #4b5563;
    line-height: 1.5;
    margin: 6px 0 0;
}
.ft-recap-product__long {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #e5e7eb;
    font-size: 12px;
    color: #374151;
    line-height: 1.55;
}
.ft-recap-product__long strong { display: block; margin: 6px 0 2px; font-size: 11px; text-transform: uppercase; letter-spacing: .3px; color: #1f2937; }
.ft-recap-product__long ul { margin: 0 0 6px; padding-left: 18px; }
.ft-recap-product__long li { margin: 1px 0; }

.ft-recap-section {
    border: 1px solid var(--ftd-border);
    border-radius: 8px;
    margin-bottom: 12px;
    overflow: hidden;
}
.ft-recap-section__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 14px;
    background: #f3f4f6;
    border-bottom: 1px solid var(--ftd-border);
}
.ft-recap-section__title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .3px;
    color: #374151;
}
.ft-recap-section__edit {
    font-size: 12px;
    color: var(--ftd-primary);
    text-decoration: none;
    font-weight: 600;
}
.ft-recap-section__edit:hover { text-decoration: underline; }
.ft-recap-section__body { padding: 4px 0; }

.ft-recap-row {
    display: flex;
    gap: 12px;
    padding: 6px 14px;
    font-size: 13px;
    border-bottom: 1px solid #f3f4f6;
}
.ft-recap-row:last-child { border-bottom: none; }
.ft-recap-row__label {
    flex: 0 0 170px;
    color: #6b7280;
    font-size: 12px;
}
.ft-recap-row__value { flex: 1; color: var(--ftd-heading); }
.ft-recap-row__value a { color: var(--ftd-primary); text-decoration: none; }

/* -- Mobile ---------------------------------------------------------------- */
@media (max-width: 600px) {
    .ft-devis-modal { padding: 0; }
    .ft-devis-modal__dialog {
        min-height: 100vh;
        border-radius: 0;
        max-width: 100%;
    }
    .ft-field--row { flex-direction: column; }
    .ft-opts { grid-template-columns: 1fr; }
}
