/* Toast Container */
.toast-container {
    z-index: 1080 !important;
    pointer-events: none; /* Allow clicks through empty space */
}

    .toast-container > * {
        pointer-events: auto; /* Re-enable clicks for toasts */
    }

/* Base Toast Styling - Headerless */
.toast {
    border-radius: 12px !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2) !important;
    border: none !important;
    min-width: 300px;
    max-width: 380px;
    overflow: hidden;
    margin-bottom: 15px;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.98) !important;
    transform-origin: top right;
    padding: 0 !important; /* Remove default padding */
    position: relative;
    /* Animation properties */
    animation: toastSlideIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    opacity: 0;
}

/* Entrance Animation */
@keyframes toastSlideIn {
    0% {
        opacity: 0;
        transform: translateX(100px) scale(0.8);
    }

    70% {
        transform: translateX(-10px) scale(1.02);
    }

    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

/* Exit Animation */
.toast.hiding {
    animation: toastSlideOut 0.4s cubic-bezier(0.6, -0.28, 0.735, 0.045) forwards !important;
}

@keyframes toastSlideOut {
    0% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }

    30% {
        transform: translateX(-20px) scale(1.05);
    }

    100% {
        opacity: 0;
        transform: translateX(100px) scale(0.8);
    }
}

/* Toast Body - Full height without header */
.toast-body {
    padding: 20px 50px 20px 20px !important; /* More right padding for close button */
    font-size: 15px !important;
    line-height: 1.5 !important;
    color: #2c3e50 !important;
    position: relative;
    min-height: 60px;
    display: flex;
    align-items: center;
    border-radius: 12px !important;
}

/* Color coding through left border */
.toast.success .toast-body {
    /* border-left: 5px solid #28a745;
    background: linear-gradient(90deg, rgba(40, 167, 69, 0.05) 0%, rgba(255, 255, 255, 0.98) 10%) !important;*/
}

.toast.error .toast-body {
    /*border-left: 5px solid #dc3545;
    background: linear-gradient(90deg, rgba(220, 53, 69, 0.05) 0%, rgba(255, 255, 255, 0.98) 10%) !important;
    */
}

.toast.warning .toast-body {
    /*border-left: 5px solid #ffc107;
    background: linear-gradient(90deg, rgba(255, 193, 7, 0.05) 0%, rgba(255, 255, 255, 0.98) 10%) !important;
    */
}

.toast.info .toast-body {
    /* border-left: 5px solid #17a2b8;
    background: linear-gradient(90deg, rgba(23, 162, 184, 0.05) 0%, rgba(255, 255, 255, 0.98) 10%) !important;
    */
}

/* Close Button - Positioned in top right */
.toast .btn-close {
    position: absolute !important;
    top: 12px;
    right: 12px;
    width: 24px;
    height: 24px;
    padding: 0 !important;
    margin: 0 !important;
    background-size: 12px;
    opacity: 0.5 !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    z-index: 2;
}

    .toast .btn-close:hover {
        opacity: 1 !important;
        transform: scale(1.1) rotate(90deg) !important;
        background-color: rgba(0, 0, 0, 0.05);
        border-radius: 50%;
    }

/* Toast Icons - Positioned on left */
.toast-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    animation: iconPulse 0.5s ease-out;
}

.toast.success .toast-icon {
    color: #28a745;
    background: rgba(40, 167, 69, 0.1);
}

.toast.error .toast-icon {
    color: #dc3545;
    background: rgba(220, 53, 69, 0.1);
}

.toast.warning .toast-icon {
    color: #ffc107;
    background: rgba(255, 193, 7, 0.1);
}

.toast.info .toast-icon {
    color: #17a2b8;
    background: rgba(23, 162, 184, 0.1);
}

@keyframes iconPulse {
    0% {
        transform: translateY(-50%) scale(0);
        opacity: 0;
    }

    70% {
        transform: translateY(-50%) scale(1.2);
    }

    100% {
        transform: translateY(-50%) scale(1);
        opacity: 1;
    }
}

/* Progress Bar Animation - Top bar */
.toast-progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 3px;
    width: 100%;
    background: rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.toast-progress-bar {
    height: 100%;
    width: 100%;
    animation: progressBar 5s linear forwards;
    transform-origin: left;
}

