/* ==========================================================================
   Imagilire Libre – Documents récents (carrousel de cartes)
   Affiche les 3 derniers documents traités sous la section résultat.
   ========================================================================== */

/* ── Section conteneur ───────────────────────────────────────────────────── */
.section-recent-docs {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--container-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.section-recent-docs[hidden] {
    display: none !important;
}

/* ── En-tête de section ──────────────────────────────────────────────────── */
.recent-docs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.recent-docs-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.recent-docs-title i {
    color: var(--primary-color);
    font-size: 1rem;
}

/* ── Boutons d'action (export / import) ──────────────────────────────────── */
.recent-docs-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.recent-docs-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.38rem 0.7rem;
    font-size: 0.8rem;
    font-family: var(--font-family);
    font-weight: 500;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    background: var(--container-bg);
    color: var(--text-color);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    line-height: 1.4;
}

.recent-docs-btn:hover {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.recent-docs-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(54, 177, 179, 0.35);
}

/* ── État vide ───────────────────────────────────────────────────────────── */
.recent-docs-empty {
    text-align: center;
    padding: 2.5rem 1rem;
    color: #999;
    font-size: 0.88rem;
    line-height: 1.6;
}

.recent-docs-empty i {
    font-size: 2rem;
    color: var(--border-color);
    display: block;
    margin-bottom: 0.75rem;
}

/* ── Carrousel (grille responsive) ──────────────────────────────────────── */
.recent-docs-carousel {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

@media (max-width: 767px) {
    .recent-docs-carousel {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 500px) {
    .recent-docs-carousel {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
}

/* ── Carte individuelle ──────────────────────────────────────────────────── */
.recent-doc-card {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    border-radius: calc(var(--border-radius) + 2px);
    background: var(--container-bg);
    overflow: hidden;
    position: relative;
    transition: box-shadow 0.22s ease, transform 0.22s ease;
    cursor: default;
}

.recent-doc-card:hover {
    box-shadow: 0 4px 18px rgba(54, 177, 179, 0.18);
    transform: translateY(-3px);
}

.recent-doc-card:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(54, 177, 179, 0.35);
}

/* Bandeau coloré en haut selon la source */
.recent-doc-card::before {
    content: '';
    display: block;
    height: 4px;
    background: var(--primary-color);
    flex-shrink: 0;
}

.recent-doc-card[data-source="pdf"]::before    { background: #e74c3c; }
.recent-doc-card[data-source="ocr"]::before    { background: var(--secondary-color); }
.recent-doc-card[data-source="camera"]::before { background: #9b59b6; }
.recent-doc-card[data-source="manual"]::before { background: var(--primary-color); }

/* ── En-tête de carte ────────────────────────────────────────────────────── */
.recent-doc-card-header {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem 0.7rem 0.3rem;
}

.recent-doc-card-icon {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.82rem;
    background: #f0f9f9;
    color: var(--primary-color);
}

.recent-doc-card[data-source="pdf"] .recent-doc-card-icon {
    background: #fdecea;
    color: #e74c3c;
}

.recent-doc-card[data-source="ocr"] .recent-doc-card-icon {
    background: #fef9ec;
    color: #e6a817;
}

.recent-doc-card[data-source="camera"] .recent-doc-card-icon {
    background: #f4eefb;
    color: #9b59b6;
}

.recent-doc-card-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    padding-top: 0.35rem;
    line-height: 1.3;
    cursor: default;
    border-radius: 4px;
    transition: background 0.15s ease, outline 0.15s ease;
    touch-action: manipulation;
}

.recent-doc-card-title:hover:not([contenteditable="true"]) {
    text-decoration: underline dotted var(--primary-color);
    cursor: text;
}

.recent-doc-card-title--editing {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    outline: 2px solid var(--primary-color);
    background: var(--container-bg, #fff);
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    cursor: text;
    min-width: 4rem;
    -webkit-user-select: text;
    user-select: text;
}

/* Touch devices: permanent pencil affordance instead of hover underline */
@media (hover: none) {
    .recent-doc-card-title:not([contenteditable="true"])::after {
        content: '\00a0\270E';
        font-size: 0.7rem;
        opacity: 0.4;
        font-weight: 400;
    }

    .recent-doc-card-title:hover:not([contenteditable="true"]) {
        text-decoration: none;
    }
}

.recent-doc-card-delete {
    background: none;
    border: none;
    color: #c0c5ce;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 50%;
    font-size: 0.78rem;
    line-height: 1;
    flex-shrink: 0;
    transition: color 0.18s ease, background 0.18s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.4rem;
    height: 1.4rem;
    margin-top: 0.25rem;
}

.recent-doc-card-delete:hover,
.recent-doc-card-delete:focus-visible {
    color: var(--error-color);
    background: #fdecea;
    outline: none;
}

.recent-doc-card-delete:focus-visible {
    box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.3);
}

/* ── Miniature document ──────────────────────────────────────────────────── */
.recent-doc-card-thumb-wrap {
    overflow: hidden;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border-color);
    background: #f0f2f5;
    max-height: 140px;
    max-width: fit-content;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: auto;
    width: 100%;
}

.recent-doc-card-thumbnail {
    display: block;
    max-width: 100%;
    max-height: 140px;
    width: auto;
    height: auto;
    object-fit: contain;
    transition: transform 0.3s ease;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    -ms-interpolation-mode: bicubic;
}

.recent-doc-card:hover .recent-doc-card-thumbnail {
    transform: scale(1.03);
}

body.dark-mode .recent-doc-card-thumb-wrap {
    background: #1a2535;
    border-color: #2d3748;
}

/* ── Aperçu du texte (fallback sans miniature) ───────────────────────────── */
.recent-doc-card-preview {
    padding: 0.4rem 0.7rem 0.6rem;
    font-size: 0.77rem;
    color: #6b7280;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
    min-height: 3.4rem;
}

/* ── Métadonnées ─────────────────────────────────────────────────────────── */
.recent-doc-card-meta {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0 0.7rem 0.6rem;
    font-size: 0.7rem;
    color: #9ca3af;
    flex-wrap: wrap;
}

.recent-doc-meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--background-color);
    border-radius: 20px;
    padding: 0.12rem 0.42rem;
    white-space: nowrap;
}

