/* ==============================
   Mill IA - Notification Dialogs
   Theme-aware: reads --chat-* tokens
   ============================== */

#message-backdrop,
#question-backdrop {
    position: fixed;
    z-index: 10001;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
    animation: notify-fade-in 200ms ease;
    font-family: system-ui, sans-serif;
}

#message-backdrop.closing,
#question-backdrop.closing {
    animation: notify-fade-out 200ms ease forwards;
}

#message-box,
#question-box {
    background: var(--chat-form-bg);
    color: var(--chat-text-primary);
    border: 1px solid var(--chat-border);
    border-radius: 12px;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    animation: notify-scale-in 200ms ease;
}

#message-backdrop.closing #message-box,
#question-backdrop.closing #question-box {
    animation: notify-scale-out 200ms ease forwards;
}

#message-header,
#question-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 16px 0;
}

#message-icon,
#question-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

#message-icon.success {
    background: color-mix(in srgb, #16a34a 15%, var(--chat-form-bg));
    color: #16a34a;
}

#message-icon.error {
    background: color-mix(in srgb, #dc2626 15%, var(--chat-form-bg));
    color: #dc2626;
}

#message-icon.info {
    background: color-mix(in srgb, #2563eb 15%, var(--chat-form-bg));
    color: #2563eb;
}

#message-icon.warning {
    background: color-mix(in srgb, #d97706 15%, var(--chat-form-bg));
    color: #d97706;
}

#question-icon {
    background: color-mix(in srgb, #d97706 15%, var(--chat-form-bg));
    color: #d97706;
}

#message-title,
#question-title {
    flex: 1;
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: var(--chat-text-primary);
}

#message-close,
#question-close {
    background: none;
    border: none;
    font-size: 1rem;
    color: var(--chat-text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    line-height: 1;
    transition: color 0.15s, background 0.15s;
}

#message-close:hover,
#question-close:hover {
    color: var(--chat-text-primary);
    background: var(--chat-tint-1);
}

#message-body,
#question-body {
    padding: 12px 16px 4px;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--chat-text-primary);
}

#message-footer,
#question-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 16px 16px;
}

#message-ok,
#question-yes,
#question-no {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    line-height: 1.4;
    transition: background 0.2s, color 0.2s;
}

#message-ok {
    background: var(--chat-accent);
    color: var(--millia-highlight-text-color);
    border-color: var(--chat-accent);
}

#message-ok:hover {
    filter: brightness(1.1);
}

#question-yes {
    background: var(--chat-accent);
    color: var(--millia-highlight-text-color);
    border-color: var(--chat-accent);
}

#question-yes:hover {
    filter: brightness(1.1);
}

#question-no {
    background: var(--chat-tint-1);
    color: var(--chat-bot-text-color);
}

#question-no:hover {
    background: var(--chat-tint-2);
}

#message-ok.error {
    background: #dc2626;
    border-color: #dc2626;
    color: #fff;
}

#message-ok.error:hover {
    filter: brightness(1.1);
}

@keyframes notify-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes notify-fade-out {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes notify-scale-in {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes notify-scale-out {
    from { opacity: 1; transform: scale(1); }
    to { opacity: 0; transform: scale(0.92); }
}

/* ==============================
   Mill IA - Loading Overlay
   ============================== */

#loading-backdrop {
    position: fixed;
    z-index: 10002;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.35);
    animation: notify-fade-in 200ms ease;
    font-family: system-ui, sans-serif;
}

#loading-backdrop.closing {
    animation: notify-fade-out 200ms ease forwards;
}

#loading-box {
    background: var(--chat-form-bg);
    color: var(--chat-text-primary);
    border: 1px solid var(--chat-border);
    border-radius: 16px;
    min-width: 240px;
    max-width: 340px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    animation: notify-scale-in 200ms ease;
    padding: 32px 36px 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

#loading-backdrop.closing #loading-box {
    animation: notify-scale-out 200ms ease forwards;
}

#loading-spinner-ring {
    width: 44px;
    height: 44px;
    animation: rotate 2s linear infinite;
}

#loading-spinner-ring .path {
    stroke: var(--chat-accent);
    stroke-linecap: round;
    animation: dash 1.5s ease-in-out infinite;
}

#loading-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--chat-text-primary);
    text-align: center;
    line-height: 1.4;
}

@keyframes loading-pulse-glow {
    0%, 100% { box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18); }
    50%      { box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18), 0 0 0 1px var(--chat-accent-soft); }
}

#loading-box {
    animation: notify-scale-in 200ms ease, loading-pulse-glow 2.4s ease-in-out 0.3s infinite;
}

#loading-backdrop.closing #loading-box {
    animation: notify-scale-out 200ms ease forwards;
}

/* ==============================
   Mill IA - Toast Notifications
   ============================== */

#toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.millia-toast {
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #fff;
    pointer-events: auto;
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    max-width: 360px;
    word-break: break-word;
}

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

.millia-toast-success { background: #22c55e; }
.millia-toast-error   { background: #ef4444; }
.millia-toast-info    { background: #3b82f6; }
.millia-toast-warning { background: #f59e0b; }
