/* courriers.css - Styles spécifiques à la page courriers */

:root {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --primary-light: #dbeafe;
    --secondary-color: #6b7280;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --background: #f8fafc;
    --background-light: #f1f5f9;
    --card-background: #ffffff;
    --border-color: #e5e7eb;
    --border-light: #f3f4f6;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -1px rgb(0 0 0 / 0.06);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -2px rgb(0 0 0 / 0.05);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 10px 10px -5px rgb(0 0 0 / 0.04);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --transition-fast: 0.15s ease-out;
    --transition-base: 0.2s ease-out;
    --transition-slow: 0.3s ease-out;
}

/* Reset et base */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    margin: 0;
    padding: 0;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Background decoratif */
.background-image {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.05) 0%, rgba(16, 185, 129, 0.05) 100%);
    pointer-events: none;
    z-index: -1;
}

/* Container principal */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
    min-height: 100vh;
}

/* Header amélioré */
.header-container {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 32px;
    padding: 24px 32px;
    background: var(--card-background);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    position: relative;
    overflow: hidden;
}

.header-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--success-color));
}


.title {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    background: linear-gradient(135deg, var(--primary-color), var(--success-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Navigation par onglets moderne */
.tabs-container {
    display: flex;
    gap: 8px;
    margin-bottom: 32px;
    background: var(--card-background);
    padding: 8px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    position: relative;
}

.tab-btn {
    flex: 1;
    padding: 16px 24px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: relative;
    min-height: 48px;
}

.tab-btn:hover {
    background: var(--background-light);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.tab-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid var(--primary-color);
}

/* Contenu des onglets */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Section header améliorée */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.section-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-header h2::before {
    content: '';
    width: 4px;
    height: 28px;
    background: linear-gradient(135deg, var(--primary-color), var(--success-color));
    border-radius: 2px;
}

/* Boutons modernisés */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: var(--radius-lg);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all var(--transition-base);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-secondary {
    background: var(--card-background);
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
    padding: 12px 24px;
    border-radius: var(--radius-lg);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
}

.btn-secondary:hover {
    background: var(--background-light);
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color), #dc2626);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius-lg);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
}

.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-icon {
    font-size: 1.1em;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.1));
}

/* Container de recherche moderne */
.search-container {
    display: flex;
    gap: 16px;
    margin-bottom: 28px;
    flex-wrap: wrap;
    align-items: center;
}

.search-input {
    flex: 1;
    min-width: 280px;
    padding: 14px 20px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    font-size: 0.95rem;
    transition: all var(--transition-base);
    background: var(--card-background);
    box-shadow: var(--shadow-sm);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
    background: white;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.filter-select {
    padding: 14px 20px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--card-background);
    font-size: 0.95rem;
    cursor: pointer;
    min-width: 180px;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

/* Grilles avec animation */
.models-grid,
.courriers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

/* Cartes ultra-modernes */
.card {
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 24px;
    transition: all var(--transition-slow);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--success-color));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--transition-slow);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-light);
}

.card:hover::before {
    transform: scaleX(1);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
    gap: 12px;
}

.card-title {
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 6px 0;
    font-size: 1.15rem;
    line-height: 1.4;
}

.card-family {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
}

.card-description {
    color: var(--text-secondary);
    margin: 12px 0;
    font-size: 0.9rem;
    line-height: 1.5;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.card-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    opacity: 0.8;
    transform: translateY(4px);
    transition: all var(--transition-base);
}

.card:hover .card-actions {
    opacity: 1;
    transform: translateY(0);
}

.card-actions button {
    padding: 8px 14px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    justify-content: center;
}