/* ── Bouton d'épinglage ──────────────────────────────────────────────────── */
.recent-doc-card-pin {
    background: none;
    border: none;
    color: #c0c5ce;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 50%;
    font-size: 0.75rem;
    line-height: 1;
    flex-shrink: 0;
    transition: color 0.18s ease, background 0.18s ease, transform 0.18s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.4rem;
    height: 1.4rem;
    margin-top: 0.25rem;
}

.recent-doc-card-pin:hover,
.recent-doc-card-pin:focus-visible {
    color: #d4860a;
    background: #fff8e1;
    outline: none;
    transform: rotate(-20deg);
}

.recent-doc-card-pin:focus-visible {
    box-shadow: 0 0 0 2px rgba(212, 134, 10, 0.3);
}

.recent-doc-card-pin--active {
    color: #d4860a !important;
    background: #fff8e1;
    transform: rotate(-20deg);
}

/* ── Carte épinglée ──────────────────────────────────────────────────────── */
.recent-doc-card--pinned {
    border-color: #f5d47a;
    box-shadow: 0 0 0 1px rgba(212, 134, 10, 0.18);
}

.recent-doc-card--pinned::before {
    background: linear-gradient(90deg, #d4860a, #f0b429) !important;
}

/* ── Badge de modification manuelle ─────────────────────────────────────── */
.recent-doc-modified-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.3rem;
    height: 1.3rem;
    border-radius: 50%;
    background: #fff8e1;
    color: #d4860a;
    font-size: 0.6rem;
    flex-shrink: 0;
    margin-top: 0.25rem;
    border: 1px solid #f5d47a;
    cursor: default;
}

body.dark-mode .recent-doc-modified-badge {
    background: #2d2510;
    color: #f6c05e;
    border-color: #5a4a1a;
}

/* ── Pied de carte ───────────────────────────────────────────────────────── */
.recent-doc-card-footer {
    padding: 0.5rem 0.7rem 0.7rem;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.recent-doc-reload-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    width: 100%;
    padding: 0.45rem;
    font-family: var(--font-family);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary-color);
    background: rgba(54, 177, 179, 0.07);
    border: 1px solid rgba(54, 177, 179, 0.28);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.recent-doc-reload-btn:hover {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.recent-doc-reload-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(54, 177, 179, 0.35);
}

