/* =========================================
   AI 4 Green - Toast Notification System
   Professional & Modern Design
   ========================================= */

/* =========================
   1. CONTAINER & LAYOUT
   ========================= */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 420px;
    width: 100%;
    pointer-events: none;
}

@media (max-width: 640px) {
    .toast-container {
        top: 16px;
        right: 16px;
        left: 16px;
        max-width: none;
    }
}

/* =========================
   2. TOAST BASE STYLES
   ========================= */
.toast {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 18px 20px;
    background: white;
    border-radius: 16px;
    box-shadow:
        0 10px 40px rgba(15, 23, 42, 0.12),
        0 4px 12px rgba(15, 23, 42, 0.08),
        0 0 0 1px rgba(15, 23, 42, 0.04);
    backdrop-filter: blur(12px);
    pointer-events: auto;
    overflow: hidden;
    min-width: 320px;
    max-width: 100%;
    font-family: "Baloo 2", system-ui, sans-serif;
    animation: slideInRight 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transform-origin: right center;
}

@media (max-width: 640px) {
    .toast {
        min-width: 100%;
        padding: 16px 18px;
    }
}

/* =========================
   3. TOAST ANIMATIONS
   ========================= */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes slideOutRight {
    from {
        opacity: 1;
        transform: translateX(0) scale(1);
    }

    to {
        opacity: 0;
        transform: translateX(120%) scale(0.9);
    }
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.08);
    }
}

@keyframes progressCountdown {
    from {
        width: 100%;
    }

    to {
        width: 0%;
    }
}

.toast-out {
    animation: slideOutRight 0.3s cubic-bezier(0.4, 0, 1, 1) forwards;
}

/* =========================
   4. TOAST ICON
   ========================= */
.toast-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 22px;
    animation: pulse 2s ease-in-out infinite;
}

.toast-icon i {
    line-height: 1;
}

/* =========================
   5. TOAST CONTENT
   ========================= */
.toast-content {
    flex: 1;
    min-width: 0;
    padding-top: 2px;
}

.toast-title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 4px;
    color: #0f172a;
    letter-spacing: -0.01em;
}

.toast-message {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
    color: #475569;
    word-wrap: break-word;
}

/* =========================
   6. TOAST CLOSE BUTTON
   ========================= */
.toast-close {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.04);
    border: none;
    border-radius: 10px;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 18px;
    padding: 0;
    margin-top: -2px;
}

.toast-close:hover {
    background: rgba(15, 23, 42, 0.08);
    color: #334155;
    transform: scale(1.05);
}

.toast-close:active {
    transform: scale(0.95);
}

.toast-close i {
    line-height: 1;
}

/* =========================
   7. TOAST PROGRESS BAR
   ========================= */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(15, 23, 42, 0.06);
    overflow: hidden;
    border-radius: 0 0 16px 16px;
}

.toast-progress-bar {
    height: 100%;
    width: 100%;
    background: currentColor;
    opacity: 0.6;
    animation: progressCountdown linear forwards;
}

/* =========================
   8. TOAST VARIANTS
   ========================= */

/* SUCCESS - Emerald Green */
.toast-success {
    border-left: 4px solid #10b981;
}

.toast-success .toast-icon {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #059669;
}

.toast-success .toast-progress-bar {
    background: linear-gradient(90deg, #10b981 0%, #059669 100%);
}

/* ERROR - Red */
.toast-error {
    border-left: 4px solid #ef4444;
}

.toast-error .toast-icon {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #dc2626;
}

.toast-error .toast-progress-bar {
    background: linear-gradient(90deg, #ef4444 0%, #dc2626 100%);
}

/* WARNING - Amber/Orange */
.toast-warning {
    border-left: 4px solid #f59e0b;
}

.toast-warning .toast-icon {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #d97706;
}

.toast-warning .toast-progress-bar {
    background: linear-gradient(90deg, #f59e0b 0%, #d97706 100%);
}

/* INFO - Blue */
.toast-info {
    border-left: 4px solid #3b82f6;
}

.toast-info .toast-icon {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #2563eb;
}

.toast-info .toast-progress-bar {
    background: linear-gradient(90deg, #3b82f6 0%, #2563eb 100%);
}

/* =========================
   9. ENHANCED HOVER EFFECTS
   ========================= */
.toast:hover {
    box-shadow:
        0 20px 50px rgba(15, 23, 42, 0.15),
        0 8px 20px rgba(15, 23, 42, 0.10),
        0 0 0 1px rgba(15, 23, 42, 0.05);
    transform: translateY(-2px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast:hover .toast-progress-bar {
    animation-play-state: paused;
}

/* =========================
   10. ACCESSIBILITY
   ========================= */
.toast-close:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {

    .toast,
    .toast-out,
    .toast-icon {
        animation: none;
    }

    .toast {
        opacity: 1;
        transform: none;
    }
}

/* =========================
   11. DARK MODE SUPPORT (Optional)
   ========================= */
@media (prefers-color-scheme: dark) {
    .toast {
        background: #1e293b;
        box-shadow:
            0 10px 40px rgba(0, 0, 0, 0.3),
            0 4px 12px rgba(0, 0, 0, 0.2),
            0 0 0 1px rgba(255, 255, 255, 0.1);
    }

    .toast-title {
        color: #f1f5f9;
    }

    .toast-message {
        color: #cbd5e1;
    }

    .toast-close {
        background: rgba(255, 255, 255, 0.08);
        color: #94a3b8;
    }

    .toast-close:hover {
        background: rgba(255, 255, 255, 0.12);
        color: #e2e8f0;
    }
}

/* =========================
   12. STACKING BEHAVIOR
   ========================= */
.toast:nth-child(n+4) {
    opacity: 0.8;
    transform: scale(0.98) translateY(-8px);
}

.toast:nth-child(n+5) {
    display: none;
}

/* =========================
   13. MOBILE OPTIMIZATIONS
   ========================= */
@media (max-width: 480px) {
    .toast-icon {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }

    .toast-title {
        font-size: 14px;
    }

    .toast-message {
        font-size: 13px;
    }

    .toast-close {
        width: 28px;
        height: 28px;
        font-size: 16px;
    }
}

/* =========================
   14. PRINT STYLES
   ========================= */
@media print {
    .toast-container {
        display: none;
    }
}