.btn-edit {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-edit:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-delete {
    background: linear-gradient(135deg, var(--danger-color), #dc2626);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-delete:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-use {
    background: linear-gradient(135deg, var(--success-color), #059669);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-use:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Badge principal amélioré */
.principal-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    background: linear-gradient(135deg, var(--warning-color), #d97706);
    color: white;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 700;
    box-shadow: var(--shadow-md);
    z-index: 1;
}

/* Badges de statut améliorés */
.status-badge {
    padding: 6px 12px;
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: var(--shadow-sm);
}

.status-brouillon {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #92400e;
}

.status-envoyé {
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    color: #065f46;
}

.status-archivé {
    background: linear-gradient(135deg, #e5e7eb, #d1d5db);
    color: #374151;
}

/* Modales ultra-modernes */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background: var(--card-background);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: modalSlideIn 0.3s ease-out;
    border: 1px solid var(--border-light);
}

.modal-sm {
    max-width: 480px;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-30px) scale(0.95);
        opacity: 0;
    }

    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 32px;
    border-bottom: 1px solid var(--border-light);
    background: linear-gradient(135deg, var(--background-light), var(--card-background));
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-close {
    background: var(--background-light);
    border: 2px solid var(--border-color);
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-secondary);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
    font-weight: bold;
}

.modal-close:hover {
    background: var(--danger-color);
    color: white;
    border-color: var(--danger-color);
    transform: rotate(90deg);
}

.modal-body {
    padding: 32px;
}

.modal-form {
    padding: 32px;
}

.modal-actions {
    display: flex;
    gap: 16px;
    justify-content: flex-end;
    padding: 24px 32px;
    border-top: 1px solid var(--border-light);
    background: var(--background-light);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* Formulaires améliorés */
.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 24px;
}

.form-group {
    flex: 1;
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    font-size: 0.95rem;
    transition: all var(--transition-base);
    box-sizing: border-box;
    background: var(--card-background);
    font-family: inherit;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
    background: white;
    transform: translateY(-1px);
}

.form-textarea {
    resize: vertical;
    line-height: 1.6;
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-muted);
}

/* Checkbox personnalisée ultra-moderne */
.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
    padding: 12px 0;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-right: 12px;
    position: relative;
    transition: all var(--transition-base);
    background: var(--card-background);
    box-shadow: var(--shadow-sm);
}

.checkbox-label:hover .checkmark {
    border-color: var(--primary-color);
    transform: scale(1.05);
}

.checkbox-label input[type="checkbox"]:checked+.checkmark {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.checkbox-label input[type="checkbox"]:checked+.checkmark::after {
    content: "✓";
    color: white;
    font-size: 16px;
    font-weight: bold;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Éditeur TUI modernisé */
.editor-container {
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    min-height: 350px;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
}

.editor-container:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

/* Styles pour TUI Editor */
.editor-container .tui-editor-defaultUI {
    border: none;
}

.editor-container .te-toolbar-section {
    background: var(--background-light);
    border-bottom: 1px solid var(--border-light);
}

.editor-container .te-toolbar-divider {
    background: var(--border-color);
}

.editor-container .te-md-container,
.editor-container .te-preview {
    background: var(--card-background);
}

/* Loader modernisé */
.loader {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1001;
    width: 60px;
    height: 60px;
    border: 4px solid var(--border-light);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    background: var(--card-background);
    box-shadow: var(--shadow-lg);
}

@keyframes spin {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* États vides améliorés */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-secondary);
    background: var(--card-background);
    border-radius: var(--radius-xl);
    border: 2px dashed var(--border-color);
    margin: 20px 0;
}

.empty-state .icon {
    font-size: 5rem;
    margin-bottom: 24px;
    opacity: 0.4;
    filter: grayscale(0.3);
}

.empty-state h3 {
    margin: 0 0 12px 0;
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 600;
}

.empty-state p {
    margin: 0;
    font-size: 0.95rem;
    opacity: 0.8;
}

/* Messages de notification améliorés */
.message-fixed {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 1002;
    max-width: 420px;
}

.toast {
    background: var(--card-background);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-light);
    padding: 16px 20px;
    margin-bottom: 12px;
    position: relative;
    overflow: hidden;
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: currentColor;
}

.toast.success::before {
    background: var(--success-color);
}

.toast.danger::before {
    background: var(--danger-color);
}

.toast.warning::before {
    background: var(--warning-color);
}

/* Loading states pour boutons */
.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    color: white;
}

/* Responsive amélioré */
@media (max-width: 1024px) {
    .container {
        padding: 20px;
    }

    .models-grid,
    .courriers-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 16px;
    }

    .header-container {
        flex-direction: column;
        text-align: center;
        gap: 16px;
        padding: 20px;
    }

    .title {
        font-size: 1.75rem;
    }

    .section-header {
        flex-direction: column;
        align-items: stretch;
    }

    .search-container {
        flex-direction: column;
    }

    .search-input {
        min-width: 100%;
    }

    .models-grid,
    .courriers-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .modal-content {
        width: 95%;
        margin: 10px;
        max-height: 95vh;
    }

    .modal-header,
    .modal-body,
    .modal-form,
    .modal-actions {
        padding: 20px;
    }

    .card-actions {
        opacity: 1;
        transform: none;
        flex-wrap: wrap;
    }

    .card-actions button {
        flex: 1;
        min-width: 100px;
    }

    .tabs-container {
        overflow-x: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .tabs-container::-webkit-scrollbar {
        display: none;
    }

    .tab-btn {
        white-space: nowrap;
        min-width: 140px;
    }
}