.recent-doc-reload-btn:active {
    transform: scale(0.97);
}

/* ── Message de feedback ─────────────────────────────────────────────────── */
.recent-docs-feedback {
    margin-top: 0.85rem;
    padding: 0.5rem 0.8rem;
    border-radius: var(--border-radius);
    font-size: 0.84rem;
    display: none;
}

.recent-docs-feedback--success {
    background: #eafaf1;
    color: #27ae60;
    border: 1px solid #a9dfbf;
}

.recent-docs-feedback--error {
    background: #fdecea;
    color: var(--error-color);
    border: 1px solid #f1aaa5;
}

/* ── Note épinglés hors quota ────────────────────────────────────────────── */
.recent-docs-pinned-note {
    margin-top: 0.55rem;
    padding: 0.35rem 0.7rem;
    border-radius: var(--border-radius);
    font-size: 0.78rem;
    color: #92620a;
    background: #fef9ec;
    border: 1px solid #f5d47a;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.recent-docs-pinned-note .fa-thumbtack {
    font-size: 0.72rem;
    opacity: 0.75;
}

body.dark-mode .recent-docs-pinned-note {
    color: #f0c060;
    background: #2d2510;
    border-color: #5a4a1a;
}

/* ── Animation d'entrée des cartes ──────────────────────────────────────── */
@keyframes rdCardIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.recent-doc-card {
    animation: rdCardIn 0.28s ease both;
}

.recent-doc-card:nth-child(2) { animation-delay: 0.06s; }
.recent-doc-card:nth-child(3) { animation-delay: 0.12s; }

/* ── Mode sombre ─────────────────────────────────────────────────────────── */
body.dark-mode .section-recent-docs {
    background: #1e2530;
}

body.dark-mode .recent-doc-card {
    background: #252d3a;
    border-color: #2d3748;
}

body.dark-mode .recent-doc-card:hover {
    box-shadow: 0 4px 18px rgba(54, 177, 179, 0.22);
}

body.dark-mode .recent-doc-card-icon {
    background: #1a2535;
    color: var(--primary-color);
}

body.dark-mode .recent-doc-card[data-source="pdf"] .recent-doc-card-icon {
    background: #2d1b1b;
    color: #fc8181;
}

body.dark-mode .recent-doc-card[data-source="ocr"] .recent-doc-card-icon {
    background: #2d2510;
    color: #f6c05e;
}

body.dark-mode .recent-doc-card[data-source="camera"] .recent-doc-card-icon {
    background: #221830;
    color: #b794f4;
}

body.dark-mode .recent-doc-card-title {
    color: #e2e8f0;
}

body.dark-mode .recent-doc-card-preview {
    color: #94a3b8;
}

body.dark-mode .recent-doc-card-meta {
    color: #64748b;
}

body.dark-mode .recent-doc-meta-chip {
    background: #1a2535;
}

body.dark-mode .recent-doc-card-footer {
    border-color: #2d3748;
}

body.dark-mode .recent-doc-reload-btn {
    background: rgba(54, 177, 179, 0.1);
    border-color: rgba(54, 177, 179, 0.22);
    color: var(--primary-color);
}

body.dark-mode .recent-doc-reload-btn:hover {
    background: var(--primary-color);
    color: #fff;
}

body.dark-mode .recent-docs-btn {
    background: #252d3a;
    border-color: #2d3748;
    color: #cbd5e1;
}

