/* ==================================================================
   WFACTURA - Pages Support
   - Liste des tickets  : prefixe .wfs-
   - Detail d'un ticket : prefixe .wft-
   Design moderne, epure et ergonomique. Couleur dominante : vert.
   Chargee apres main.css. Toutes les regles sont isolees sous
   .wfs-page / .wft-page afin de ne jamais toucher le reste de l'admin.
   ================================================================== */

.wfs-page,
.wft-page{
    --wfs-green:       #0F893E;
    --wfs-green-600:   #0B6E31;
    --wfs-green-700:   #075427;
    --wfs-green-deep:  #043D1C;
    --wfs-green-bright:#16A34A;
    --wfs-green-50:    #EEF7F0;
    --wfs-green-100:   #DCF0E3;
    --wfs-ink:         #14202B;
    --wfs-muted:       #667085;
    --wfs-line:        #E4EDE6;
    --wfs-radius:      18px;

    min-height: calc(100vh - 64px);
    padding: 22px 22px 40px;
    background:
        radial-gradient(circle at 10% -10%, rgba(15,137,62,.08), transparent 42%),
        radial-gradient(circle at 100% 0%, rgba(22,163,74,.06), transparent 38%),
        #f3f7f4;
}

/* ==================================================================
   FIL D'ARIANE
   ================================================================== */
.wfs-crumb{
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 14px;
    padding: 0;
    list-style: none;
    color: var(--wfs-muted);
    font-size: 13px;
}

.wfs-crumb a{
    color: var(--wfs-muted);
    text-decoration: none;
    transition: color .18s ease;
}

.wfs-crumb a:hover{
    color: var(--wfs-green-700);
}

.wfs-crumb .wf-crumb-sep{
    color: #c3ccc6;
}

/* ==================================================================
   BANDEAU (hero)
   ================================================================== */
.wfs-hero{
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
    padding: 26px 28px;
    border-radius: var(--wfs-radius);
    background:
        radial-gradient(120% 150% at 8% -20%, rgba(74,222,128,.35), transparent 55%),
        linear-gradient(135deg, #075427 0%, #0F893E 58%, #16A34A 100%);
    box-shadow: 0 20px 44px rgba(7,84,39,.24);
    color: #ffffff;
}

.wfs-hero::after{
    content: "";
    position: absolute;
    top: -120px;
    right: -80px;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,.16), transparent 65%);
    pointer-events: none;
}

.wfs-hero-main{
    position: relative;
    z-index: 1;
    max-width: 560px;
}