.toast.success .toast-progress-bar {
    background: linear-gradient(90deg, #28a745, #20c997);
}

.toast.error .toast-progress-bar {
    background: linear-gradient(90deg, #dc3545, #e35d6a);
}

.toast.warning .toast-progress-bar {
    background: linear-gradient(90deg, #ffc107, #fd7e14);
}

.toast.info .toast-progress-bar {
    background: linear-gradient(90deg, #17a2b8, #0dcaf0);
}

@keyframes progressBar {
    from {
        transform: scaleX(1);
    }

    to {
        transform: scaleX(0);
    }
}

/* Time indicator */
.toast-time {
    position: absolute;
    bottom: 8px;
    right: 12px;
    font-size: 11px !important;
    color: rgba(0, 0, 0, 0.4) !important;
    font-weight: 500;
}

/* Notification Badge */
.toast-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    animation: badgePulse 2s infinite;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    z-index: 3;
}

@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

/* Hover Effects */
.toast:hover {
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.25) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Stacking effect for multiple toasts */
.toast-container .toast:nth-child(1) {
    transform-origin: top right;
}

.toast-container .toast:nth-child(2) {
    transform-origin: top right;
    transform: translateY(10px) scale(0.98);
    opacity: 0.95;
}

.toast-container .toast:nth-child(3) {
    transform-origin: top right;
    transform: translateY(20px) scale(0.96);
    opacity: 0.9;
}

.toast-container .toast:hover {
    transform: translateY(-2px) scale(1) !important;
    opacity: 1 !important;
    z-index: 1;
}

/* Bounce effect for important notifications */
.toast.important {
    animation: toastBounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

@keyframes toastBounceIn {
    0% {
        opacity: 0;
        transform: translateX(100px) scale(0.3);
    }

    50% {
        transform: translateX(-15px) scale(1.1);
    }

    70% {
        transform: translateX(10px) scale(0.95);
    }

    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

/* Shake animation for important toasts */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }

    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-3px);
    }

    20%, 40%, 60%, 80% {
        transform: translateX(3px);
    }
}

.toast.important {
    animation: shake 0.5s ease-in-out, toastSlideIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* Success Toast Special Effects */
.toast.success:hover .toast-icon {
    animation: iconSpin 0.5s ease;
}

@keyframes iconSpin {
    from {
        transform: translateY(-50%) rotate(0deg);
    }

    to {
        transform: translateY(-50%) rotate(360deg);
    }
}

/* Responsive Design */
@media (max-width: 576px) {
    .toast-container {
        padding: 10px !important;
        max-width: 100% !important;
        left: 10px !important;
        right: 10px !important;
    }

    .toast {
        min-width: unset !important;
        max-width: 100% !important;
        width: 100% !important;
        margin-bottom: 10px !important;
        border-radius: 10px !important;
    }

    .toast-body {
        padding: 16px 45px 16px 16px !important;
        font-size: 14px !important;
        min-height: 55px;
    }

    .toast-icon {
        left: 12px;
        font-size: 18px;
        width: 26px;
        height: 26px;
    }

    .toast .btn-close {
        top: 10px;
        right: 10px;
        width: 20px;
        height: 20px;
        background-size: 10px;
    }

    @keyframes toastSlideInMobile {
        0% {
            opacity: 0;
            transform: translateY(50px) scale(0.9);
        }

        100% {
            opacity: 1;
            transform: translateY(0) scale(1);
        }
    }

    .toast {
        animation: toastSlideInMobile 0.4s ease-out forwards;
    }

        .toast.hiding {
            animation: toastSlideOutMobile 0.3s ease-in forwards !important;
        }

    @keyframes toastSlideOutMobile {
        0% {
            opacity: 1;
            transform: translateY(0) scale(1);
        }

        100% {
            opacity: 0;
            transform: translateY(50px) scale(0.9);
        }
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .toast {
        background: rgba(30, 30, 40, 0.98) !important;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4) !important;
    }

    .toast-body {
        color: #e0e0e0 !important;
    }

    .toast.success .toast-body {
        background: linear-gradient(90deg, rgba(40, 167, 69, 0.1) 0%, rgba(30, 30, 40, 0.98) 10%) !important;
    }

    .toast.error .toast-body {
        background: linear-gradient(90deg, rgba(220, 53, 69, 0.1) 0%, rgba(30, 30, 40, 0.98) 10%) !important;
    }

    .toast.warning .toast-body {
        background: linear-gradient(90deg, rgba(255, 193, 7, 0.1) 0%, rgba(30, 30, 40, 0.98) 10%) !important;
    }

    .toast.info .toast-body {
        background: linear-gradient(90deg, rgba(23, 162, 184, 0.1) 0%, rgba(30, 30, 40, 0.98) 10%) !important;
    }

    .toast-time {
        color: rgba(255, 255, 255, 0.5) !important;
    }

    .toast:hover {
        box-shadow: 0 15px 30px rgba(0, 0, 0, 0.6) !important;
    }
}

/* Print styles */
@media print {
    .toast-container {
        display: none !important;
    }
}
