/*
 * Service THU — envoi de courrier.
 *
 * Feuille dédiée, chargée par les vues du tunnel uniquement. Elle ne contient
 * que ce que main.css n'a pas : le fil d'étapes, l'éditeur, la signature, les
 * cartes d'affranchissement et l'aperçu A4. Tout le reste (formulaires,
 * boutons, récapitulatif) réutilise les classes des tunnels existants.
 */

/* ---------------------------------------------------------- fil d'étapes */
.thu-steps {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 0;
    margin: 24px auto 32px;
    max-width: 640px;
}

.thu-steps__step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 0 0 auto;
    width: 96px;
    text-align: center;
}

.thu-steps__bullet {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid #dbe2f0;
    background: #fff;
    color: #98a4bd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
}

.thu-steps__step.is-current .thu-steps__bullet,
.thu-steps__step.is-done .thu-steps__bullet {
    background: #005ae0;
    border-color: #005ae0;
    color: #fff;
}

.thu-steps__label {
    margin-top: 8px;
    font-size: 13px;
    color: #98a4bd;
    line-height: 1.2;
}

.thu-steps__step.is-current .thu-steps__label {
    color: #1a1a1a;
    font-weight: 700;
}

.thu-steps__bar {
    flex: 1 1 auto;
    height: 2px;
    background: #dbe2f0;
    margin-top: 19px;
    min-width: 20px;
}

.thu-steps__bar.is-done {
    background: #005ae0;
}

/* ------------------------------------------------------ blocs du tunnel */
.thu-panel {
    background: #fff;
    border: 1px solid #dbe2f0;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
}

.thu-panel__head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #eef2f9;
}

.thu-panel__head__icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #eef4ff;
    color: #005ae0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex: 0 0 auto;
}

.thu-panel__head__title {
    font-size: 18px;
    font-weight: 700;
}

.thu-panel__head__subtitle {
    font-size: 14px;
    color: #6b7790;
}

/* type professionnel / particulier */
.thu-typeswitch {
    display: flex;
    gap: 24px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.thu-typeswitch label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 15px;
}

/* ---------------------------------------------- autocomplétion d'adresse */
.thu-autocomplete {
    position: relative;
}

.thu-autocomplete__list {
    position: absolute;
    z-index: 30;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    background: #fff;
    border: 1px solid #dbe2f0;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(16, 32, 64, .12);
    max-height: 260px;
    overflow-y: auto;
    margin: 0;
    padding: 4px 0;
    list-style: none;
}

.thu-autocomplete__item {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 15px;
}

.thu-autocomplete__item:hover,
.thu-autocomplete__item.is-active {
    background: #eef4ff;
}

/* --------------------------------------------------- rédaction & éditeur */
.thu-ai {
    background: #f6f3ff;
    border: 1px solid #ddd2ff;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 24px;
}

.thu-ai textarea {
    width: 100%;
    min-height: 110px;
    border: 1px solid #cfc2ff;
    border-radius: 6px;
    padding: 12px;
    font-size: 15px;
    font-family: inherit;
    resize: vertical;
}

.thu-ai__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-top: 14px;
    padding: 14px 20px;
    border: 0;
    border-radius: 40px;
    background: #5b25e0;
    color: #fff;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
}

.thu-ai__button[disabled] {
    opacity: .6;
    cursor: progress;
}

.thu-editor {
    border: 1px solid #dbe2f0;
    border-radius: 8px;
    overflow: hidden;
}

.thu-editor__toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px;
    background: #f4f6fa;
    border-bottom: 1px solid #dbe2f0;
}

.thu-editor__toolbar button {
    min-width: 36px;
    height: 34px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
}

.thu-editor__toolbar button:hover {
    border-color: #c9d5ea;
}

.thu-editor__toolbar__separator {
    width: 1px;
    background: #dbe2f0;
    margin: 4px 6px;
}

.thu-editor__area {
    min-height: 320px;
    max-height: 520px;
    overflow-y: auto;
    padding: 18px;
    font-size: 16px;
    line-height: 1.6;
    outline: none;
}

.thu-editor__area p {
    margin: 0 0 12px;
}

.thu-editor__area:empty::before {
    content: attr(data-placeholder);
    color: #98a4bd;
}

.thu-checkline {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px 0;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
}

.thu-checkline input {
    width: 22px;
    height: 22px;
}

.thu-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 8px;
}

.thu-actions button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    border: 1px solid #dbe2f0;
    border-radius: 8px;
    background: #fff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
}

.thu-actions button:hover {
    border-color: #005ae0;
    color: #005ae0;
}

/* --------------------------------------------------------- signature */
.thu-signature__tabs {
    display: flex;
    gap: 24px;
    border-bottom: 1px solid #dbe2f0;
    margin-bottom: 18px;
}

.thu-signature__tab {
    background: none;
    border: 0;
    border-bottom: 3px solid transparent;
    padding: 10px 2px;
    font-size: 17px;
    color: #98a4bd;
    cursor: pointer;
}

.thu-signature__tab.is-active {
    color: #1a1a1a;
    font-weight: 700;
    border-bottom-color: #1a1a1a;
}

