/* ============================================================================
 * TropEasy — Outils texte
 *
 * Calque visuel de base_calculator.html / calc-redesign.css mais avec la
 * couleur de catégorie amber #F59E0B (icône hero, accents secondaires).
 * Le CTA principal reste bleu #2563EB pour cohérence globale.
 * ============================================================================ */

/* ---- Hero ---------------------------------------------------------------- */
.text-tool-hero {
    text-align: center;
    padding: 56px 16px 24px;
    max-width: 720px;
    margin: 0 auto;
}
.text-tool-hero-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 18px;
    background: #FEF3C7;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.text-tool-hero-icon svg {
    width: 32px;
    height: 32px;
}
.text-tool-hero h1 {
    font-size: 32px;
    font-weight: 600;
    color: #0F172A;
    letter-spacing: -0.4px;
    margin: 0 0 10px;
    line-height: 1.2;
}
.text-tool-hero .lead {
    font-size: 16px;
    color: #475569;
    line-height: 1.55;
    max-width: 600px;
    margin: 0 auto;
}

/* ---- Card centrale ------------------------------------------------------- */
.text-tool-card {
    max-width: 880px;
    margin: 16px auto 24px;
    background: #ffffff;
    border: 0.5px solid #E2E8F0;
    border-radius: 14px;
    padding: 28px;
}
.text-tool-card > * + * { margin-top: 18px; }

/* ---- Champs de saisie ---------------------------------------------------- */
.text-tool-field-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #1E293B;
    margin: 0 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.text-tool-textarea {
    width: 100%;
    min-height: 160px;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 14px;
    line-height: 1.6;
    color: #0F172A;
    background: #F8FAFC;
    border: 0.5px solid #E2E8F0;
    border-radius: 10px;
    padding: 14px;
    resize: vertical;
    box-sizing: border-box;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}
.text-tool-textarea:focus {
    outline: none;
    border-color: #2563EB;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
    background: #ffffff;
}
.text-tool-textarea[readonly] {
    background: #F1F5F9;
    color: #334155;
}

/* ---- Options (checkboxes, selects) -------------------------------------- */
.text-tool-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    padding: 14px 16px;
    background: #F8FAFC;
    border: 0.5px solid #E2E8F0;
    border-radius: 10px;
}
.text-tool-option {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #1E293B;
    cursor: pointer;
}
.text-tool-option input[type="checkbox"],
.text-tool-option input[type="radio"] {
    accent-color: #F59E0B;
    width: 16px;
    height: 16px;
}
.text-tool-select,
.text-tool-input {
    font-size: 14px;
    color: #1E293B;
    background: #ffffff;
    border: 0.5px solid #E2E8F0;
    border-radius: 8px;
    padding: 8px 12px;
}
.text-tool-select:focus,
.text-tool-input:focus {
    outline: none;
    border-color: #2563EB;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* ---- Actions (boutons) --------------------------------------------------- */
.text-tool-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.text-tool-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 20px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 10px;
    border: 0.5px solid transparent;
    cursor: pointer;
    transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}
