/**
 * CourrierEnLigne — Styles UI Dialogs
 *
 * Design system :
 *   - Bleu principal : #0060AE
 *   - Jaune accent : #FFE413
 *   - Encre : #0F1E3C
 *   - Bordures : #E5E9F2
 *   - Muted : #6B7280
 *
 * Tous les éléments sont préfixés `cel-` pour éviter les collisions.
 */

/* ============================================================
   Container racine — z-index très haut pour rester au-dessus
   ============================================================ */
#cel-dialogs-root {
    position: relative;
    z-index: 99999;
}

/* ============================================================
   MODALES (alert + confirm)
   ============================================================ */

.cel-dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 30, 60, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    transition: opacity 200ms ease-out;
    z-index: 99999;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.cel-dialog-overlay--visible {
    opacity: 1;
}

.cel-dialog {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(15, 30, 60, 0.25);
    max-width: 440px;
    width: 100%;
    padding: 1.75rem 1.75rem 1.5rem;
    text-align: center;
    transform: translateY(-8px) scale(0.96);
    transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1);
    font-family: inherit;
}

.cel-dialog-overlay--visible .cel-dialog {
    transform: translateY(0) scale(1);
}

/* Icône avec cercle coloré */
.cel-dialog__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    margin-bottom: 1rem;
}

.cel-dialog--info .cel-dialog__icon {
    background: #E0F2FE;
    color: #0369A1;
}
.cel-dialog--success .cel-dialog__icon {
    background: #D1FAE5;
    color: #059669;
}
.cel-dialog--warning .cel-dialog__icon {
    background: #FEF3C7;
    color: #B45309;
}
.cel-dialog--danger .cel-dialog__icon {
    background: #FEE2E2;
    color: #DC2626;
}

.cel-dialog__title {
    margin: 0 0 0.75rem;
    font-size: 1.25rem;
    font-weight: 800;
    color: #0F1E3C;
    line-height: 1.3;
}

.cel-dialog__message {
    color: #4B5563;
    font-size: 0.95rem;
    line-height: 1.55;
    margin-bottom: 1.5rem;
}

.cel-dialog__message strong {
    color: #0F1E3C;
}

.cel-dialog__message a {
    color: #0060AE;
    text-decoration: underline;
}

/* Actions : 1 ou 2 boutons côte à côte */
.cel-dialog__actions {
    display: flex;
    gap: 0.6rem;
    justify-content: center;
    flex-wrap: wrap;
}

.cel-dialog__btn {
    flex: 1;
    min-width: 110px;
    padding: 0.7rem 1.25rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border: 1.5px solid transparent;
    font-family: inherit;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.cel-dialog__btn:focus {
    outline: 3px solid rgba(0, 96, 174, 0.25);
    outline-offset: 1px;
}

/* Bouton "Annuler" (ghost) */
.cel-dialog__btn--ghost {
    background: #fff;
    border-color: #E5E9F2;
    color: #4B5563;
}
.cel-dialog__btn--ghost:hover {
    background: #F8FAFC;
    border-color: #CBD5E1;
    color: #0F1E3C;
}

/* Bouton primaire — couleur selon type */
.cel-dialog__btn--primary {
    color: #fff;
    border: none;
}
.cel-dialog__btn--info,
.cel-dialog__btn--success {
    background: #0060AE;
}
.cel-dialog__btn--info:hover,
.cel-dialog__btn--success:hover {
    background: #004A85;
}
.cel-dialog__btn--warning {
    background: #D97706;
}
.cel-dialog__btn--warning:hover {
    background: #B45309;
}
.cel-dialog__btn--danger {
    background: #DC2626;
}
.cel-dialog__btn--danger:hover {
    background: #B91C1C;
}

/* Si un seul bouton, il prend toute la largeur */
.cel-dialog__actions .cel-dialog__btn:only-child {
    flex: 0 1 auto;
    min-width: 140px;
}

/* Responsive mobile : padding réduit */
@media (max-width: 480px) {
    .cel-dialog {
        padding: 1.5rem 1.25rem 1.25rem;
        border-radius: 12px;
    }
    .cel-dialog__title { font-size: 1.1rem; }
    .cel-dialog__message { font-size: 0.92rem; }
    .cel-dialog__actions { flex-direction: column-reverse; }
    .cel-dialog__btn { width: 100%; flex: 1 0 auto; }
}

/* ============================================================
   TOASTS (bas à droite, auto-dismiss)
   ============================================================ */

.cel-toasts-container {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    z-index: 99998;
    max-width: 380px;
    pointer-events: none;
}

.cel-toast {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(15, 30, 60, 0.12), 0 2px 6px rgba(15, 30, 60, 0.06);
    border-left: 4px solid #0060AE;
    pointer-events: auto;
    transform: translateX(120%);
    transition: transform 250ms cubic-bezier(0.16, 1, 0.3, 1), opacity 250ms ease-out;
    opacity: 0;
    font-family: inherit;
}

.cel-toast--visible {
    transform: translateX(0);
    opacity: 1;
}

.cel-toast--info    { border-left-color: #0369A1; }
.cel-toast--success { border-left-color: #059669; }
.cel-toast--warning { border-left-color: #D97706; }
.cel-toast--danger  { border-left-color: #DC2626; }

.cel-toast__icon {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-top: 0.05rem;
}
.cel-toast__icon svg { width: 18px; height: 18px; }

.cel-toast--info .cel-toast__icon    { background: #E0F2FE; color: #0369A1; }
.cel-toast--success .cel-toast__icon { background: #D1FAE5; color: #059669; }
.cel-toast--warning .cel-toast__icon { background: #FEF3C7; color: #B45309; }
.cel-toast--danger .cel-toast__icon  { background: #FEE2E2; color: #DC2626; }

.cel-toast__message {
    flex: 1;
    font-size: 0.9rem;
    line-height: 1.45;
    color: #0F1E3C;
    padding-top: 0.05rem;
}
.cel-toast__message strong { color: #0F1E3C; }

.cel-toast__close {
    flex-shrink: 0;
    border: none;
    background: transparent;
    width: 24px;
    height: 24px;
    padding: 0;
    font-size: 1.4rem;
    line-height: 1;
    color: #9CA3AF;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
    font-family: inherit;
}
.cel-toast__close:hover {
    background: #F3F4F6;
    color: #374151;
}

@media (max-width: 480px) {
    .cel-toasts-container {
        bottom: 0.75rem;
        right: 0.75rem;
        left: 0.75rem;
        max-width: none;
    }
}
