/* ==========================================
   Toast Alert Plugin - Error Notifications
   Top-Right Animated & Responsive Toast
   ========================================== */

#toast-alert-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 420px;
    width: calc(100% - 40px);
    pointer-events: none;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.toast-alert {
    pointer-events: auto;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 18px;
    border-radius: 14px;
    box-sizing: border-box;

    /* Theme: Error Red (Glassmorphism & Gradient Glow) */
    background: rgba(24, 10, 12, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(239, 68, 68, 0.3);
    box-shadow: 
        0 12px 32px -4px rgba(220, 38, 38, 0.35),
        0 4px 12px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);

    color: #ffffff;
    transform-origin: top right;
    animation: toastSlideInRight 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transition: transform 0.3s ease, opacity 0.3s ease, margin-top 0.3s ease;
}

.toast-alert.toast-closing {
    animation: toastSlideOutRight 0.35s cubic-bezier(0.7, 0, 0.84, 0) forwards;
}

/* Left Accent Line */
.toast-alert::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #ef4444, #b91c1c);
    border-radius: 14px 0 0 14px;
}

/* Theme: Warning / Alert (Amber Glow) */
.toast-alert.toast-alert-warning {
    background: rgba(28, 20, 8, 0.92);
    border: 1px solid rgba(245, 158, 11, 0.35);
    box-shadow: 
        0 12px 32px -4px rgba(245, 158, 11, 0.35),
        0 4px 12px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.toast-alert.toast-alert-warning::before {
    background: linear-gradient(180deg, #f59e0b, #d97706);
}

.toast-alert.toast-alert-warning .toast-icon-wrapper {
    background: radial-gradient(circle at center, rgba(245, 158, 11, 0.25), rgba(217, 119, 6, 0.1));
    border: 1px solid rgba(245, 158, 11, 0.4);
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.3);
    color: #fbbf24;
}

.toast-alert.toast-alert-warning .toast-message {
    color: rgba(254, 243, 199, 0.9);
}

.toast-alert.toast-alert-warning .toast-progress-bar {
    background: linear-gradient(90deg, #fbbf24, #f59e0b);
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
}

/* Theme: Success (Emerald Green Glow) */
.toast-alert.toast-alert-success {
    background: rgba(6, 24, 16, 0.92);
    border: 1px solid rgba(16, 185, 129, 0.35);
    box-shadow: 
        0 12px 32px -4px rgba(16, 185, 129, 0.35),
        0 4px 12px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.toast-alert.toast-alert-success::before {
    background: linear-gradient(180deg, #10b981, #059669);
}

.toast-alert.toast-alert-success .toast-icon-wrapper {
    background: radial-gradient(circle at center, rgba(16, 185, 129, 0.25), rgba(5, 150, 105, 0.1));
    border: 1px solid rgba(16, 185, 129, 0.4);
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.3);
    color: #34d399;
}

.toast-alert.toast-alert-success .toast-message {
    color: rgba(209, 250, 229, 0.9);
}

.toast-alert.toast-alert-success .toast-progress-bar {
    background: linear-gradient(90deg, #34d399, #10b981);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

/* Theme: Info (Blue Glow) */
.toast-alert.toast-alert-info {
    background: rgba(8, 18, 30, 0.92);
    border: 1px solid rgba(59, 130, 246, 0.35);
    box-shadow: 
        0 12px 32px -4px rgba(59, 130, 246, 0.35),
        0 4px 12px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.toast-alert.toast-alert-info::before {
    background: linear-gradient(180deg, #3b82f6, #2563eb);
}

.toast-alert.toast-alert-info .toast-icon-wrapper {
    background: radial-gradient(circle at center, rgba(59, 130, 246, 0.25), rgba(37, 99, 235, 0.1));
    border: 1px solid rgba(59, 130, 246, 0.4);
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.3);
    color: #60a5fa;
}

.toast-alert.toast-alert-info .toast-message {
    color: rgba(219, 234, 254, 0.9);
}

.toast-alert.toast-alert-info .toast-progress-bar {
    background: linear-gradient(90deg, #60a5fa, #3b82f6);
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.6);
}

/* Icon Container */
.toast-icon-wrapper {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: radial-gradient(circle at center, rgba(239, 68, 68, 0.25), rgba(185, 28, 28, 0.1));
    border: 1px solid rgba(239, 68, 68, 0.4);
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.3);
    color: #f87171;
    animation: toastIconPulse 2s infinite ease-in-out;
}

.toast-icon-wrapper svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Content */
.toast-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.toast-title {
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.toast-message {
    font-size: 13px;
    font-weight: 400;
    color: rgba(254, 205, 211, 0.9);
    line-height: 1.45;
    word-break: break-word;
}

/* Close Button */
.toast-close-btn {
    flex-shrink: 0;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
    margin-top: -2px;
    margin-right: -4px;
}

.toast-close-btn:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.12);
    transform: scale(1.1);
}

.toast-close-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Progress Bar Timer */
.toast-progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 100%;
    background: linear-gradient(90deg, #f87171, #ef4444);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
    transform-origin: left;
    animation: toastProgressLinear linear forwards;
}

.toast-alert:hover .toast-progress-bar {
    animation-play-state: paused;
}

/* Keyframe Animations */
@keyframes toastSlideInRight {
    0% {
        opacity: 0;
        transform: translate3d(110%, 0, 0) scale(0.92);
    }
    60% {
        opacity: 1;
        transform: translate3d(-6px, 0, 0) scale(1.02);
    }
    100% {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
    }
}

@keyframes toastSlideOutRight {
    0% {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
        max-height: 200px;
    }
    100% {
        opacity: 0;
        transform: translate3d(120%, 0, 0) scale(0.85);
        max-height: 0;
        margin-top: -12px;
        padding-top: 0;
        padding-bottom: 0;
    }
}

@keyframes toastIconPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
    }
    50% {
        transform: scale(1.06);
        box-shadow: 0 0 18px rgba(239, 68, 68, 0.55);
    }
}

@keyframes toastProgressLinear {
    0% {
        transform: scaleX(1);
    }
    100% {
        transform: scaleX(0);
    }
}

/* Responsive Rules for Small Devices (Mobile) */
@media (max-width: 480px) {
    #toast-alert-container {
        top: 12px;
        left: 12px;
        right: 12px;
        width: auto;
        max-width: none;
    }

    .toast-alert {
        padding: 14px 16px;
        border-radius: 12px;
    }

    .toast-title {
        font-size: 14px;
    }

    .toast-message {
        font-size: 12px;
    }
}
