/* ═══════════════════════════════════════════════════════════════════════════════
   Premium Toast Notifications
   Brand-aligned, animated, with visual polish
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Container positioning */
#toast-container {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    z-index: 2147483647;
    pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Base Toast Styling
   ═══════════════════════════════════════════════════════════════════════════════ */

.toast {
    --toast-accent: var(--color-accent, #2563eb);
    --toast-bg: rgba(15, 15, 17, 0.92);
    --toast-border: rgba(255, 255, 255, 0.08);
    --toast-text: rgba(255, 255, 255, 0.92);
    --toast-glow: rgba(37, 99, 235, 0.15);
    
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    min-width: 280px;
    max-width: 380px;
    padding: 0.875rem 1rem;
    border-radius: 0.75rem;
    background: var(--toast-bg);
    border: 1px solid var(--toast-border);
    color: var(--toast-text);
    font-size: 0.875rem;
    line-height: 1.5;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.3),
        0 4px 16px rgba(0, 0, 0, 0.35),
        0 8px 32px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    overflow: hidden;
    pointer-events: auto;
    
    /* Entry animation */
    animation: toast-enter 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transform: translateX(120%);
}

/* Light theme adjustments */
.light .toast {
    --toast-bg: rgba(255, 255, 255, 0.95);
    --toast-border: rgba(0, 0, 0, 0.08);
    --toast-text: rgba(17, 17, 17, 0.92);
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.06),
        0 4px 16px rgba(0, 0, 0, 0.1),
        0 8px 32px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Animated Accent Line (left edge)
   ═══════════════════════════════════════════════════════════════════════════════ */

.toast::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--toast-accent);
    border-radius: 3px 0 0 3px;
    box-shadow: 0 0 12px var(--toast-glow);
}

/* Shimmer effect on the accent line */
.toast::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 30%;
    background: linear-gradient(
        to bottom,
        transparent,
        rgba(255, 255, 255, 0.6),
        transparent
    );
    border-radius: 3px 0 0 3px;
    animation: accent-shimmer 2s ease-in-out infinite;
    opacity: 0.7;
}

@keyframes accent-shimmer {
    0%, 100% { 
        top: -30%;
        opacity: 0;
    }
    10% {
        opacity: 0.7;
    }
    90% {
        opacity: 0.7;
    }
    100% {
        top: 100%;
        opacity: 0;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Icon Styling
   ═══════════════════════════════════════════════════════════════════════════════ */

.toast-icon {
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    margin-top: 0.0625rem;
    animation: icon-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.15s backwards;
}

@keyframes icon-pop {
    from {
        transform: scale(0) rotate(-45deg);
        opacity: 0;
    }
    to {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Content Area
   ═══════════════════════════════════════════════════════════════════════════════ */

.toast-content {
    flex: 1;
    min-width: 0;
    padding-right: 0.5rem;
}

.toast-message {
    word-break: break-word;
    animation: text-reveal 0.3s ease-out 0.1s backwards;
}

@keyframes text-reveal {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Progress Bar (auto-dismiss indicator)
   ═══════════════════════════════════════════════════════════════════════════════ */

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.toast-progress-bar {
    height: 100%;
    background: var(--toast-accent);
    transform-origin: left;
    animation: progress-shrink var(--toast-duration, 3s) linear forwards;
    box-shadow: 0 0 8px var(--toast-glow);
}

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

/* Pause progress on hover */
.toast:hover .toast-progress-bar {
    animation-play-state: paused;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Type Variants
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Success */
.toast.toast-success {
    --toast-accent: #22c55e;
    --toast-glow: rgba(34, 197, 94, 0.25);
    --toast-border: rgba(34, 197, 94, 0.15);
}

.toast.toast-success .toast-icon {
    color: #22c55e;
    text-shadow: 0 0 12px rgba(34, 197, 94, 0.5);
}

/* Error */
.toast.toast-error {
    --toast-accent: #ef4444;
    --toast-glow: rgba(239, 68, 68, 0.25);
    --toast-border: rgba(239, 68, 68, 0.15);
}

.toast.toast-error .toast-icon {
    color: #ef4444;
    text-shadow: 0 0 12px rgba(239, 68, 68, 0.5);
}

/* Warning */
.toast.toast-warning {
    --toast-accent: #f59e0b;
    --toast-glow: rgba(245, 158, 11, 0.25);
    --toast-border: rgba(245, 158, 11, 0.15);
}

.toast.toast-warning .toast-icon {
    color: #f59e0b;
    text-shadow: 0 0 12px rgba(245, 158, 11, 0.5);
}

/* Info */
.toast.toast-info {
    --toast-accent: #3b82f6;
    --toast-glow: rgba(59, 130, 246, 0.25);
    --toast-border: rgba(59, 130, 246, 0.15);
}

.toast.toast-info .toast-icon {
    color: #3b82f6;
    text-shadow: 0 0 12px rgba(59, 130, 246, 0.5);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Entry & Exit Animations
   ═══════════════════════════════════════════════════════════════════════════════ */

@keyframes toast-enter {
    from {
        transform: translateX(120%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.toast-exit {
    animation: toast-exit 0.35s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes toast-exit {
    0% {
        transform: translateX(0);
        opacity: 1;
    }
    100% {
        transform: translateX(120%);
        opacity: 0;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Hover Effects
   ═══════════════════════════════════════════════════════════════════════════════ */

.toast {
    transition: 
        transform 0.2s ease,
        box-shadow 0.2s ease,
        border-color 0.2s ease;
}

.toast:hover {
    transform: translateX(-4px);
    border-color: var(--toast-accent);
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.3),
        0 6px 20px rgba(0, 0, 0, 0.4),
        0 12px 40px rgba(0, 0, 0, 0.25),
        0 0 20px var(--toast-glow),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.light .toast:hover {
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.08),
        0 6px 20px rgba(0, 0, 0, 0.12),
        0 12px 40px rgba(0, 0, 0, 0.1),
        0 0 20px var(--toast-glow),
        inset 0 1px 0 rgba(255, 255, 255, 1);
}

/* Pause shimmer on hover too */
.toast:hover::after {
    animation-play-state: paused;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Dismiss Button (optional close)
   ═══════════════════════════════════════════════════════════════════════════════ */

.toast-dismiss {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 1.25rem;
    height: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.25rem;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.75rem;
    cursor: pointer;
    opacity: 0;
    transition: all 0.15s ease;
}

.light .toast-dismiss {
    color: rgba(0, 0, 0, 0.4);
}

.toast:hover .toast-dismiss {
    opacity: 1;
}

.toast-dismiss:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
}

.light .toast-dismiss:hover {
    background: rgba(0, 0, 0, 0.06);
    color: rgba(0, 0, 0, 0.7);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Stack Animation (when multiple toasts)
   ═══════════════════════════════════════════════════════════════════════════════ */

#toast-container .toast:not(:first-child) {
    animation: toast-stack 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes toast-stack {
    from {
        transform: translateX(120%) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Mobile Responsiveness
   ═══════════════════════════════════════════════════════════════════════════════ */

@media (max-width: 480px) {
    #toast-container {
        top: auto;
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
    }
    
    .toast {
        min-width: auto;
        max-width: none;
        width: 100%;
    }
    
    @keyframes toast-enter {
        from {
            transform: translateY(100%);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }
    
    @keyframes toast-exit {
        from {
            transform: translateY(0);
            opacity: 1;
        }
        to {
            transform: translateY(100%);
            opacity: 0;
        }
    }
    
    .toast:hover {
        transform: translateY(-2px);
    }
}