.wfs-kicker{
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 13px;
    margin-bottom: 14px;
    border-radius: 999px;
    background: rgba(255,255,255,.14);
    border: 1px solid rgba(255,255,255,.22);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.wfs-kicker::before{
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 0 4px rgba(74,222,128,.20);
}

.wfs-title{
    margin: 0 0 8px;
    font-size: 30px;
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -0.03em;
    color: #ffffff;
}

.wfs-hero-text{
    margin: 0;
    max-width: 520px;
    color: rgba(240,255,246,.82);
    font-size: 14px;
    line-height: 1.7;
}

/* Compteurs */
.wfs-hero-stats{
    position: relative;
    z-index: 1;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.wfs-stat{
    min-width: 98px;
    padding: 13px 16px;
    border-radius: 14px;
    background: rgba(255,255,255,.14);
    border: 1px solid rgba(255,255,255,.24);
    -webkit-backdrop-filter: blur(6px);
            backdrop-filter: blur(6px);
}

.wfs-stat-value{
    display: block;
    font-size: 22px;
    font-weight: 800;
    line-height: 1;
}

.wfs-stat-label{
    display: block;
    margin-top: 5px;
    color: rgba(255,255,255,.82);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
}

/* ==================================================================
   CARTE PRINCIPALE
   ================================================================== */
.wfs-body{
    margin-top: 20px;
}

.wfs-card{
    overflow: hidden;
    border: 1px solid var(--wfs-line);
    border-radius: var(--wfs-radius);
    background: #ffffff;
    box-shadow: 0 14px 34px rgba(15,23,42,.05);
}

.wfs-card-head{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    padding: 18px 22px;
    border-bottom: 1px solid var(--wfs-line);
}

.wfs-card-title{
    margin: 0 0 4px;
    color: var(--wfs-ink);
    font-size: 17px;
    font-weight: 750;
    letter-spacing: -0.01em;
}

.wfs-card-note{
    margin: 0;
    color: var(--wfs-muted);
    font-size: 13px;
    line-height: 1.5;
}

.wfs-card-body{
    padding: 6px 12px 12px;
}

/* ==================================================================
   ALERTES
   ================================================================== */
.wfs-alert{
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding: 12px 15px;
    border: 1px solid #ccebd9;
    border-radius: 12px;
    background: #ecfdf3;
    color: #166534;
    font-size: 13px;
    font-weight: 600;
}

.wfs-alert i{
    font-size: 15px;
}

.wfs-alert--info{
    border-color: #cfe0fb;
    background: #eff5ff;
    color: #1d4ed8;
}

/* ==================================================================
   TABLEAU
   ================================================================== */
.wfs-table{
    width: 100%;
    min-width: 920px;
    margin: 0 !important;
    border-collapse: separate !important;
    border-spacing: 0;
}

.wfs-table thead th{
    padding: 13px 16px !important;
    border-top: 0 !important;
    border-bottom: 1px solid var(--wfs-line) !important;
    background: #f7faf8;
    color: #5b6b62;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
    vertical-align: middle !important;
    white-space: nowrap;
}

.wfs-table tbody td{
    padding: 14px 16px !important;
    border-top: 1px solid #eef2ef !important;
    color: #344054;
    font-size: 13.5px;
    vertical-align: middle !important;
    white-space: nowrap;
}

.wfs-table tbody tr:first-child td{
    border-top: 0 !important;
}

.wfs-table tbody tr{
    transition: background .15s ease;
}

.wfs-table tbody tr:hover td{
    background: #f6fbf8;
}

/* Cellules */
.wfs-code{
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 3px 10px;
    border: 1px solid var(--wfs-green-100);
    border-radius: 8px;
    background: var(--wfs-green-50);
    color: var(--wfs-green-700);
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .03em;
}

.wfs-subject{
    display: block;
    max-width: 340px;
    overflow: hidden;
    color: var(--wfs-ink);
    font-size: 13.5px;
    font-weight: 650;
    text-overflow: ellipsis;
}

.wfs-date{
    color: #5b6b62;
    font-size: 13px;
    font-weight: 600;
}

.wfs-dept{
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 3px 10px;
    border: 1px solid var(--wfs-line);
    border-radius: 999px;
    background: #f5f8f6;
    color: #4b5563;
    font-size: 11.5px;
    font-weight: 700;
}

/* Pastilles de statut */
.wfs-status{
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 26px;
    padding: 3px 11px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    white-space: nowrap;
}

.wfs-status i{
    font-size: 11px;
    line-height: 1;
}

/* Ouvert : orange */
.wfs-status-open{
    border: 1px solid #ffd6b0;
    background: #fff3e6;
    color: #c2410c;
}

/* Répondu : vert */
.wfs-status-answered{
    border: 1px solid #cdebdc;
    background: #eefaf2;
    color: #0B6E31;
}

/* Fermé : rouge */
.wfs-status-closed{
    border: 1px solid #fecdca;
    background: #fef3f2;
    color: #b42318;
}

/* États neutres éventuels */
.wfs-status-neutral,
.wfs-status-waiting{
    border: 1px solid #e2e6ea;
    background: #f4f6f7;
    color: #5b6b62;
}

/* ==================================================================
   BOUTONS
   ================================================================== */
.wfs-btn{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 36px;
    padding: 0 14px;
    border: 1px solid transparent;
    border-radius: 10px;
    box-shadow: none !important;
    font-size: 13px;
    font-weight: 650;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.wfs-btn i{
    font-size: 13px;
}

.wfs-btn-primary{
    border-color: var(--wfs-green);
    background: linear-gradient(135deg, #0F893E 0%, #0B6E31 100%);
    color: #ffffff;
    box-shadow: 0 10px 20px rgba(15,137,62,.22) !important;
}

.wfs-btn-primary:hover{
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 14px 26px rgba(15,137,62,.28) !important;
}

.wfs-btn-soft{
    border-color: var(--wfs-green-100);
    background: var(--wfs-green-50);
    color: var(--wfs-green-700);
}

.wfs-btn-soft:hover{
    border-color: #c4e4d2;
    background: #e2f2e8;
    color: var(--wfs-green-700);
    transform: translateY(-1px);
}

/* ==================================================================
   DETAIL D'UN TICKET
   ================================================================== */
.wft-top{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.wft-top .wfs-crumb{
    margin: 0;
}

.wft-grid{
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 20px;
    align-items: start;
}

.wft-conv{
    overflow: hidden;
    border: 1px solid var(--wfs-line);
    border-radius: var(--wfs-radius);
    background: #ffffff;
    box-shadow: 0 14px 34px rgba(15,23,42,.05);
}

.wft-conv-head{
    position: relative;
    overflow: hidden;
    padding: 22px 24px;
    background:
        radial-gradient(120% 160% at 90% -30%, rgba(74,222,128,.30), transparent 55%),
        linear-gradient(135deg, #075427 0%, #0F893E 62%, #16A34A 100%);
    color: #ffffff;
}

.wft-conv-head-top{
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.wft-code{
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    margin-bottom: 10px;
    padding: 3px 10px;
    border: 1px solid rgba(255,255,255,.30);
    border-radius: 8px;
    background: rgba(255,255,255,.16);
    color: #ffffff;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .03em;
}

.wft-subject{
    margin: 0 0 10px;
    color: #ffffff;
    font-size: 22px;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.wft-meta{
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
    color: rgba(255,255,255,.86);
    font-size: 12.5px;
    font-weight: 600;
}

.wft-meta i{
    margin-right: 5px;
}

.wft-meta .wfs-status{
    background: rgba(255,255,255,.16);
    border-color: rgba(255,255,255,.30);
    color: #ffffff;
    min-height: 24px;
}

/* Fil de conversation */
.wft-thread{
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 22px 24px;
    background: #f7faf8;
}

.wft-msg{
    display: flex;
    align-items: flex-start;
    gap: 11px;
    max-width: 88%;
}

.wft-msg--user{
    align-self: flex-start;
}

.wft-msg--agent{
    align-self: flex-end;
    flex-direction: row-reverse;
}

.wft-avatar{
    display: flex;
    flex: 0 0 38px;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #e7edf0;
    color: #475467;
    font-size: 12px;
    font-weight: 800;
}

.wft-msg--agent .wft-avatar{
    background: var(--wfs-green);
    color: #ffffff;
}

.wft-msg-body{
    min-width: 0;
}

.wft-msg-top{
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 14px;
    margin: 0 4px 6px;
}

.wft-msg--agent .wft-msg-top{
    flex-direction: row-reverse;
}

.wft-author{
    color: var(--wfs-ink);
    font-size: 12.5px;
    font-weight: 700;
}

.wft-role{
    margin-left: 6px;
    color: #98a2b3;
    font-size: 10.5px;
    font-weight: 600;
}

.wft-msg--agent .wft-role{
    margin-right: 6px;
    margin-left: 0;
}

.wft-date{
    color: #98a2b3;
    font-size: 10.5px;
    font-weight: 500;
    white-space: nowrap;
}

.wft-bubble{
    padding: 12px 15px;
    border-radius: 14px;
    color: #344054;
    font-size: 13.5px;
    line-height: 1.6;
    word-break: break-word;
}

.wft-msg--user .wft-bubble{
    border: 1px solid var(--wfs-line);
    border-top-left-radius: 4px;
    background: #ffffff;
}

.wft-msg--agent .wft-bubble{
    border-top-right-radius: 4px;
    background: linear-gradient(135deg, #0F893E 0%, #0B6E31 100%);
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(15,137,62,.20);
}

/* Etat vide */
.wft-empty{
    padding: 46px 24px;
    color: var(--wfs-muted);
    text-align: center;
}

.wft-empty-icon{
    display: flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    margin: 0 auto 12px;
    border-radius: 15px;
    background: var(--wfs-green-50);
    color: var(--wfs-green);
    font-size: 22px;
}

.wft-empty h3{
    margin: 0 0 5px;
    color: #344054;
    font-size: 15px;
    font-weight: 700;
}

.wft-empty p{
    margin: 0;
    font-size: 12.5px;
}

/* Zone de reponse */
.wft-reply{
    padding: 20px 24px;
    border-top: 1px solid var(--wfs-line);
    background: #ffffff;
}

.wft-reply-alert{
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 14px;
    padding: 11px 13px;
    border: 1px solid #ccebd9;
    border-radius: 11px;
    background: #ecfdf3;
    color: #166534;
    font-size: 12.5px;
    font-weight: 600;
}

.wft-reply h3{
    margin: 0 0 4px;
    color: var(--wfs-ink);
    font-size: 15px;
    font-weight: 750;
}

.wft-reply p{
    margin: 0 0 12px;
    color: var(--wfs-muted);
    font-size: 12px;
}

.wft-textarea{
    display: block;
    width: 100%;
    min-height: 120px;
    padding: 12px 14px;
    border: 1.5px solid var(--wfs-line);
    border-radius: 12px;
    background: #fbfdfb;
    color: var(--wfs-ink);
    box-shadow: none !important;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.wft-textarea::placeholder{
    color: #9aa7b2;
}

.wft-textarea:focus{
    outline: none;
    border-color: var(--wfs-green);
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(15,137,62,.12) !important;
}

.wft-reply-actions{
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 14px;
}

/* Ticket cloture */
.wft-closed{
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 24px;
    border-top: 1px solid var(--wfs-line);
    background: #f7faf8;
    color: #475467;
}

.wft-closed-icon{
    display: flex;
    flex: 0 0 34px;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--wfs-green-50);
    color: var(--wfs-green-700);
}

.wft-closed strong{
    display: block;
    margin-bottom: 2px;
    color: #344054;
    font-size: 13px;
}

.wft-closed span{
    font-size: 12px;
    line-height: 1.5;
}

/* Panneau lateral */
.wft-side{
    position: sticky;
    top: 84px;
    overflow: hidden;
    border: 1px solid var(--wfs-line);
    border-radius: var(--wfs-radius);
    background: #ffffff;
    box-shadow: 0 14px 34px rgba(15,23,42,.05);
}

.wft-side-head{
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--wfs-line);
    color: var(--wfs-ink);
    font-size: 15px;
    font-weight: 750;
}

.wft-side-head i{
    color: var(--wfs-green);
}

.wft-info{
    padding: 6px 20px 14px;
}

.wft-info-row{
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 12px 0;
    border-bottom: 1px dashed #eef2ef;
}

.wft-info-row:last-child{
    border-bottom: 0;
}

.wft-info-label{
    color: #98a2b3;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.wft-info-value{
    color: #344054;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.5;
    word-break: break-word;
}

/* ==================================================================
   RESPONSIVE
   ================================================================== */
@media (max-width: 991.98px){
    .wfs-page,
    .wft-page{
        padding: 18px 16px 32px;
    }

    .wft-grid{
        grid-template-columns: 1fr;
    }

    .wft-side{
        position: static;
    }
}

@media (max-width: 767.98px){
    .wfs-hero,
    .wft-conv-head{
        padding: 20px;
    }

    .wfs-title{
        font-size: 25px;
    }

    .wfs-hero-stats{
        width: 100%;
    }

    .wfs-stat{
        flex: 1 1 0;
        min-width: 0;
    }

    .wft-subject{
        font-size: 19px;
    }

    .wft-msg{
        max-width: 100%;
    }

    .wft-thread,
    .wft-reply{
        padding: 18px 16px;
    }

    .wft-reply-actions{
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .wft-reply-actions .wfs-btn{
        width: 100%;
    }
}

@media (max-width: 575.98px){
    .wfs-stat{
        padding: 11px 13px;
    }

    .wfs-stat-value{
        font-size: 19px;
    }

    .wfs-stat-label{
        font-size: 10px;
    }
}