@media (max-width: 480px) {
    .modal-actions {
        flex-direction: column;
    }

    .modal-actions button {
        width: 100%;
    }

    .message-fixed {
        left: 16px;
        right: 16px;
        top: 16px;
        max-width: none;
    }
}

/* Dark mode support (optionnel) */
@media (prefers-color-scheme: dark) {
    :root {
        --background: #0f172a;
        --background-light: #1e293b;
        --card-background: #1e293b;
        --border-color: #334155;
        --border-light: #475569;
        --text-primary: #f1f5f9;
        --text-secondary: #94a3b8;
        --text-muted: #64748b;
    }

    .background-image {
        opacity: 0.03;
    }

    .modal {
        background: rgba(0, 0, 0, 0.8);
    }
}

/* Animations avancées */
@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.loading-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Utilité pour les transitions */
.transition-all {
    transition: all var(--transition-base);
}

/* Focus visible amélioré pour accessibilité */
*:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Amélioration du scroll */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) transparent;
}

*::-webkit-scrollbar {
    width: 6px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background-color: var(--primary-color);
    border-radius: 3px;
}

*::-webkit-scrollbar-thumb:hover {
    background-color: var(--primary-hover);
}

/* Sélecteur d'utilisateurs */
.users-selector {
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    background: var(--background-light);
    min-height: 120px;
    max-height: 300px;
    overflow-y: auto;
}

.users-selector.loading .loading-users {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100px;
    color: var(--text-muted);
    font-style: italic;
}

.users-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.user-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--card-background);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
}

.user-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.user-item.selected {
    border-color: var(--primary-color);
    background: var(--primary-light);
}

.user-checkbox {
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    position: relative;
    cursor: pointer;
}

