/**
 * Dashboard & admin — modern toast + inline notifications
 */

/* ── Custom toast stack ── */
.app-toast-stack {
    position: fixed;
    top: max(18px, env(safe-area-inset-top));
    right: max(18px, env(safe-area-inset-right));
    z-index: 99999;
    width: min(400px, calc(100vw - 36px));
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.app-toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 44px 18px 16px;
    border-radius: 14px;
    border: 1px solid transparent;
    box-shadow:
        0 8px 16px -4px rgba(15, 23, 42, 0.12),
        0 20px 40px -12px rgba(15, 23, 42, 0.18);
    position: relative;
    overflow: hidden;
    animation: appToastIn 0.42s cubic-bezier(0.22, 1, 0.36, 1);
    backdrop-filter: blur(8px);
}

.app-toast.is-leaving {
    animation: appToastOut 0.26s ease forwards;
}

.app-toast--success {
    background: linear-gradient(135deg, #ecfdf5 0%, #ffffff 62%);
    border-color: #86efac;
}

.app-toast--error {
    background: linear-gradient(135deg, #fef2f2 0%, #ffffff 62%);
    border-color: #fca5a5;
}

.app-toast--warning {
    background: linear-gradient(135deg, #fffbeb 0%, #ffffff 62%);
    border-color: #fcd34d;
}

.app-toast--info {
    background: linear-gradient(135deg, #eff6ff 0%, #ffffff 62%);
    border-color: #93c5fd;
}

.app-toast__icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 17px;
    font-weight: 700;
}

.app-toast--success .app-toast__icon {
    background: #dcfce7;
    color: #15803d;
    box-shadow: inset 0 0 0 1px rgba(22, 163, 74, 0.15);
}

.app-toast--error .app-toast__icon {
    background: #fee2e2;
    color: #b91c1c;
    box-shadow: inset 0 0 0 1px rgba(220, 38, 38, 0.12);
}

.app-toast--warning .app-toast__icon {
    background: #fef3c7;
    color: #b45309;
    box-shadow: inset 0 0 0 1px rgba(217, 119, 6, 0.12);
}

.app-toast--info .app-toast__icon {
    background: #dbeafe;
    color: #1d4ed8;
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.12);
}

.app-toast__body {
    flex: 1;
    min-width: 0;
    padding-top: 2px;
}

.app-toast__label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 3px;
}

.app-toast--success .app-toast__label { color: #15803d; }
.app-toast--error .app-toast__label { color: #b91c1c; }
.app-toast--warning .app-toast__label { color: #b45309; }
.app-toast--info .app-toast__label { color: #1d4ed8; }

.app-toast__message {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.45;
    color: #0f172a;
    word-break: break-word;
}

.app-toast__close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #94a3b8;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}

.app-toast__close:hover {
    background: rgba(15, 23, 42, 0.06);
    color: #475569;
}

.app-toast__progress {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    width: 100%;
    transform-origin: left center;
    animation: appToastProgress 4.8s linear forwards;
}

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

@keyframes appToastIn {
    from {
        opacity: 0;
        transform: translateX(24px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes appToastOut {
    to {
        opacity: 0;
        transform: translateX(18px) scale(0.96);
    }
}

@keyframes appToastProgress {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

@media (max-width: 480px) {
    .app-toast-stack {
        right: 12px;
        left: 12px;
        width: auto;
    }
}

/* Hide legacy toastr container if it appears */
#toast-container {
    display: none !important;
}

/* ── Bootstrap alerts (page-level) ── */
main .alert,
.app-content .alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    border-radius: 12px;
    border-width: 1px;
    font-size: 14px;
    line-height: 1.5;
    padding: 14px 44px 14px 16px;
    margin-bottom: 16px;
    position: relative;
}

main .alert:not(.alert-light),
.app-content .alert:not(.alert-light) {
    animation: appNotifyIn 0.35s ease;
}

main .alert .close,
.app-content .alert .close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: inherit;
    opacity: 0.55;
    font-size: 20px;
    font-weight: 400;
    text-shadow: none;
    transition: background 0.15s, opacity 0.15s;
}

main .alert .close:hover,
.app-content .alert .close:hover {
    opacity: 1;
    background: rgba(15, 23, 42, 0.06);
}

.alert-warning {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

.alert-danger {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.alert-success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}

.alert-info {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
}

.app-alert__icon,
.alert-success > .fa:first-child,
.alert-danger > .fa:first-child,
.alert-warning > .fa:first-child,
.alert-info > .fa:first-child {
    flex-shrink: 0;
    font-size: 18px;
    line-height: 1.35;
    margin-top: 1px;
}

.app-alert--success .app-alert__icon,
.alert-success .app-alert__icon { color: #16a34a; }
.app-alert--error .app-alert__icon,
.alert-danger .app-alert__icon { color: #dc2626; }
.app-alert--warning .app-alert__icon,
.alert-warning .app-alert__icon { color: #d97706; }
.app-alert--info .app-alert__icon,
.alert-info .app-alert__icon { color: #2563eb; }

.alert-success:not(.app-alert)::before,
.alert-danger:not(.app-alert)::before,
.alert-warning:not(.app-alert)::before,
.alert-info:not(.app-alert)::before {
    font-family: FontAwesome;
    flex-shrink: 0;
    font-size: 18px;
    line-height: 1.35;
    margin-top: 1px;
    margin-right: 4px;
}

.alert-success:not(.app-alert)::before { content: '\f058'; color: #16a34a; }
.alert-danger:not(.app-alert)::before { content: '\f06a'; color: #dc2626; }
.alert-warning:not(.app-alert)::before { content: '\f071'; color: #d97706; }
.alert-info:not(.app-alert)::before { content: '\f05a'; color: #2563eb; }

.app-alert__text {
    flex: 1;
    min-width: 0;
}

/* ── Inline form banners ── */
.app-notify,
.ecom-notify {
    display: none;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    margin-bottom: 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    border: 1px solid transparent;
    animation: appNotifyIn 0.35s ease;
}

.app-notify.is-visible,
.ecom-notify.is-visible {
    display: flex;
}

.app-notify__icon,
.app-notify i,
.ecom-notify i {
    flex-shrink: 0;
    font-size: 18px;
    margin-top: 1px;
}

.app-notify--success,
.ecom-notify--success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}

.app-notify--success .app-notify__icon,
.app-notify--success i,
.ecom-notify--success i { color: #16a34a; }

.app-notify--error,
.ecom-notify--error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.app-notify--error .app-notify__icon,
.app-notify--error i,
.ecom-notify--error i { color: #dc2626; }

.app-notify--warning,
.ecom-notify--warning {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

.app-notify--warning i { color: #d97706; }

.app-notify--info,
.ecom-notify--info {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
}

.app-notify--info i { color: #2563eb; }

@keyframes appNotifyIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}
