/**
 * Stacking Toast Notification Styles
 * Companion CSS for the Alpine.js stacking toast notification system
 * 
 * Features:
 * - Stacking layout with smooth animations
 * - Slide-in from top with spring-like bounce
 * - Smooth slide-out animation for dismissal
 * - Elegant repositioning when toasts are added/removed
 */

/* ============================================
   Toast Container (Stacking)
   ============================================ */
.toast-stack {
    position: fixed;
    top: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    pointer-events: none;
}

/* ============================================
   Individual Toast Item
   ============================================ */
.toast-item {
    pointer-events: auto;
    /* Smooth transition for repositioning when other toasts are added/removed */
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
        margin 0.3s ease-out;
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background-color: white;
    padding: 0.875rem 1.25rem;
    border-radius: 0.875rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 2px 4px -2px rgba(0, 0, 0, 0.1),
        0 20px 25px -5px rgba(0, 0, 0, 0.1),
        0 8px 10px -6px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
    min-width: 220px;
    max-width: 420px;
    backdrop-filter: blur(8px);
    background: rgba(255, 255, 255, 0.98);
}

/* Subtle hover lift effect */
.toast-content:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 8px -1px rgba(0, 0, 0, 0.1),
        0 4px 6px -2px rgba(0, 0, 0, 0.1),
        0 25px 30px -5px rgba(0, 0, 0, 0.12),
        0 10px 12px -6px rgba(0, 0, 0, 0.1);
}

/* ============================================
   Toast Icons
   ============================================ */
.toast-icon {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.toast-icon svg {
    width: 1rem;
    height: 1rem;
}

/* Success Icon */
.toast-icon--success {
    background-color: #dcfce7;
}

.toast-icon--success svg {
    color: #16a34a;
}

/* Error Icon */
.toast-icon--error {
    background-color: #fee2e2;
}

.toast-icon--error svg {
    color: #dc2626;
}

/* Warning Icon */
.toast-icon--warning {
    background-color: #fef3c7;
}

.toast-icon--warning svg {
    color: #d97706;
}

/* Info Icon */
.toast-icon--info {
    background-color: #dbeafe;
}

.toast-icon--info svg {
    color: #2563eb;
}

/* ============================================
   Toast Message
   ============================================ */
.toast-message {
    color: #1f2937;
    font-weight: 500;
    font-size: 0.875rem;
    line-height: 1.25rem;
}

/* ============================================
   Toast Close Button
   ============================================ */
.toast-close {
    margin-left: 0.5rem;
    color: #9ca3af;
    flex-shrink: 0;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0.375rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-close:hover {
    color: #4b5563;
    background-color: #f3f4f6;
    transform: scale(1.1);
}

.toast-close:active {
    transform: scale(0.95);
}

.toast-close svg {
    width: 1rem;
    height: 1rem;
}

/* ============================================
   Enhanced Animation Keyframes
   ============================================ */

/* Enter animation - smooth slide down with subtle bounce */
@keyframes toastEnter {
    0% {
        opacity: 0;
        transform: translateY(-100%) scale(0.9);
    }

    50% {
        opacity: 0.8;
        transform: translateY(8%) scale(1.02);
    }

    70% {
        transform: translateY(-2%) scale(0.99);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Exit animation - fade out and slide up */
@keyframes toastExit {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    100% {
        opacity: 0;
        transform: translateY(-50%) scale(0.9);
    }
}

/* Alternative: Simpler smooth slide (fallback) */
@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateY(-2rem);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    to {
        opacity: 0;
        transform: translateY(-1rem) scale(0.95);
    }
}

/* Animation classes */
.toast-enter {
    animation: toastEnter 0.5s cubic-bezier(0.21, 1.02, 0.73, 1) forwards;
}

.toast-leave {
    animation: toastExit 0.3s cubic-bezier(0.4, 0, 1, 1) forwards;
}

/* ============================================
   Responsive Adjustments
   ============================================ */
@media (max-width: 480px) {
    .toast-stack {
        left: 1rem;
        right: 1rem;
        transform: none;
    }

    .toast-content {
        min-width: unset;
        max-width: 100%;
        width: 100%;
    }
}

/* ============================================
   Reduced Motion Preference
   ============================================ */
@media (prefers-reduced-motion: reduce) {

    .toast-item,
    .toast-content,
    .toast-close {
        transition: none;
    }

    .toast-enter {
        animation: none;
        opacity: 1;
    }

    .toast-leave {
        animation: none;
    }
}