/* =========================
   TOAST NOTIFICATION
========================= */

.toast-container {
    position: fixed;
    z-index: 2100;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: min(400px, calc(100vw - 32px));
    pointer-events: none;
    padding: 8px;
    box-sizing: border-box;
}

.toast-container.toast-left-top {
    top: 16px;
    left: 16px;
}

.toast-container.toast-right-top {
    top: 16px;
    right: 16px;
}

.toast-container.toast-left-bottom {
    bottom: 16px;
    left: 16px;
    flex-direction: column-reverse;
}

.toast-container.toast-right-bottom {
    bottom: 16px;
    right: 16px;
    flex-direction: column-reverse;
}

.toast-container.toast-center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    align-items: center;
}

.toast-container.toast-center .toast-item {
    width: 100%;
}

/* Base toast */

.toast-item {
    --toast-accent: #64748b;
    --toast-bg: #ffffff;

    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;

    width: 100%;
    padding: 16px;
    box-sizing: border-box;

    color: #1e293b;
    background: var(--toast-bg);
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-left: 4px solid var(--toast-accent);
    border-radius: 14px;

    box-shadow:
        0 10px 30px rgba(15, 23, 42, 0.12),
        0 2px 8px rgba(15, 23, 42, 0.05);

    pointer-events: auto;
    overflow: hidden;

    opacity: 0;
    transform: translateY(-12px) scale(0.97);

    transition:
        opacity 240ms ease,
        transform 280ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.toast-item.toast-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.toast-item.toast-hiding {
    opacity: 0;
    transform: translateY(-8px) scale(0.97);
    pointer-events: none;
}

.toast-container.toast-left-bottom .toast-item,
.toast-container.toast-right-bottom .toast-item {
    transform: translateY(12px) scale(0.97);
}

.toast-container.toast-left-bottom .toast-item.toast-visible,
.toast-container.toast-right-bottom .toast-item.toast-visible {
    transform: translateY(0) scale(1);
}

.toast-container.toast-left-bottom .toast-item.toast-hiding,
.toast-container.toast-right-bottom .toast-item.toast-hiding {
    transform: translateY(8px) scale(0.97);
}

.toast-container.toast-center .toast-item {
    transform: translateY(8px) scale(0.97);
}

.toast-container.toast-center .toast-item.toast-visible {
    transform: translateY(0) scale(1);
}

/* Icon */

.toast-icon {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 10px;
    color: var(--toast-accent);
    background: color-mix(in srgb, var(--toast-accent) 12%, white);

    font-size: 19px;
    font-weight: 700;
    line-height: 1;
}

/* Content */

.toast-content {
    flex: 1;
    min-width: 0;
    padding-top: 1px;
    overflow-wrap: anywhere;
}

.toast-title {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.5;
    color: #0f172a;
}

.toast-subtitle {
    margin-top: 2px;
    font-size: 12px;
    line-height: 1.5;
    color: #64748b;
}

.toast-body {
    margin-top: 5px;
    font-size: 13px;
    line-height: 1.55;
    color: #475569;
}

/* Close button */

.toast-close {
    flex: 0 0 24px;
    width: 24px;
    height: 24px;
    margin: -3px -5px 0 0;
    padding: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    color: #94a3b8;
    background: transparent;
    border: 0;
    border-radius: 6px;

    font: inherit;
    font-size: 21px;
    line-height: 1;
    cursor: pointer;
    transition: color 150ms ease, background 150ms ease;
}

.toast-close:hover {
    color: #334155;
    background: #f1f5f9;
}

/* Toast variants */

.toast-item.toast-success {
    --toast-accent: #16a34a;
}

.toast-item.toast-error {
    --toast-accent: #dc2626;
}

.toast-item.toast-warning {
    --toast-accent: #d97706;
}

.toast-item.toast-info {
    --toast-accent: #2563eb;
}

@media (max-width: 480px) {
    .toast-container.toast-left-top,
    .toast-container.toast-right-top {
        top: 8px;
    }

    .toast-container.toast-left-bottom,
    .toast-container.toast-right-bottom {
        bottom: 8px;
    }

    .toast-container.toast-left-top,
    .toast-container.toast-left-bottom {
        left: 8px;
    }

    .toast-container.toast-right-top,
    .toast-container.toast-right-bottom {
        right: 8px;
    }

    .toast-container {
        width: calc(100vw - 16px);
    }

    .toast-item {
        padding: 13px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .toast-item,
    .toast-close {
        transition: none;
    }
}