/* Container vị trí */
#toastr-container-top-right {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 9999999999999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
}

#toastr-container-top-center {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999999999999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    width: 100%;
}

#toastr-container-top-left {
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 9999999999999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
}

#toastr-container-bottom-right {
    position: fixed;
    bottom: 16px;
    right: 16px;
    z-index: 9999999999999;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    align-items: flex-end;
}

#toastr-container-bottom-center {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999999999999;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    align-items: center;
}

#toastr-container-bottom-left {
    position: fixed;
    bottom: 16px;
    left: 16px;
    z-index: 9999999999999;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    align-items: flex-start;
}

/* Toast chung */
.toastr {
    min-width: 280px;
    color: #333;
    box-shadow: 0 4px 12px rgb(0 0 0 / 0.15);
    border-radius: 2px;
    padding: 12px 10px;
    display: flex !important;
    align-items: center;
    gap: 8px;
    /* font-family: Arial, sans-serif; */
    font-size: 14px;
    cursor: default;
    opacity: 0;
    user-select: none;
    position: relative;
    background-color: #ffffff;
}

/* Thanh trượt thời gian */
.toastr .progress-bar {
    position: absolute;
    bottom: -1px;
    left: 0;
    height: 3px;
    background-color: var(--color);
    width: 100%;
    animation-timing-function: linear;
}

/* Keyframe cho animation của progress bar */
@keyframes slideOut {
    from {
        width: 100%;
    }

    to {
        width: 0%;
    }
}

.toastr .icon i {
    color: var(--color);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 100px;
    font-size: 15px;
}

.toastr span {
    font-size: 14px;
    color: rgba(0, 0, 0, 0.88);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji",
        "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
}

.toastr .content .title::first-letter {
    text-transform: uppercase;
    font-size: large;
    font-weight: bold;
}

.toastr .content .title {
    color: #fff;
    font-size: large;
    font-weight: bold;
}

.toastr .fa-xmark {
    font-size: 14px;
    color: rgba(0, 0, 0, 0.88);
}

/* Kiểu toast theo loại */
.toastr.success {
    --color: #0abf30;
}

.toastr.error {
    --color: #f24d4c;
}

.toastr.warning {
    --color: #e9bd0c;
}

.toastr.info {
    --color: #3498db;
}

/* Icon */
.toastr .icon {
    font-size: 21px;
    flex-shrink: 0;
}

/* Nội dung text */
.toastr>span:nth-child(2) {
    flex-grow: 1;
    word-break: break-word;
    line-height: 1.2;
}

/* Nút đóng */
.toastr .close-btn {
    cursor: pointer;
    color: #666;
    font-size: 18px;
    padding: 0 4px;
    transition: color 0.3s ease;
    flex-shrink: 0;
    display: none;
}

.toastr .close-btn:hover {
    color: #000;
}

/* Animation hiển thị: vị trí top (slide từ trên xuống) */
.toastr.show-top {
    animation: slideInFromTop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Animation hiển thị: vị trí bottom (slide từ dưới lên) */
.toastr.show-bottom {
    animation: slideInFromBottom 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Animation ẩn di chuyển lên */
.toastr.hide-up {
    animation: fadeUpOut 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55) forwards;
}

/* Animation ẩn di chuyển xuống */
.toastr.hide-down {
    animation: fadeDownOut 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55) forwards;
}

/* Keyframes slide in từ trên xuống */
@keyframes slideInFromTop {
    0% {
        opacity: 0;
        transform: translateY(-30px) scale(0.9);
    }

    60% {
        opacity: 1;
        transform: translateY(5px) scale(1);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Keyframes slide in từ dưới lên */
@keyframes slideInFromBottom {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(0.9);
    }

    60% {
        opacity: 1;
        transform: translateY(-5px) scale(1);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}


/* Keyframes ẩn fade + di chuyển lên */
@keyframes fadeUpOut {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    100% {
        opacity: 0;
        transform: translateY(-25px) scale(0.85);
    }
}

/* Keyframes ẩn fade + di chuyển xuống */
@keyframes fadeDownOut {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    100% {
        opacity: 0;
        transform: translateY(25px) scale(0.85);
    }
}


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

/* Tablet (màn hình nhỏ hơn 992px) */
@media (max-width: 991.98px) {

    #toastr-container-top-right,
    #toastr-container-top-left,
    #toastr-container-bottom-right,
    #toastr-container-bottom-left {
        right: 8px;
        left: 8px;
        gap: 6px;
    }

    .toastr {
        min-width: 220px;
        font-size: 14px;
        padding: 6px 10px;
    }

    .toastr .icon i {
        font-size: 16px;
    }

    .toastr span {
        font-size: 13px;
    }
}

/* Mobile (màn hình nhỏ hơn 768px) */
@media (max-width: 767.98px) {

    /* Các container full width và nằm giữa */
    #toastr-container-top-right,
    #toastr-container-top-center,
    #toastr-container-top-left,
    #toastr-container-bottom-right,
    #toastr-container-bottom-center,
    #toastr-container-bottom-left {
        left: 50%;
        transform: translateX(-50%);
        right: auto;
        width: 90%;
        max-width: 380px;
        align-items: center;
    }

    .toastr {
        /* width: 100%; */
        max-width: 100%;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
        font-size: 14px;
        padding: 8px 12px;
    }

    .toastr span {
        font-size: 13px;
        text-align: center;
    }

    .toastr .close-btn {
        font-size: 16px;
    }
}

/* Màn hình rất nhỏ (dưới 480px) */
@media (max-width: 479.98px) {
    .toastr {
        font-size: 13px;
        padding: 8px 10px;
        border-radius: 4px;
    }

    .toastr .icon i {
        font-size: 14px;
    }

    .toastr span {
        font-size: 12px;
        line-height: 1.3;
    }

    .toastr .close-btn {
        font-size: 14px;
        padding: 0 3px;
    }
}
