/* Nanhkiet Toast Notification - Custom Toast Style */
.nanhkiet-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
    max-width: 450px;
    width: 100%;
}

.nanhkiet-toast {
    position: relative;
    min-width: 400px;
    max-width: 450px;
    padding: 32px 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    pointer-events: auto;
    animation: nanhkiet-toast-slide-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.nanhkiet-toast:hover {
    transform: translateX(-4px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.nanhkiet-toast.hiding {
    animation: nanhkiet-toast-slide-out 0.3s cubic-bezier(0.7, 0, 0.84, 0) forwards;
}

@keyframes nanhkiet-toast-slide-in {
    from {
        transform: translateX(120%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes nanhkiet-toast-slide-out {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(120%);
        opacity: 0;
    }
}

.nanhkiet-toast-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 16px;
    position: relative;
    overflow: visible;
}

.nanhkiet-toast-icon-text {
    position: relative;
    z-index: 1;
}

/* Success Icon Animation - Draw checkmark like SweetAlert2 (Mượt hơn) */
.nanhkiet-toast.success .nanhkiet-toast-icon {
    animation: nanhkiet-success-icon-pop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.nanhkiet-toast.success .nanhkiet-toast-icon-text {
    display: none;
}

.nanhkiet-toast.success .nanhkiet-toast-icon::before {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border-right: 3px solid transparent;
    border-bottom: 3px solid #25b865;
    transform: rotate(-45deg);
    animation: nanhkiet-success-line-tip 0.85s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.2s forwards;
    left: 7px;
    top: 13px;
}

.nanhkiet-toast.success .nanhkiet-toast-icon::after {
    content: '';
    position: absolute;
    width: 0;
    height: 3px;
    background-color: #25b865;
    transform: rotate(45deg);
    animation: nanhkiet-success-line-long 0.85s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.3s forwards;
    left: 8px;
    top: 17px;
}

@keyframes nanhkiet-success-icon-pop {
    0% {
        transform: scale(0);
    }

    50% {
        transform: scale(1.15);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes nanhkiet-success-line-tip {
    0% {
        width: 0;
        height: 0;
        border-right: 0 solid transparent;
        border-bottom: 0 solid #25b865;
    }

    50% {
        width: 0;
        height: 0;
        border-right: 3px solid transparent;
        border-bottom: 3px solid #25b865;
    }

    65% {
        width: 5px;
        height: 0;
        border-right: 3px solid transparent;
        border-bottom: 3px solid #25b865;
    }

    80% {
        width: 5px;
        height: 8px;
        border-right: 3px solid transparent;
        border-bottom: 3px solid #25b865;
    }

    100% {
        width: 6px;
        height: 10px;
        border-right: 3px solid transparent;
        border-bottom: 3px solid #25b865;
    }
}

@keyframes nanhkiet-success-line-long {
    0% {
        width: 0;
        height: 3px;
    }

    60% {
        width: 0;
        height: 3px;
    }

    80% {
        width: 10px;
        height: 3px;
    }

    100% {
        width: 12px;
        height: 3px;
    }
}

/* Error Icon Animation - Draw X like SweetAlert2 (Mượt hơn) */
.nanhkiet-toast.error .nanhkiet-toast-icon {
    animation: nanhkiet-error-icon-pop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.nanhkiet-toast.error .nanhkiet-toast-icon-text {
    display: none;
}

.nanhkiet-toast.error .nanhkiet-toast-icon::before,
.nanhkiet-toast.error .nanhkiet-toast-icon::after {
    content: '';
    position: absolute;
    width: 3px;
    height: 18px;
    background-color: #dc3545;
    top: 50%;
    left: 50%;
    margin-top: -9px;
    margin-left: -1.5px;
    transform-origin: center;
}

.nanhkiet-toast.error .nanhkiet-toast-icon::before {
    animation: nanhkiet-error-x-left 0.75s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.15s forwards;
    transform: rotate(45deg) scaleY(0);
}

.nanhkiet-toast.error .nanhkiet-toast-icon::after {
    animation: nanhkiet-error-x-right 0.75s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.2s forwards;
    transform: rotate(-45deg) scaleY(0);
}

@keyframes nanhkiet-error-icon-pop {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    50% {
        transform: scale(1.08);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes nanhkiet-error-x-left {
    0% {
        transform: rotate(45deg) scaleY(0);
        opacity: 0;
    }

    50% {
        opacity: 1;
    }

    100% {
        transform: rotate(45deg) scaleY(1);
        opacity: 1;
    }
}

@keyframes nanhkiet-error-x-right {
    0% {
        transform: rotate(-45deg) scaleY(0);
        opacity: 0;
    }

    50% {
        opacity: 1;
    }

    100% {
        transform: rotate(-45deg) scaleY(1);
        opacity: 1;
    }
}

/* Warning Icon Animation - Pulse */
.nanhkiet-toast.warning .nanhkiet-toast-icon {
    animation: nanhkiet-warning-pop 0.3s ease;
}

@keyframes nanhkiet-warning-pop {
    0% {
        transform: scale(0);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

/* Info Icon Animation - Pop */
.nanhkiet-toast.info .nanhkiet-toast-icon {
    animation: nanhkiet-info-pop 0.3s ease;
}

@keyframes nanhkiet-info-pop {
    0% {
        transform: scale(0);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

.nanhkiet-toast-content {
    flex: 1;
    min-width: 0;
}

.nanhkiet-toast-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.5;
    color: #1c252e;
    margin: 0;
    word-wrap: break-word;
    white-space: normal;
}

.nanhkiet-toast-close {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    opacity: 0.5;
    transition: opacity 0.2s ease;
    color: #6c757d;
    font-size: 18px;
    line-height: 1;
}

.nanhkiet-toast-close:hover {
    opacity: 1;
}

.nanhkiet-toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 0 0 8px 8px;
    overflow: hidden;
}

.nanhkiet-toast-progress-bar {
    height: 100%;
    transition: width linear;
    border-radius: 0 0 8px 8px;
}

/* Success Toast */
.nanhkiet-toast.success {
    border-left: 4px solid #25b865;
}

.nanhkiet-toast.success .nanhkiet-toast-icon {
    background-color: #d1e7dd;
    color: #25b865;
}

.nanhkiet-toast.success .nanhkiet-toast-progress-bar {
    background-color: #25b865;
}

/* Error Toast */
.nanhkiet-toast.error {
    border-left: 4px solid #dc3545;
}

.nanhkiet-toast.error .nanhkiet-toast-icon {
    background-color: #f8d7da;
    color: #dc3545;
}

.nanhkiet-toast.error .nanhkiet-toast-progress-bar {
    background-color: #dc3545;
}

/* Warning Toast */
.nanhkiet-toast.warning {
    border-left: 4px solid #ffc107;
}

.nanhkiet-toast.warning .nanhkiet-toast-icon {
    background-color: #fff3cd;
    color: #856404;
}

.nanhkiet-toast.warning .nanhkiet-toast-progress-bar {
    background-color: #ffc107;
}

/* Info Toast */
.nanhkiet-toast.info {
    border-left: 4px solid #4680ff;
}

.nanhkiet-toast.info .nanhkiet-toast-icon {
    background-color: #cfe2ff;
    color: #4680ff;
}

.nanhkiet-toast.info .nanhkiet-toast-progress-bar {
    background-color: #4680ff;
}

/* Dark Mode Support */
[data-bs-theme="dark"] .nanhkiet-toast {
    background: #1e293b;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .nanhkiet-toast-title {
    color: #e2e8f0;
}

[data-bs-theme="dark"] .nanhkiet-toast-close {
    color: #94a3b8;
}

[data-bs-theme="dark"] .nanhkiet-toast-progress {
    background: rgba(255, 255, 255, 0.1);
}

/* Responsive */
@media (max-width: 576px) {
    .nanhkiet-toast-container {
        left: 10px;
        right: 10px;
        max-width: none;
    }

    .nanhkiet-toast {
        min-width: auto;
        max-width: none;
    }
}