.text-tool-btn-primary {
    background: #2563EB;
    color: #ffffff;
}
.text-tool-btn-primary:hover { background: #1D4ED8; }
.text-tool-btn-secondary {
    background: #FEF3C7;
    color: #92400E;
    border-color: #FCD34D;
}
.text-tool-btn-secondary:hover { background: #FDE68A; }
.text-tool-btn-ghost {
    background: #ffffff;
    color: #475569;
    border-color: #E2E8F0;
}
.text-tool-btn-ghost:hover { background: #F8FAFC; color: #1E293B; }

/* ---- Output -------------------------------------------------------------- */
.text-tool-output {
    background: #F8FAFC;
    border: 0.5px solid #E2E8F0;
    border-radius: 10px;
    padding: 16px;
}
.text-tool-output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}
.text-tool-output-title {
    font-size: 13px;
    font-weight: 500;
    color: #1E293B;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}
.text-tool-output-actions {
    display: flex;
    gap: 6px;
}

/* ---- Stats inline (chars / mots / lignes) -------------------------------- */
.text-tool-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 18px;
    font-size: 12px;
    color: #64748B;
}
.text-tool-stats strong { color: #1E293B; font-weight: 500; }

/* ---- Réassurance --------------------------------------------------------- */
.text-tool-reassurance {
    max-width: 880px;
    margin: 0 auto 32px;
    padding: 12px 16px;
    background: #FFFBEB;
    border: 0.5px solid #FDE68A;
    color: #92400E;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}
.text-tool-reassurance svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* ---- Toast --------------------------------------------------------------- */
.text-tools-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1100;
    background: #1E293B;
    color: #ffffff;
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 14px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 180ms ease, transform 180ms ease;
    pointer-events: none;
    max-width: calc(100% - 48px);
}
.text-tools-toast.visible {
    opacity: 1;
    transform: translateY(0);
}
.text-tools-toast--error { background: #B91C1C; }
.text-tools-toast--success { background: #047857; }

/* ---- Help / SEO content ------------------------------------------------- */
.text-tool-help {
    max-width: 880px;
    margin: 0 auto 48px;
    padding: 0 4px;
    color: #1E293B;
    line-height: 1.7;
}
.text-tool-help h2 {
    font-size: 20px;
    font-weight: 500;
    color: #0F172A;
    margin: 28px 0 10px;
}
.text-tool-help p { font-size: 15px; margin: 0 0 12px; }
.text-tool-help ul { font-size: 14px; padding-left: 18px; margin: 0 0 16px; }

/* ---- Convertisseur de casse — grille de boutons de transformation ------ */
.case-buttons-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}
.btn-case {
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    min-height: 52px;
    padding: 12px 14px;
    background: #ffffff;
    color: #1E293B;
    border: 0.5px solid #E2E8F0;
    border-radius: 10px;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.2;
    text-align: center;
    transition: transform 120ms ease, border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}
.btn-case:hover {
    background: #FFFBEB;
    border-color: #FCD34D;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.10);
}
.btn-case:focus-visible {
    outline: none;
    border-color: #F59E0B;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.22);
}
.btn-case:active {
    transform: translateY(0);
    background: #FEF3C7;
}

@media (max-width: 880px) {
    .case-buttons-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---- Générateur Lorem Ipsum — panneau d'options ------------------------- */
.lorem-options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1.4fr;
    gap: 18px;
    align-items: start;
    padding: 16px;
    background: #F8FAFC;
    border: 0.5px solid #E2E8F0;
    border-radius: 10px;
}
.lorem-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.lorem-field .text-tool-select,
.lorem-field .text-tool-input {
    height: 44px;
    padding: 0 12px;
    font-size: 14px;
    background: #ffffff;
    border: 0.5px solid #E2E8F0;
    border-radius: 8px;
    color: #1E293B;
    width: 100%;
    box-sizing: border-box;
}
.lorem-field .text-tool-select:focus,
.lorem-field .text-tool-input:focus {
    outline: none;
    border-color: #F59E0B;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.20);
}
.lorem-checkboxes {
    gap: 8px;
}
.lorem-checkboxes .text-tool-option {
    font-size: 13px;
    color: #1E293B;
    line-height: 1.35;
}
.lorem-actions {
    display: flex;
    justify-content: center;
}
.text-tool-btn-lg {
    min-height: 48px;
    padding: 13px 28px;
    font-size: 15px;
    font-weight: 600;
}

@media (max-width: 880px) {
    .lorem-options-grid { grid-template-columns: 1fr; }
}

/* ---- Suppression de doublons — panneau d'options + status -------------- */
.dedup-options {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 16px;
    background: #F8FAFC;
    border: 0.5px solid #E2E8F0;
    border-radius: 10px;
}
.dedup-checkboxes,
.dedup-sort {
    display: grid;
    gap: 8px 18px;
}
.dedup-checkboxes {
    grid-template-columns: 1fr 1fr;
}
.dedup-sort {
    grid-template-columns: 1fr 1fr;
}
.dedup-checkboxes > .text-tool-field-label,
.dedup-sort > .text-tool-field-label {
    grid-column: 1 / -1;
    margin: 0 0 2px;
}
.dedup-status {
    margin: 0 0 4px;
    padding: 10px 14px;
    background: #FEF3C7;
    border-left: 3px solid #F59E0B;
    border-radius: 6px;
    color: #92400E;
    font-size: 13px;
    line-height: 1.4;
}
.dedup-status:empty {
    display: none;
}

@media (max-width: 640px) {
    .dedup-checkboxes,
    .dedup-sort {
        grid-template-columns: 1fr;
    }
}

/* ---- Rechercher / Remplacer --------------------------------------------- */
.fr-search-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 4px;
}
.fr-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.fr-field .text-tool-input {
    height: 44px;
    width: 100%;
    box-sizing: border-box;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 14px;
}
.fr-input-error {
    border-color: #DC2626 !important;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15) !important;
}
.fr-error {
    min-height: 18px;
    margin-top: 2px;
    font-size: 13px;
    color: #DC2626;
    line-height: 1.3;
}
.fr-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 18px;
    padding: 16px;
    background: #F8FAFC;
    border: 0.5px solid #E2E8F0;
    border-radius: 10px;
}
.fr-options-title {
    grid-column: 1 / -1;
    margin: 0 0 2px;
}
.fr-option-multi code,
.text-tool-help code,
.faq-answer code {
    background: #F1F5F9;
    color: #0F172A;
    padding: 1px 5px;
    border-radius: 4px;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.92em;
}
.text-tool-option--disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
.text-tool-option--disabled input {
    cursor: not-allowed;
}
.fr-status {
    display: inline-block;
    margin: 0 0 8px;
    padding: 6px 12px;
    border-radius: 6px;
    background: transparent;
    color: #64748B;
    font-size: 13px;
    font-weight: 500;
    transition: background 150ms ease, color 150ms ease;
}
.fr-status-active {
    background: #FEF3C7;
    color: #92400E;
    font-weight: 600;
}
.fr-preview {
    max-height: 220px;
    overflow-y: auto;
    padding: 14px;
    background: #F8FAFC;
    border: 0.5px solid #E2E8F0;
    border-radius: 10px;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 14px;
    line-height: 1.6;
    color: #0F172A;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}
.fr-preview:empty::before {
    content: "(saisissez du texte source et un motif à rechercher)";
    color: #94A3B8;
    font-style: italic;
}
.text-tool-mark {
    background: #FEF3C7;
    color: #92400E;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 600;
}

@media (max-width: 720px) {
    .fr-search-grid { grid-template-columns: 1fr; }
    .fr-options { grid-template-columns: 1fr; }
}

/* ---- Encodeur / Décodeur Base64 ---------------------------------------- */
.b64-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid #E2E8F0;
    margin-bottom: 16px;
}
.b64-tab {
    appearance: none;
    -webkit-appearance: none;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 10px 18px;
    margin-bottom: -1px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #64748B;
    transition: color 150ms ease, border-color 150ms ease;
}
.b64-tab:hover { color: #1E293B; }
.b64-tab-active {
    color: #F59E0B;
    border-bottom-color: #F59E0B;
}
.b64-tab:focus-visible {
    outline: none;
    background: rgba(245, 158, 11, 0.08);
    border-radius: 6px 6px 0 0;
}

.b64-direction {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px 18px;
    margin-bottom: 12px;
}
.b64-swap-btn {
    margin-left: auto;
    padding: 8px 14px;
    font-size: 13px;
}

.b64-pane { display: none; }
.b64-pane-active { display: block; }

.b64-dropzone {
    border: 2px dashed #CBD5E1;
    border-radius: 12px;
    padding: 32px 20px;
    text-align: center;
    cursor: pointer;
    background: #F8FAFC;
    transition: border-color 150ms ease, background 150ms ease;
}
.b64-dropzone:hover,
.b64-dropzone:focus-visible {
    border-color: #F59E0B;
    background: #FFFBEB;
    outline: none;
}
.b64-drop-hover {
    border-color: #F59E0B;
    background: #FEF3C7;
}
.b64-drop-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
}
.b64-drop-primary {
    font-weight: 600;
    font-size: 15px;
    color: #1E293B;
}
.b64-drop-secondary {
    margin-top: 4px;
    font-size: 13px;
    color: #64748B;
}
.b64-file-meta {
    margin-top: 12px;
    padding: 12px 14px;
    background: #F8FAFC;
    border: 0.5px solid #E2E8F0;
    border-radius: 8px;
    font-size: 13px;
    color: #334155;
    line-height: 1.5;
}
.b64-include-prefix {
    margin-top: 12px;
}

.b64-decode-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 12px;
    margin-top: 12px;
}
.b64-decode-field {
    flex: 1 1 260px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.b64-decode-field .text-tool-input {
    height: 44px;
    width: 100%;
    box-sizing: border-box;
}
.b64-decode-controls #btn-decode-download {
    height: 44px;
    padding: 0 18px;
}

@media (max-width: 640px) {
    .b64-swap-btn { margin-left: 0; width: 100%; }
    .b64-decode-controls { flex-direction: column; align-items: stretch; }
    .b64-decode-controls #btn-decode-download { width: 100%; }
}

/* ---- Formateur / Validateur JSON --------------------------------------- */
.json-mono {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", "Roboto Mono", monospace;
    font-size: 14px;
    line-height: 1.5;
}
.json-options {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 18px;
    padding: 16px;
    background: #F8FAFC;
    border: 0.5px solid #E2E8F0;
    border-radius: 10px;
    align-items: start;
}
.json-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.json-field .text-tool-select {
    height: 44px;
    padding: 0 12px;
    width: 100%;
    box-sizing: border-box;
}
.json-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.json-status {
    margin-top: 8px;
    padding: 0;
    font-size: 13px;
    line-height: 1.4;
    border-radius: 8px;
    min-height: 0;
    transition: background 150ms ease, color 150ms ease;
}
.json-status-ok,
.json-status-error {
    padding: 10px 14px;
    margin-top: 8px;
    border-radius: 8px;
    font-weight: 500;
}
.json-status-ok {
    background: #D1FAE5;
    color: #065F46;
    border-left: 3px solid #10B981;
}
.json-status-error {
    background: #FEE2E2;
    color: #991B1B;
    border-left: 3px solid #DC2626;
}

.json-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.json-output-header {
    align-items: center;
}
.json-view-toggle {
    display: inline-flex;
    border: 0.5px solid #E2E8F0;
    border-radius: 8px;
    overflow: hidden;
    background: #ffffff;
}
.json-view-btn {
    appearance: none;
    -webkit-appearance: none;
    background: none;
    border: none;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    color: #64748B;
    cursor: pointer;
    transition: background 150ms ease, color 150ms ease;
}
.json-view-btn + .json-view-btn {
    border-left: 0.5px solid #E2E8F0;
}
.json-view-btn:hover { color: #1E293B; }
.json-view-active {
    background: #FEF3C7;
    color: #92400E;
    font-weight: 600;
}

.json-view-pane { display: none; }
.json-view-pane-active { display: block; }

.json-output-color {
    margin: 0;
    padding: 14px 16px;
    max-height: 480px;
    overflow-y: auto;
    background: #F8FAFC;
    border: 0.5px solid #E2E8F0;
    border-radius: 10px;
    color: #0F172A;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}
.json-color-warning {
    min-height: 0;
    margin-top: 6px;
}

.json-key    { color: #1D4ED8; font-weight: 600; }
.json-string { color: #15803D; }
.json-number { color: #B45309; }
.json-bool   { color: #7C3AED; font-weight: 600; }
.json-punct  { color: #64748B; }

@media (max-width: 720px) {
    .json-options { grid-template-columns: 1fr; }
}

/* ---- Comparateur de texte (diff) --------------------------------------- */
.diff-mono {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", "Roboto Mono", monospace;
    font-size: 13px;
    line-height: 1.5;
}
.diff-inputs-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
/* Honorer l'attribut [hidden] malgré la règle display:grid ci-dessus
   (sinon JS inputsGrid.hidden=true reste sans effet) */
.diff-inputs-grid[hidden],
.diff-unified-pane[hidden] {
    display: none !important;
}
.diff-input-pane {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.diff-input-meta {
    margin-top: 4px;
    font-size: 12px;
    color: #64748B;
    text-align: right;
}
.diff-options {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 16px;
    background: #F8FAFC;
    border: 0.5px solid #E2E8F0;
    border-radius: 10px;
}
.diff-checkboxes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 18px;
}
.diff-checkboxes > .text-tool-field-label {
    grid-column: 1 / -1;
    margin: 0 0 2px;
}
.diff-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.diff-stats-bar {
    padding: 10px 14px;
    background: #F8FAFC;
    border: 0.5px solid #E2E8F0;
    border-radius: 8px;
    font-size: 13px;
    color: #334155;
    line-height: 1.5;
    margin: 8px 0;
    min-height: 0;
}
.diff-stats-bar:empty { display: none; }
.diff-stat-add { color: #15803D; }
.diff-stat-remove { color: #B91C1C; }
.diff-stat-equal { color: #64748B; }

.diff-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    margin-bottom: 8px;
    font-size: 12px;
}
.diff-legend-item {
    padding: 2px 10px;
    border-radius: 4px;
    font-weight: 500;
}
.diff-legend-remove { background: #FEE2E2; color: #991B1B; }
.diff-legend-add { background: #D1FAE5; color: #065F46; }
.diff-legend-equal { background: #F1F5F9; color: #475569; }

.diff-output-header {
    align-items: center;
}

/* Le toggle de vue diff partage les règles avec le toggle de vue JSON. */
.diff-view-toggle { /* alias visuel — règles héritées de .json-view-toggle */ }
.diff-view-btn    { /* alias visuel — règles héritées de .json-view-btn */ }
.diff-view-active { /* alias visuel — règles héritées de .json-view-active */ }

/* Bascule édition / résultat via data-mode sur .text-tool-card --------- */
.text-tool-card[data-mode="edit"]   .diff-result { display: none !important; }
.text-tool-card[data-mode="result"] .diff-edit   { display: none !important; }

/* Panneau résultat in-place (remplace visuellement le textarea) -------- */
.diff-result-pane {
    border: 0.5px solid #E2E8F0;
    border-radius: 10px;
    padding: 12px 14px;
    background: #F8FAFC;
    font-size: 13px;
    line-height: 1.6;
    color: #0F172A;
    max-height: 480px;
    overflow-y: auto;
}

.diff-row {
    display: flex;
    align-items: flex-start;
}
.diff-line-num {
    flex: 0 0 42px;
    text-align: right;
    color: #94A3B8;
    user-select: none;
    padding-right: 10px;
    font-variant-numeric: tabular-nums;
}
.diff-line-content {
    flex: 1;
    padding: 1px 8px;
    border-radius: 3px;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    min-height: 1.6em;
}

/* États de ligne -------------------------------------------------------- */
.diff-row-equal  .diff-line-content { background: transparent; color: #1E293B; }
.diff-row-remove .diff-line-content { background: #FEE2E2; color: #7F1D1D; }
.diff-row-add    .diff-line-content { background: #D1FAE5; color: #065F46; }
.diff-row-empty  .diff-line-content { background: #F1F5F9; color: transparent; }

/* Lignes modifiées : fond rouge côté gauche, vert côté droit ---------- */
#diff-original-result .diff-row-changed .diff-line-content { background: #FEE2E2; color: #7F1D1D; }
#diff-modified-result .diff-row-changed .diff-line-content { background: #D1FAE5; color: #065F46; }

/* Surlignage intra-mot (au-dessus du fond rouge/vert) ----------------- */
mark.diff-word-changed {
    background: #FDE68A;
    color: #92400E;
    font-weight: 600;
    padding: 0 2px;
    border-radius: 2px;
}

/* Header résultat : bouton retour + view toggle ----------------------- */
.diff-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin: 0 0 4px;
}

/* Légende : nouveau item "mots modifiés" ------------------------------ */
.diff-legend-word-changed { background: #FDE68A; color: #92400E; }

/* Étiquette "lecture seule" ------------------------------------------- */
.diff-readonly-tag {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #94A3B8;
    font-weight: 500;
}

/* Stats : variation pour les lignes modifiées ------------------------- */
.diff-stat-changed { color: #B45309; }

/* Vue unifiée pleine largeur ----------------------------------------- */
.diff-unified-pane {
    margin-top: 4px;
}
.diff-unified {
    margin: 0;
    padding: 14px 16px;
    max-height: 600px;
    overflow-y: auto;
    background: #F8FAFC;
    border: 0.5px solid #E2E8F0;
    border-radius: 10px;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    color: #0F172A;
}
.diff-unified .diff-row-equal  { background: transparent; }
.diff-unified .diff-row-remove { background: #FEE2E2; color: #7F1D1D; display: inline-block; width: 100%; }
.diff-unified .diff-row-add    { background: #D1FAE5; color: #065F46; display: inline-block; width: 100%; }

/* Actions résultat (bas) --------------------------------------------- */
.diff-result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

@media (max-width: 880px) {
    .diff-inputs-grid { grid-template-columns: 1fr; }
    .diff-checkboxes { grid-template-columns: 1fr; }
    .diff-line-num { flex: 0 0 32px; padding-right: 6px; }
    .diff-result-header { flex-direction: column; align-items: stretch; }
    .diff-result-header .diff-view-toggle { align-self: flex-start; }
}

/* ---- Responsive ---------------------------------------------------------- */
@media (max-width: 640px) {
    .text-tool-hero { padding: 36px 16px 18px; }
    .text-tool-hero h1 { font-size: 26px; }
    .text-tool-card { padding: 18px; border-radius: 12px; margin: 12px 12px 18px; }
    .text-tool-reassurance { margin: 0 12px 24px; }
    .text-tool-actions .text-tool-btn { flex: 1 1 100%; }
    .text-tool-stats { gap: 8px 14px; }
    .text-tool-output-header { flex-direction: column; align-items: flex-start; }
    .text-tool-output-actions { flex-wrap: wrap; width: 100%; }
    .case-buttons-grid { grid-template-columns: 1fr; gap: 10px; }
    .text-tools-toast {
        left: 16px;
        right: 16px;
        bottom: 16px;
        text-align: center;
    }
}
