/* ─── Toast Notifications ─── */

.toast-container {
    position: fixed;
    top: var(--space-4);
    right: var(--space-4);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    pointer-events: none;
    max-width: 380px;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-lg);
    background: rgba(30, 25, 20, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.04);
    pointer-events: auto;
    transform: translateX(120%);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
        opacity 0.3s ease;
    position: relative;
    overflow: hidden;
}

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

.toast--exit {
    transform: translateX(120%);
    opacity: 0;
    transition: transform 0.3s ease-in, opacity 0.2s ease;
}

/* Type-specific borders */
.toast--badge {
    border-color: rgba(250, 204, 21, 0.4);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 20px rgba(250, 204, 21, 0.1);
}

.toast--levelup {
    border-color: rgba(168, 85, 247, 0.4);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 20px rgba(168, 85, 247, 0.1);
}

.toast--goal {
    border-color: rgba(74, 222, 128, 0.4);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 20px rgba(74, 222, 128, 0.1);
}

.toast--warning {
    border-color: rgba(239, 68, 68, 0.4);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 20px rgba(239, 68, 68, 0.1);
}

.toast--info {
    border-color: rgba(96, 165, 250, 0.4);
}

.toast--success {
    border-color: rgba(74, 222, 128, 0.4);
}

/* Icon */
.toast__icon {
    font-size: 1.75rem;
    line-height: 1;
    flex-shrink: 0;
    animation: toast-icon-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s both;
}

@keyframes toast-icon-pop {
    from {
        transform: scale(0);
    }

    to {
        transform: scale(1);
    }
}

/* Body */
.toast__body {
    flex: 1;
    min-width: 0;
}

.toast__title {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.toast__message {
    font-size: var(--text-xs);
    color: var(--text-muted);
    line-height: 1.4;
}

/* Close */
.toast__close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.75rem;
    padding: 2px;
    opacity: 0.5;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.toast__close:hover {
    opacity: 1;
}

/* Timer bar */
.toast__timer {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    width: 100%;
    background: var(--accent-primary);
    transform-origin: left;
    animation: toast-timer linear forwards;
    opacity: 0.5;
}

@keyframes toast-timer {
    from {
        transform: scaleX(1);
    }

    to {
        transform: scaleX(0);
    }
}

/* Badge-type glow shimmer */
.toast--badge::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 30%, rgba(250, 204, 21, 0.06) 50%, transparent 70%);
    animation: toast-shimmer 2s ease-in-out infinite;
}

@keyframes toast-shimmer {

    0%,
    100% {
        transform: translateX(-100%);
    }

    50% {
        transform: translateX(100%);
    }
}

/* Level-up glow */
.toast--levelup::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 30%, rgba(168, 85, 247, 0.06) 50%, transparent 70%);
    animation: toast-shimmer 2s ease-in-out infinite;
}

/* Mobile */
@media (max-width: 600px) {
    .toast-container {
        top: auto;
        bottom: var(--space-4);
        right: var(--space-3);
        left: var(--space-3);
        max-width: none;
    }

    .toast {
        transform: translateY(120%);
    }

    .toast--visible {
        transform: translateY(0);
    }

    .toast--exit {
        transform: translateY(120%);
    }
}