/* Toast publik — mengikuti toast Sonner versi lama (putih, ikon lingkaran) */
.toast-viewport {
    position: fixed;
    top: 16px;
    left: 16px;
    right: 16px;
    bottom: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

.toast-item {
    display: flex;
    align-items: center;
    background: #ffffff;
    color: #363636;
    line-height: 1.3;
    will-change: transform;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1), 0 3px 3px rgba(0, 0, 0, 0.05);
    max-width: 350px;
    pointer-events: auto;
    padding: 8px 10px;
    border-radius: 8px;
    animation: toast-enter 0.35s cubic-bezier(0.21, 1.02, 0.73, 1) forwards;
    font-family: inherit;
}

.toast-icon {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 20px;
    min-height: 20px;
    flex: 0 0 auto;
}

.toast-msg {
    display: flex;
    justify-content: center;
    margin: 4px 10px;
    color: inherit;
    flex: 1 1 auto;
    white-space: pre-line;
}

/* Ikon error: lingkaran merah dengan X */
.toast-icon-error {
    width: 20px;
    height: 20px;
    border-radius: 10px;
    background: #ff4b4b;
    position: relative;
    transform: rotate(45deg);
    opacity: 0;
    animation: toast-icon-pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    animation-delay: 100ms;
}
.toast-icon-error::after,
.toast-icon-error::before {
    content: "";
    position: absolute;
    border-radius: 3px;
    opacity: 0;
    background: #ffffff;
    bottom: 9px;
    left: 4px;
    height: 2px;
    width: 12px;
    animation: toast-bar-in 0.15s ease-out forwards;
    animation-delay: 150ms;
}
.toast-icon-error::before {
    animation: toast-bar-rotate 0.15s ease-out forwards;
    animation-delay: 180ms;
    transform: rotate(90deg);
}

/* Ikon sukses: lingkaran hijau dengan centang */
.toast-icon-success {
    width: 20px;
    height: 20px;
    border-radius: 10px;
    background: #61d345;
    position: relative;
    transform: rotate(45deg);
    opacity: 0;
    animation: toast-icon-pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    animation-delay: 100ms;
}
.toast-icon-success::after {
    content: "";
    box-sizing: border-box;
    position: absolute;
    border-right: 2px solid;
    border-bottom: 2px solid;
    border-color: #ffffff;
    bottom: 6px;
    left: 6px;
    height: 0;
    width: 6px;
    opacity: 0;
    animation: toast-check 0.2s ease-out forwards;
    animation-delay: 200ms;
}

/* Ikon loading: spinner */
.toast-icon-loading {
    width: 12px;
    height: 12px;
    box-sizing: border-box;
    border: 2px solid;
    border-radius: 100%;
    border-color: #e0e0e0;
    border-right-color: #616161;
    animation: toast-spin 1s linear infinite;
}

@keyframes toast-enter {
    0% { transform: translate3d(0, -200%, 0) scale(0.6); opacity: 0.5; }
    100% { transform: translate3d(0, 0, 0) scale(1); opacity: 1; }
}
@keyframes toast-leave {
    0% { transform: translate3d(0, 0, -1px) scale(1); opacity: 1; }
    100% { transform: translate3d(0, -150%, -1px) scale(0.6); opacity: 0; }
}
@keyframes toast-icon-pop {
    from { transform: scale(0) rotate(45deg); opacity: 0; }
    to { transform: scale(1) rotate(45deg); opacity: 1; }
}
@keyframes toast-bar-in {
    from { transform: scale(0); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
@keyframes toast-bar-rotate {
    from { transform: rotate(90deg) scale(0); opacity: 0; }
    to { transform: rotate(90deg) scale(1); opacity: 1; }
}
@keyframes toast-check {
    0% { height: 0; width: 0; opacity: 0; }
    40% { height: 0; width: 6px; opacity: 1; }
    100% { opacity: 1; height: 10px; }
}
@keyframes toast-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.toast-leave { animation: toast-leave 0.4s cubic-bezier(0.06, 0.71, 0.55, 1) forwards; }

[x-cloak] { display: none !important; }