body.dark-mode .recent-docs-btn:hover {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

body.dark-mode .recent-docs-empty {
    color: #64748b;
}

body.dark-mode .recent-docs-empty i {
    color: #2d3748;
}

body.dark-mode .recent-doc-card-delete {
    color: #4a5568;
}

body.dark-mode .recent-doc-card-delete:hover {
    background: #3d1a1a;
    color: #fc8181;
}

body.dark-mode .recent-doc-card-pin {
    color: #4a5568;
}

body.dark-mode .recent-doc-card-pin:hover,
body.dark-mode .recent-doc-card-pin:focus-visible {
    color: #f6c05e;
    background: #2d2510;
}

body.dark-mode .recent-doc-card-pin--active {
    color: #f6c05e !important;
    background: #2d2510;
}

body.dark-mode .recent-doc-card--pinned {
    border-color: #5a4a1a;
    box-shadow: 0 0 0 1px rgba(246, 192, 94, 0.18);
}

body.dark-mode .recent-docs-feedback--success {
    background: #1a2e1f;
    color: #68d391;
    border-color: #276749;
}

body.dark-mode .recent-docs-feedback--error {
    background: #2d1b1b;
    color: #fc8181;
    border-color: #6b2424;
}

/* ── Accessibilité – mouvement réduit ────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .recent-doc-card {
        animation: none;
        transition: none;
    }

    .recent-doc-card:hover {
        transform: none;
    }

    .recent-doc-reload-btn,
    .recent-docs-btn,
    .recent-doc-card-delete,
    .recent-doc-card-pin {
        transition: none;
    }

    .recent-doc-card-pin:hover,
    .recent-doc-card-pin:focus-visible,
    .recent-doc-card-pin--active {
        transform: none;
    }
}

/* ── Modale de confirmation (texte non sauvegardé) ───────────────────────── */
.recent-docs-confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(2px);
    animation: rdOverlayIn 0.15s ease;
}

