/* Toast notifications + styled confirm/alert modals.
   Replaces native alert()/confirm() across the app. Brand-aware via tokens. */

/* ---------- Toasts ---------- */
.ctm-toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 20000;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    max-width: min(360px, calc(100vw - 2rem));
    pointer-events: none;
}

.ctm-toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    background: #fff;
    border: 1px solid #e9ecef;
    border-left: 4px solid #6c757d;
    border-radius: 8px;
    padding: 0.75rem 0.9rem;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
    font-size: 0.9rem;
    color: #333;
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.ctm-toast--in { opacity: 1; transform: translateX(0); }
.ctm-toast--out { opacity: 0; transform: translateX(20px); }

.ctm-toast__icon { flex: 0 0 auto; display: flex; }
.ctm-toast__icon svg { width: 18px; height: 18px; margin-top: 1px; }
.ctm-toast__msg { flex: 1; line-height: 1.4; }

.ctm-toast__close {
    flex: 0 0 auto;
    background: none;
    border: none;
    font-size: 1.1rem;
    line-height: 1;
    color: #adb5bd;
    cursor: pointer;
    padding: 0;
}
.ctm-toast__close:hover { color: #6c757d; }

.ctm-toast--success { border-left-color: #198754; }
.ctm-toast--success .ctm-toast__icon { color: #198754; }
.ctm-toast--error { border-left-color: #dc3545; }
.ctm-toast--error .ctm-toast__icon { color: #dc3545; }
.ctm-toast--warning { border-left-color: #fd7e14; }
.ctm-toast--warning .ctm-toast__icon { color: #fd7e14; }
.ctm-toast--info { border-left-color: var(--button-color, #6f42c1); }
.ctm-toast--info .ctm-toast__icon { color: var(--button-color, #6f42c1); }

/* ---------- Modal (confirm / alert) ---------- */
.ctm-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20001;
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.ctm-modal-overlay--in { opacity: 1; }
.ctm-modal-overlay--out { opacity: 0; }

.ctm-modal {
    background: #fff;
    border-radius: 12px;
    max-width: 440px;
    width: 100%;
    padding: 1.75rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    transform: translateY(8px) scale(0.98);
    transition: transform 0.2s ease;
}
.ctm-modal-overlay--in .ctm-modal { transform: none; }

.ctm-modal__title {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 0.6rem;
    color: #1f2330;
}
.ctm-modal__body {
    font-size: 0.95rem;
    color: #555b66;
    line-height: 1.5;
    margin: 0 0 1.5rem;
    white-space: pre-line;
}
.ctm-modal__actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
}
.ctm-modal__btn {
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.55rem 1.2rem;
    border-radius: 7px;
    border: 1px solid transparent;
    cursor: pointer;
}
.ctm-modal__btn--cancel { background: #fff; border-color: #ced4da; color: #495057; }
.ctm-modal__btn--cancel:hover { background: #f8f9fa; }
.ctm-modal__btn--confirm { background: var(--button-color, #6f42c1); color: #fff; }
.ctm-modal__btn--confirm:hover { background: var(--button-hover-color, #5a359c); }
.ctm-modal__btn--danger { background: #dc3545; }
.ctm-modal__btn--danger:hover { background: #bb2d3b; }
