/* ==========================================================================
   UNIFIED TOAST NOTIFICATION SYSTEM
   Shared across: Upload Reports, Code Mapping, SAF-T Editor
   ========================================================================== */

/* Container: Fixed positioning wrapper */
.saft-toast-container {
    position: fixed !important;
    top: 18px;
    right: 18px;
    z-index: 99999 !important;
    width: 400px;
    height: 0;
    pointer-events: none;
}

/* Single toast: Absolute positioning, replaces previous */
.saft-toast {
    min-width: 310px;
    max-width: 400px;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, rgba(10, 37, 64, 0.95), rgba(20, 47, 74, 0.95));
    backdrop-filter: blur(12px);
    border: 1.5px solid rgba(59, 130, 246, 0.6);
    border-radius: 10px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
    color: white;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 0.8rem;
    position: absolute;
    top: 0;
    right: 0;
    overflow: hidden;
    pointer-events: auto;
    cursor: pointer;

    /* Start off-screen right */
    transform: translateX(100%);
    opacity: 0;

    /* Smooth horizontal slide */
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
}

/* Slide in from right */
.saft-toast.visible {
    display: flex;
    transform: translateX(0);
    opacity: 1;
}

/* Slide out to right when dismissed */
.saft-toast.removing {
    transform: translateX(100%);
    opacity: 0;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
}

/* Hover subtle shift */
.saft-toast:hover {
    transform: translateX(-3px);
}

/* ============================================
   TYPE-SPECIFIC STYLES
   ============================================ */

/* SUCCESS - Deep emerald green */
.saft-toast.success {
    background: linear-gradient(135deg, rgba(16, 120, 90, 0.95), rgba(5, 100, 70, 0.95));
    border: 1.8px solid rgba(34, 197, 94, 0.45); /* Slightly thinner */
}
.saft-toast.success .saft-toast-icon {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.28), rgba(22, 163, 74, 0.28)); /* Slightly reduced opacity */
}

/* ERROR - Deep crimson red (IMPROVED - less cherry) */
.saft-toast.error {
    background: linear-gradient(135deg, rgba(140, 25, 25, 0.95), rgba(110, 15, 15, 0.95));
    border: 1.8px solid rgba(220, 38, 38, 0.45); /* Slightly thinner */
}
.saft-toast.error .saft-toast-icon {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.28), rgba(220, 38, 38, 0.28)); /* Slightly reduced opacity */
}

/* WARNING - Deep amber/orange */
.saft-toast.warning {
    background: linear-gradient(135deg, rgba(180, 100, 10, 0.95), rgba(150, 80, 5, 0.95));
    border: 1.8px solid rgba(251, 191, 36, 0.45); /* Slightly thinner */
}
.saft-toast.warning .saft-toast-icon {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.28), rgba(217, 119, 6, 0.28)); /* Slightly reduced opacity */
}

/* INFO - Deep navy blue */
.saft-toast.info {
    background: linear-gradient(135deg, rgba(10, 37, 64, 0.95), rgba(20, 47, 74, 0.95));
    border: 1.8px solid rgba(59, 130, 246, 0.55); /* Slightly thinner */
}
.saft-toast.info .saft-toast-icon {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.28), rgba(37, 99, 235, 0.28)); /* Slightly reduced opacity */
}

/* LOADING - Deep purple */
.saft-toast.loading {
    background: linear-gradient(135deg, rgba(90, 50, 150, 0.95), rgba(70, 35, 120, 0.95));
    border: 1.8px solid rgba(139, 92, 246, 0.45); /* Slightly thinner */
}
.saft-toast.loading .saft-toast-icon {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.28), rgba(124, 58, 237, 0.28)); /* Slightly reduced opacity */
}

/* UNDO - Deep slate gray */
.saft-toast.undo {
    background: linear-gradient(135deg, rgba(50, 60, 75, 0.95), rgba(35, 45, 60, 0.95));
    border: 1.8px solid rgba(100, 116, 139, 0.45); /* Slightly thinner */
}
.saft-toast.undo .saft-toast-icon {
    background: linear-gradient(135deg, rgba(100, 116, 139, 0.28), rgba(71, 85, 105, 0.28)); /* Slightly reduced opacity */
}

/* ============================================
   TOAST COMPONENTS
   ============================================ */

/* Icon */
.saft-toast-icon {
    width: 36px;
    height: 36px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1rem;
}

/* Type-specific icon backgrounds */
.saft-toast.success .saft-toast-icon {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}
.saft-toast.error .saft-toast-icon {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}
.saft-toast.warning .saft-toast-icon {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}
.saft-toast.info .saft-toast-icon {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}
.saft-toast.loading .saft-toast-icon {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}
.saft-toast.undo .saft-toast-icon {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
}

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

.saft-toast-title {
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1.3;
}

.saft-toast-message {
    font-size: 0.82rem;
    line-height: 1.4;
    opacity: 0.95;
}

/* Progress Bar */
.saft-toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 0 0 0 10px;
    transform-origin: left;
    animation: saftToastProgress linear forwards;
}

/* Close Button */
.saft-toast-close {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 21px;
    height: 21px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.73rem;
    opacity: 0;
    transition: all 0.16s ease;
}

.saft-toast:hover .saft-toast-close {
    opacity: 1;
}

.saft-toast-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes saftToastProgress {
    from { transform: scaleX(1); }
    to   { transform: scaleX(0); }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .saft-toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
        width: calc(100% - 20px);
    }

    .saft-toast {
        min-width: unset;
        max-width: unset;
        padding: 0.9rem 1.1rem;
    }

    .saft-toast-icon {
        width: 34px;
        height: 34px;
        font-size: 0.95rem;
    }
}