.user-checkbox:checked {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.user-checkbox:checked::after {
    content: "✓";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.user-info {
    flex: 1;
}

.user-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.user-birth {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Badge utilisateurs */
.users-count-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--primary-color);
    color: white;
    font-size: 0.7rem;
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

/* Modal large */
.modal-lg {
    max-width: 800px;
}

/* Gestion des utilisateurs */
.users-management {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.users-search {
    position: sticky;
    top: 0;
    background: var(--card-background);
    z-index: 10;
    padding-bottom: 12px;
}

.users-list {
    flex: 1;
    min-height: 300px;
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 16px;
}

/* Action boutons sur les cartes */
.btn-manage-users {
    background: linear-gradient(135deg, var(--success-color), #059669);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-manage-users:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Indicateur d'utilisateurs liés */
.linked-users-indicator {
    position: absolute;
    bottom: 132px;
    right: 12px;
    background: rgba(59, 130, 246, 0.9);
    color: white;
    font-size: 0.7rem;
    padding: 4px 8px;
    border-radius: var(--radius-md);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 1;
}

/* États de chargement */
.loading-users {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-muted);
    font-style: italic;
}

/* Responsive */
@media (max-width: 768px) {
    .users-grid {
        grid-template-columns: 1fr;
    }

    .modal-lg {
        max-width: 95%;
    }
}

/* ========================================
   MESSAGES - STYLE IDENTIQUE À SYNTHÈSE
   ======================================== */
.message-fixed {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 1002;
    max-width: 420px;
}

/* Style notification Bulma-like */
.notification {
    padding: 1.25rem 2.5rem 1.25rem 1.5rem;
    border-radius: 4px;
    position: relative;
    margin-bottom: 1rem;
    animation: slideInRight 0.3s ease-out;
}

/* Types de notifications avec fond coloré */
.notification.is-success {
    background-color: #48c78e;
    color: #fff;
}

.notification.is-danger {
    background-color: #f14668;
    color: #fff;
}

.notification.is-warning {
    background-color: #ffe08a;
    color: rgba(0, 0, 0, 0.7);
}

.notification.is-info {
    background-color: #3e8ed0;
    color: #fff;
}

/* Bouton de fermeture */
.notification .delete {
    position: absolute;
    right: 0.5rem;
    top: 0.5rem;
    background-color: rgba(10, 10, 10, 0.2);
    border: none;
    border-radius: 9999px;
    cursor: pointer;
    pointer-events: auto;
    display: inline-block;
    flex-grow: 0;
    flex-shrink: 0;
    font-size: 0;
    height: 20px;
    max-height: 20px;
    max-width: 20px;
    min-height: 20px;
    min-width: 20px;
    outline: none;
    position: relative;
    vertical-align: top;
    width: 20px;
}

.notification .delete::before,
.notification .delete::after {
    background-color: #fff;
    content: "";
    display: block;
    left: 50%;
    position: absolute;
    top: 50%;
    transform: translateX(-50%) translateY(-50%) rotate(45deg);
    transform-origin: center center;
}

.notification .delete::before {
    height: 2px;
    width: 50%;
}

.notification .delete::after {
    height: 50%;
    width: 2px;
}

.notification .delete:hover,
.notification .delete:focus {
    background-color: rgba(10, 10, 10, 0.3);
}

.notification .delete:active {
    background-color: rgba(10, 10, 10, 0.4);
}

/* Animation */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notification.is-hidden {
    animation: slideOutRight 0.3s ease-out forwards;
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* 🎨 AJOUTER ces styles dans courriers.css */

/* Bouton retour à la source */
#returnToSourceBtn {
    display: none;
    /* Masqué par défaut */
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    background: var(--color-info, #3498db);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

#returnToSourceBtn:hover {
    background: var(--color-info-dark, #2980b9);
    transform: translateX(-2px);
}

#returnToSourceBtn .btn-icon {
    font-size: 1.1em;
    font-weight: bold;
}

/* Ajustement du footer pour le bouton retour */
.modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    align-items: center;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color, #e0e0e0);
}

/* Le bouton retour reste à gauche avec margin-right: auto */
#returnToSourceBtn[style*="display: inline-flex"],
#returnToSourceBtn[style*="display: flex"] {
    margin-right: auto;
}

/* Classe info pour cohérence */
.btn-info {
    background: var(--color-info, #3498db);
    color: white;
    border: none;
}

.btn-info:hover {
    background: var(--color-info-dark, #2980b9);
}

/* Animation du bouton au survol */
#returnToSourceBtn:active {
    transform: translateX(-4px) scale(0.98);
}

/* Responsive : bouton plus petit sur mobile */
@media (max-width: 768px) {
    #returnToSourceBtn {
        padding: 0.5rem 0.8rem;
        font-size: 0.85rem;
    }

    #returnToSourceBtn .btn-icon {
        font-size: 1em;
    }
}

/* Transition douce pour l'affichage */
.container {
    transition: opacity 0.3s ease-in-out;
}

/* Overlay blanc pendant le chargement */
body.loading-from-loca {
    background: white !important;
    overflow: hidden;
}

/* Amélioration du loader centré */
.famivest-loader.centered {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    z-index: 9999 !important;
}

/* Force la préservation des espaces dans TUI Editor */
.toastui-editor-contents p,
.toastui-editor-ww-container p,
.ProseMirror p,
.toastui-editor-contents,
.toastui-editor-ww-container,
.ProseMirror {
    white-space: pre-wrap !important;
}

/* ✅ AJOUT : Normaliser la hauteur des paragraphes pour éviter les lignes vides doubles */
.toastui-editor-contents p,
.toastui-editor-ww-container p,
.ProseMirror p {
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1.5em !important;
    min-height: 1.5em !important;
}

/* Espacement entre paragraphes = 1 ligne */
.toastui-editor-contents p + p,
.toastui-editor-ww-container p + p,
.ProseMirror p + p {
    margin-top: 0.5em !important;
}

/* Les paragraphes vides (avec juste <br>) doivent avoir une hauteur fixe */
.toastui-editor-contents p:empty,
.toastui-editor-ww-container p:empty,
.ProseMirror p:empty,
.toastui-editor-contents p br:only-child,
.toastui-editor-ww-container p br:only-child,
.ProseMirror p br:only-child {
    display: block;
    height: 1.5em !important;
    content: "" !important;
}

/* Le <br> ne doit pas ajouter de hauteur supplémentaire */
.toastui-editor-contents p br,
.toastui-editor-ww-container p br,
.ProseMirror p br {
    display: inline;
    margin: 0 !important;
    padding: 0 !important;
}