.thu-signature__pad {
    width: 100%;
    height: 220px;
    background: #f3f3f3;
    border-radius: 8px;
    touch-action: none;
    cursor: crosshair;
    display: block;
}

.thu-signature__preview {
    max-width: 260px;
    max-height: 120px;
    margin-top: 12px;
}

/* ------------------------------------------------------ aperçu du courrier */
.thu-preview__backdrop {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(16, 24, 40, .6);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    padding: 24px 16px;
}

.thu-preview__dialog {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 720px;
    padding: 24px;
    position: relative;
}

.thu-preview__close {
    position: absolute;
    top: 16px;
    right: 20px;
    border: 0;
    background: none;
    font-size: 30px;
    line-height: 1;
    color: #98a4bd;
    cursor: pointer;
}

.thu-preview__title {
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 20px;
}

.thu-preview__frame {
    background: #333;
    padding: 0 24px;
    max-height: 60vh;
    overflow-y: auto;
}

/* la page A4 telle qu'elle sera imprimée : mêmes marges que pdfs/thu-letter */
.thu-page {
    background: #fff;
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    padding: 40px 44px;
    min-height: 735px;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 11px;
    line-height: 1.5;
    color: #000;
}

.thu-page__addresses {
    margin-bottom: 28px;
}

.thu-page__addresses__sender {
    text-align: left;
}

.thu-page__addresses__recipient {
    text-align: right;
    margin-top: 26px;
}

.thu-page__body p {
    margin: 0 0 8px;
}

.thu-page__signature {
    margin-top: 18px;
}

.thu-page__signature img {
    max-height: 60px;
}

/* --------------------------------------------- cartes d'affranchissement */
.thu-postage {
    border: 1px solid #dbe2f0;
    border-radius: 10px;
    padding: 22px;
    margin-bottom: 18px;
    cursor: pointer;
    display: block;
    position: relative;
}

.thu-postage.is-selected {
    border-color: #005ae0;
    box-shadow: 0 0 0 1px #005ae0;
}

.thu-postage__grid {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    flex-wrap: wrap;
}

.thu-postage__visual {
    flex: 0 0 150px;
}

.thu-postage__main {
    flex: 1 1 260px;
    min-width: 220px;
}

.thu-postage__name {
    font-size: 21px;
    font-weight: 700;
    margin-bottom: 12px;
}

.thu-postage__features {
    list-style: none;
    margin: 0 0 12px;
    padding: 0;
}

.thu-postage__features li {
    position: relative;
    padding-left: 22px;
    margin-bottom: 6px;
    font-size: 15px;
    color: #4a5568;
}

.thu-postage__features li::before {
    content: '\2713';
    position: absolute;
    left: 0;
    color: #e6b400;
    font-weight: 700;
}

.thu-postage__price {
    flex: 0 0 auto;
    font-size: 26px;
    font-weight: 700;
    white-space: nowrap;
}

.thu-postage__badge {
    position: absolute;
    top: -12px;
    left: 22px;
    background: #1a1a1a;
    color: #fff;
    border-radius: 20px;
    padding: 4px 14px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.thu-postage__badge--covered {
    background: #0a8f5b;
}

.thu-postage__options {
    border-top: 1px solid #eef2f9;
    margin-top: 20px;
    padding-top: 20px;
}

.thu-postage__options__title {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 14px;
}

/* --------------------------------------------------- envoi programmé */
.thu-schedule {
    background: #f6f4f0;
    border: 1px solid #e6e0d6;
    border-radius: 12px;
    padding: 22px;
}

.thu-schedule__notice {
    text-align: center;
    font-size: 14px;
    color: #6b7790;
    margin-bottom: 18px;
}

.thu-schedule__label {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 10px;
}

.thu-schedule__row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.thu-schedule__row input[type="date"] {
    flex: 1 1 220px;
    background: #fff;
}

.thu-schedule__today {
    color: #98a4bd;
    font-style: italic;
    margin-left: 8px;
}

/* ----------------------------------------------------------- messages */
.thu-alert {
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 18px;
    font-size: 15px;
}

.thu-alert--info {
    background: #eaf3ff;
    border: 1px solid #bcd8ff;
}

.thu-alert--error {
    background: #fdecec;
    border: 1px solid #f5b5b5;
    color: #a11919;
}

.thu-alert--success {
    background: #eafaf1;
    border: 1px solid #b5e6cd;
}

@media (max-width: 767px) {
    .thu-steps__step {
        width: 68px;
    }

    .thu-steps__label {
        font-size: 11px;
    }

    .thu-panel {
        padding: 16px;
    }

    .thu-postage__price {
        font-size: 22px;
    }
}

/* ------------------------------------------------- largeur du tunnel THU */
/*
 * Les tunnels existants réservent 35 % de la largeur à droite du formulaire.
 * Les étapes THU y logent deux blocs d'identité complets et trois cartes
 * d'affranchissement : on rend cette place au contenu, et la description
 * reprend sa place sous le formulaire.
 */
@media (min-width: 1024px) {
    .thu-funnel .services_detail__step_one_form {
        padding: 12px 24px 32px 24px;
    }
}

.thu-funnel .services_detail__step_one_form__fields__field {
    min-width: 0;
}
