/* Orivex in-house alerts — toast stack + confirm dialog */
:root {
    --ox-alert-ink: #0f172a;
    --ox-alert-muted: #64748b;
    --ox-alert-line: #e2e8f0;
    --ox-alert-surface: #ffffff;
    --ox-alert-success: #059669;
    --ox-alert-success-bg: #ecfdf5;
    --ox-alert-error: #dc2626;
    --ox-alert-error-bg: #fef2f2;
    --ox-alert-warning: #d97706;
    --ox-alert-warning-bg: #fffbeb;
    --ox-alert-info: #2563eb;
    --ox-alert-info-bg: #eff6ff;
    --ox-alert-brand: #ea580c;
    --ox-alert-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --ox-alert-font: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.ox-toast-host {
    position: fixed;
    z-index: 10000;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(380px, calc(100vw - 32px));
    pointer-events: none;
}

.ox-toast-host.ox-toast-bottom {
    top: auto;
    bottom: 20px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: min(420px, calc(100vw - 32px));
    align-items: stretch;
}

.ox-toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    background: var(--ox-alert-surface);
    border: 1px solid var(--ox-alert-line);
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.14);
    font-family: var(--ox-alert-font);
    color: var(--ox-alert-ink);
    animation: ox-toast-in 0.32s var(--ox-alert-ease) both;
    overflow: hidden;
    position: relative;
}

.ox-toast.is-leaving {
    animation: ox-toast-out 0.22s ease forwards;
}

@keyframes ox-toast-in {
    from {
        opacity: 0;
        transform: translateX(16px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.ox-toast-host.ox-toast-bottom .ox-toast {
    animation-name: ox-toast-in-up;
}

@keyframes ox-toast-in-up {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes ox-toast-out {
    to {
        opacity: 0;
        transform: translateY(-6px) scale(0.98);
    }
}

.ox-toast-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ox-toast-icon .material-symbols-rounded {
    font-size: 20px;
    line-height: 1;
}

.ox-toast-body {
    flex: 1;
    min-width: 0;
    padding-top: 2px;
}

.ox-toast-title {
    margin: 0 0 2px;
    font-size: 13.5px;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--ox-alert-ink);
}

.ox-toast-msg {
    margin: 0;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.45;
    color: var(--ox-alert-muted);
}

.ox-toast-close {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--ox-alert-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.ox-toast-close:hover {
    background: #f1f5f9;
    color: var(--ox-alert-ink);
}

.ox-toast-close .material-symbols-rounded {
    font-size: 18px;
}

.ox-toast-progress {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    width: 100%;
    transform-origin: left center;
    background: currentColor;
    opacity: 0.35;
    animation: ox-toast-progress linear forwards;
}

@keyframes ox-toast-progress {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

/* Types */
.ox-toast.success .ox-toast-icon {
    background: var(--ox-alert-success-bg);
    color: var(--ox-alert-success);
}
.ox-toast.success .ox-toast-progress { color: var(--ox-alert-success); }

.ox-toast.error .ox-toast-icon {
    background: var(--ox-alert-error-bg);
    color: var(--ox-alert-error);
}
.ox-toast.error .ox-toast-progress { color: var(--ox-alert-error); }

.ox-toast.warning .ox-toast-icon {
    background: var(--ox-alert-warning-bg);
    color: var(--ox-alert-warning);
}
.ox-toast.warning .ox-toast-progress { color: var(--ox-alert-warning); }

.ox-toast.info .ox-toast-icon {
    background: var(--ox-alert-info-bg);
    color: var(--ox-alert-info);
}
.ox-toast.info .ox-toast-progress { color: var(--ox-alert-info); }

.ox-toast.brand .ox-toast-icon {
    background: rgba(234, 88, 12, 0.1);
    color: var(--ox-alert-brand);
}
.ox-toast.brand .ox-toast-progress { color: var(--ox-alert-brand); }

/* Confirm dialog */
.ox-confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.48);
    backdrop-filter: blur(3px);
    font-family: var(--ox-alert-font);
}

.ox-confirm-overlay.is-open {
    display: flex;
}

.ox-confirm {
    width: min(420px, 100%);
    background: var(--ox-alert-surface);
    border: 1px solid var(--ox-alert-line);
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.2);
    padding: 22px 22px 18px;
    animation: ox-confirm-in 0.28s var(--ox-alert-ease) both;
}

@keyframes ox-confirm-in {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.ox-confirm-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.ox-confirm-icon .material-symbols-rounded {
    font-size: 24px;
}

.ox-confirm-icon.warning {
    background: var(--ox-alert-warning-bg);
    color: var(--ox-alert-warning);
}

.ox-confirm-icon.danger {
    background: var(--ox-alert-error-bg);
    color: var(--ox-alert-error);
}

.ox-confirm-icon.info {
    background: var(--ox-alert-info-bg);
    color: var(--ox-alert-info);
}

.ox-confirm-icon.success {
    background: var(--ox-alert-success-bg);
    color: var(--ox-alert-success);
}

.ox-confirm h2 {
    margin: 0 0 8px;
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--ox-alert-ink);
}

.ox-confirm p {
    margin: 0 0 18px;
    font-size: 14px;
    line-height: 1.55;
    color: var(--ox-alert-muted);
    font-weight: 500;
}

.ox-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.ox-confirm-actions button {
    height: 38px;
    padding: 0 14px;
    border-radius: 10px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    border: 1.5px solid transparent;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.ox-btn-cancel {
    background: #fff;
    border-color: var(--ox-alert-line);
    color: var(--ox-alert-ink);
}

.ox-btn-cancel:hover {
    background: #f8fafc;
}

.ox-btn-ok {
    background: linear-gradient(180deg, #f97316, #ea580c);
    color: #fff;
    border: 0;
    box-shadow: 0 8px 18px rgba(234, 88, 12, 0.25);
}

.ox-btn-ok:hover {
    filter: brightness(1.05);
}

.ox-btn-ok.danger {
    background: linear-gradient(180deg, #ef4444, #dc2626);
    box-shadow: 0 8px 18px rgba(220, 38, 38, 0.25);
}

/* Dark surfaces (exam IDE) */
.ox-toast-host.ox-dark .ox-toast {
    background: #1a2332;
    border-color: rgba(148, 163, 184, 0.18);
    color: #e8eef7;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.ox-toast-host.ox-dark .ox-toast-title {
    color: #e8eef7;
}

.ox-toast-host.ox-dark .ox-toast-msg {
    color: #94a3b8;
}

.ox-toast-host.ox-dark .ox-toast-close:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #e8eef7;
}

@media (max-width: 560px) {
    .ox-toast-host {
        top: 12px;
        right: 12px;
        left: 12px;
        width: auto;
    }

    .ox-toast-host.ox-toast-bottom {
        left: 12px;
        right: 12px;
        transform: none;
        width: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ox-toast,
    .ox-confirm,
    .ox-toast-progress {
        animation: none !important;
    }
}
