/* ============================================
   Toast Notification Component
   Professional toast notifications
   ============================================ */

.toast-container {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    pointer-events: none;
    max-width: 420px;
    width: calc(100% - 2.5rem);
}

/* Individual toast */
.toast-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #fff;
    pointer-events: auto;
    position: relative;
    overflow: hidden;
    max-height: 120px;

    /* Initial state — offscreen */
    transform: translateX(calc(100% + 2rem));
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1),
                opacity 0.4s cubic-bezier(0.22, 1, 0.36, 1);

    /* Subtle glass effect */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.18),
        0 2px 8px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

/* Slide in */
.toast-item.toast-visible {
    transform: translateX(0);
    opacity: 1;
}

/* Slide out */
.toast-item.toast-removing {
    transform: translateX(calc(100% + 2rem));
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.55, 0, 1, 0.45),
                opacity 0.35s cubic-bezier(0.55, 0, 1, 0.45);
}

/* ── Type Colors ── */
.toast-item.toast-success {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    border-left: 4px solid #34d399;
}

.toast-item.toast-error {
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
    border-left: 4px solid #f87171;
}

.toast-item.toast-warning {
    background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
    border-left: 4px solid #fbbf24;
}

.toast-item.toast-info {
    background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
    border-left: 4px solid #60a5fa;
}

/* ── Icon ── */
.toast-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin-top: 1px;
    opacity: 0.95;
}

.toast-icon svg {
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.15));
}

/* ── Body ── */
.toast-body {
    flex: 1;
    min-width: 0;
}

.toast-message {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.45;
    letter-spacing: 0.01em;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.12);
}

/* ── Close Button ── */
.toast-close {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 0.375rem;
    color: #fff;
    cursor: pointer;
    padding: 0.25rem;
    transition: background 0.2s;
    margin-top: 1px;
}

.toast-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.toast-close:active {
    background: rgba(255, 255, 255, 0.1);
}

/* ── Progress Bar ── */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 100%;
    background: rgba(255, 255, 255, 0.35);
    transform-origin: left;
    animation: toast-progress-shrink linear forwards;
    border-radius: 0 0 0 0.75rem;
}

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

/* ── Hover pause effect ── */
.toast-item:hover .toast-progress {
    animation-play-state: paused;
}

/* ── Responsive ── */
@media (max-width: 480px) {
    .toast-container {
        top: 0.75rem;
        right: 0.75rem;
        left: 0.75rem;
        max-width: none;
        width: auto;
    }

    .toast-item {
        font-size: 0.8125rem;
        padding: 0.75rem 0.875rem;
    }
}