@keyframes rdOverlayIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.recent-docs-confirm-dialog {
    background: var(--container-bg, #fff);
    border-radius: var(--border-radius, 10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.22);
    padding: 1.5rem 1.75rem 1.25rem;
    max-width: 380px;
    width: calc(100% - 2rem);
    animation: rdDialogIn 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes rdDialogIn {
    from { opacity: 0; transform: scale(0.92) translateY(8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.recent-docs-confirm-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-color, #1a202c);
    margin: 0 0 0.6rem;
}

.recent-docs-confirm-msg {
    font-size: 0.9rem;
    color: var(--text-secondary, #4a5568);
    margin: 0 0 1.25rem;
    line-height: 1.5;
}

.recent-docs-confirm-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
}

.recent-docs-confirm-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 1rem;
    font-size: 0.875rem;
    font-family: var(--font-family, inherit);
    font-weight: 600;
    border-radius: var(--border-radius, 8px);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
}

.recent-docs-confirm-btn--cancel {
    background: var(--bg-color, #f8fafc);
    border-color: var(--border-color, #e2e8f0);
    color: var(--text-color, #1a202c);
}

.recent-docs-confirm-btn--cancel:hover {
    background: var(--border-color, #e2e8f0);
}

.recent-docs-confirm-btn--ok {
    background: var(--primary-color, #0ea5a0);
    border-color: var(--primary-color, #0ea5a0);
    color: #fff;
}

.recent-docs-confirm-btn--ok:hover {
    filter: brightness(1.1);
    box-shadow: 0 2px 8px rgba(14, 165, 160, 0.35);
}

.recent-docs-confirm-btn:focus-visible {
    outline: 2px solid var(--primary-color, #0ea5a0);
    outline-offset: 2px;
}

/* ── Bouton danger (effacer l'historique) ────────────────────────────────── */
.recent-docs-btn--danger {
    color: var(--error-color, #e74c3c);
    border-color: rgba(231, 76, 60, 0.3);
}

.recent-docs-btn--danger:hover {
    background: var(--error-color, #e74c3c);
    color: #fff;
    border-color: var(--error-color, #e74c3c);
}

body.dark-mode .recent-docs-btn--danger {
    color: #fc8181;
    border-color: rgba(252, 129, 129, 0.3);
}

body.dark-mode .recent-docs-btn--danger:hover {
    background: #e74c3c;
    color: #fff;
    border-color: #e74c3c;
}

/* ── Bouton danger dans le dialogue de confirmation ──────────────────────── */
.recent-docs-confirm-btn--danger {
    background: var(--error-color, #e74c3c);
    border-color: var(--error-color, #e74c3c);
    color: #fff;
}

.recent-docs-confirm-btn--danger:hover {
    filter: brightness(1.08);
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.35);
}

/* ── Ligne de case à cocher dans le dialogue ─────────────────────────────── */
.recent-docs-confirm-checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary, #4a5568);
    margin: -0.25rem 0 1.25rem;
    padding: 0.55rem 0.75rem;
    background: var(--background-color, #f8fafc);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: var(--border-radius, 8px);
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    line-height: 1.4;
    transition: background 0.15s;
}

.recent-docs-confirm-checkbox-row:hover {
    background: var(--border-color, #e2e8f0);
}

.recent-docs-confirm-checkbox-row input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    accent-color: var(--primary-color, #0ea5a0);
    cursor: pointer;
}

body.dark-mode .recent-docs-confirm-checkbox-row {
    color: #94a3b8;
    background: #1a2535;
    border-color: #2d3748;
}

body.dark-mode .recent-docs-confirm-checkbox-row:hover {
    background: #2d3748;
}

/* Dark mode */
body.dark-mode .recent-docs-confirm-dialog {
    background: #1e2533;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.55);
}

body.dark-mode .recent-docs-confirm-title {
    color: #e2e8f0;
}

body.dark-mode .recent-docs-confirm-msg {
    color: #94a3b8;
}

body.dark-mode .recent-docs-confirm-btn--cancel {
    background: #252d3a;
    border-color: #2d3748;
    color: #cbd5e1;
}

body.dark-mode .recent-docs-confirm-btn--cancel:hover {
    background: #2d3748;
}

@media (prefers-reduced-motion: reduce) {
    .recent-docs-confirm-overlay { animation: none; }
    .recent-docs-confirm-dialog  { animation: none; }
}

/* ── Carte en attente de suppression ─────────────────────────────────────── */
.rd-pending-delete {
    opacity: 0.3;
    pointer-events: none;
    transform: scale(0.97) !important;
    transition: opacity 0.22s ease, transform 0.22s ease !important;
}

/* ── Conteneur des toasts (position fixe) ────────────────────────────────── */
.rd-undo-toast-container {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 8888;
    display: flex;
    flex-direction: column-reverse;
    gap: 0.5rem;
    pointer-events: none;
    max-width: 400px;
    width: calc(100% - 2rem);
    align-items: center;
}

/* ── Toast individuel ────────────────────────────────────────────────────── */
.rd-undo-toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #2d3748;
    color: #f0f4f8;
    border-radius: 10px;
    padding: 0.72rem 0.85rem 1rem;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.32);
    pointer-events: auto;
    position: relative;
    overflow: hidden;
    width: 100%;
    animation: rdToastIn 0.24s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.rd-undo-toast-msg {
    flex: 1;
    font-size: 0.875rem;
    font-family: var(--font-family);
    line-height: 1.4;
}

.rd-undo-toast-btn {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary-color, #36b1b3);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    white-space: nowrap;
    font-family: var(--font-family);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1;
    transition: background 0.15s;
    flex-shrink: 0;
}

.rd-undo-toast-btn:hover {
    background: rgba(54, 177, 179, 0.18);
}

.rd-undo-toast-btn:focus-visible {
    outline: 2px solid var(--primary-color, #36b1b3);
    outline-offset: 2px;
}

/* Barre de progression qui rétrécit sur 5 s */
.rd-undo-toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 100%;
    background: var(--primary-color, #36b1b3);
    transform-origin: left center;
    animation: rdToastProgress 5s linear forwards;
    border-radius: 0 0 10px 10px;
}

/* ── Animations toast ────────────────────────────────────────────────────── */
@keyframes rdToastIn {
    from { opacity: 0; transform: translateY(10px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes rdToastOut {
    from { opacity: 1; transform: translateY(0); max-height: 80px; }
    to   { opacity: 0; transform: translateY(8px); max-height: 0; padding-top: 0; padding-bottom: 0; }
}

@keyframes rdToastProgress {
    from { width: 100%; }
    to   { width: 0%; }
}

.rd-toast-out {
    animation: rdToastOut 0.22s ease forwards !important;
    pointer-events: none;
    overflow: hidden;
}

/* ── Accessibilité – mouvement réduit ────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .rd-undo-toast             { animation: none; }
    .rd-undo-toast-progress    { animation: none; width: 0; }
    .rd-toast-out              { animation: none; opacity: 0; }
    .rd-pending-delete         { transition: none !important; }
}
