/*
 * Zibll Live Alerts & Simulation Notifications Stylesheet
 */

/* 1. Stack Container Positioning */
#zib-live-alerts-stack {
    position: fixed;
    bottom: 25px;
    left: 25px;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none; /* Let clicks pass through empty spaces */
    width: 340px;
    max-width: calc(100vw - 50px);
}

/* 2. Alert Badge Layout */
.zib-live-alert-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 14px;
    border-radius: 12px;
    width: fit-content;
    max-width: 100%;
    pointer-events: auto; /* Allow hover/clicks on the badge itself */
    box-sizing: border-box;
    transition: margin 0.3s ease, height 0.3s ease, opacity 0.3s ease;
    overflow: hidden; /* Tránh tràn bất kỳ hiệu ứng hay thẻ tên nào ra ngoài bo góc */
}

/* ==========================================================================
   SKINS (Mẫu giao diện)
   ========================================================================== */

/* 1. Skin Glassmorphism (Kính mờ) */
.zib-live-alert-item.skin-glass {
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-left: 4px solid var(--theme-color, #f04494);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
    color: #4a5568;
}
body.dark-theme .zib-live-alert-item.skin-glass,
.dark-theme .zib-live-alert-item.skin-glass {
    background: rgba(30, 30, 36, 0.85);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

/* 2. Skin Neon Glow (Viền Neon phát sáng) */
.zib-live-alert-item.skin-neon {
    background: rgba(18, 18, 24, 0.9);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--theme-color, #f04494);
    box-shadow: 0 0 14px rgba(240, 68, 148, 0.35);
    color: #cbd5e0;
}
.zib-live-alert-item.skin-neon .zib-live-alert-user {
    color: #ffffff;
}
.zib-live-alert-item.skin-neon .zib-live-alert-action {
    color: #a0aec0;
}

/* 3. Skin Gradient Wave (Dải màu gradient) */
.zib-live-alert-item.skin-gradient {
    background: linear-gradient(135deg, var(--theme-color, #f04494) 0%, #6366f1 100%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.25);
    color: #ffffff;
}
.zib-live-alert-item.skin-gradient .zib-live-alert-user {
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}
.zib-live-alert-item.skin-gradient .zib-live-alert-action {
    color: rgba(255, 255, 255, 0.85);
}
.zib-live-alert-item.skin-gradient .zib-live-alert-post {
    color: #fef08a;
}
.zib-live-alert-item.skin-gradient .zib-live-alert-post:hover {
    color: #fef9c3;
}

/* 4. Skin Minimalist (Tối giản thanh lịch) */
.zib-live-alert-item.skin-minimal {
    background: #ffffff;
    border: none;
    border-left: 4px solid var(--theme-color, #f04494);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    color: #4a5568;
}
}

/* 5. Skin User Cover Card (Hình nền thẻ thành viên) */
.zib-live-alert-item.skin-user-card {
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
    color: #4a5568;
    background-image: linear-gradient(rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.85)), var(--cover-img);
    background-size: cover;
    background-position: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(0, 0, 0, 0.05);
}
body.dark-theme .zib-live-alert-item.skin-user-card,
.dark-theme .zib-live-alert-item.skin-user-card {
    color: #cbd5e0;
    background-image: linear-gradient(rgba(25, 25, 30, 0.88), rgba(25, 25, 30, 0.88)), var(--cover-img);
    border-color: rgba(255, 255, 255, 0.08);
}

/* --- Effect 1: Slide Left --- */
.zib-live-alert-item.effect-slide-left {
    animation: zib-slide-in-left 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.1) forwards;
}
.zib-live-alert-item.effect-slide-left.leaving {
    animation: zib-fade-out-up 0.4s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}

/* --- Effect 2: Bubble Float --- */
.zib-live-alert-item.effect-bubble-float {
    border-radius: 20px; /* Trông tròn hơn như bong bóng */
    animation: zib-bubble-in 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.2) forwards;
    box-shadow: 0 8px 24px rgba(240, 68, 148, 0.12);
}
.zib-live-alert-item.effect-bubble-float.leaving {
    animation: zib-bubble-pop 0.35s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}

/* --- Effect 3: Fade & Zoom --- */
.zib-live-alert-item.effect-fade-zoom {
    animation: zib-zoom-in 0.4s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}
.zib-live-alert-item.effect-fade-zoom.leaving {
    animation: zib-zoom-out 0.35s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}

/* --- Effect 4: Slide Right --- */
.zib-live-alert-item.effect-slide-right {
    animation: zib-slide-in-right 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.1) forwards;
}
.zib-live-alert-item.effect-slide-right.leaving {
    animation: zib-fade-out-right 0.4s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}

/* --- Effect 5: Slide Up --- */
.zib-live-alert-item.effect-slide-up {
    animation: zib-slide-in-up 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.1) forwards;
}
.zib-live-alert-item.effect-slide-up.leaving {
    animation: zib-fade-out-up 0.4s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}

/* --- Effect 6: 3D Flip In --- */
.zib-live-alert-item.effect-flip-3d {
    perspective: 1000px;
    backface-visibility: hidden;
    animation: zib-flip-in-3d 0.6s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}
.zib-live-alert-item.effect-flip-3d.leaving {
    animation: zib-flip-out-3d 0.45s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

/* --- Effect 7: Elastic Bounce --- */
.zib-live-alert-item.effect-elastic-bounce {
    animation: zib-elastic-bounce-in 0.75s cubic-bezier(0.175, 0.885, 0.32, 1.25) forwards;
}
.zib-live-alert-item.effect-elastic-bounce.leaving {
    animation: zib-elastic-bounce-out 0.4s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}

/* 3. Avatar Container & Frame Styling */
.zib-live-alert-avatar-container {
    width: 44px; /* Rộng hơn để chứa vừa các loại khung viền avatar của avatar-box */
    height: 44px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Ép size các ảnh avatar bên trong vừa vặn */
.zib-live-alert-avatar-container img.zib-live-alert-avatar,
.zib-live-alert-avatar-container img.avatar-img,
.zib-live-alert-avatar-container img.avatar {
    width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    display: block !important;
    margin: 0 auto !important;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

/* Định vị tuyệt đối các khung viền/hiệu ứng đè của plugin avatar-box */
.zib-live-alert-avatar-container .avatarbox-user-toshi,
.zib-live-alert-avatar-container .avatarbox-frame,
.zib-live-alert-avatar-container .relative.img-icon {
    position: absolute !important;
    width: 44px !important;
    height: 44px !important;
    top: 0;
    left: 0;
    pointer-events: none;
}

/* VIP Badge và Level Badge trong phần Tên */
.zib-live-alert-user-wrapper {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 4px !important;
    vertical-align: middle !important;
    margin: 0 !important;
    padding: 0 !important;
    position: relative !important;
    float: none !important;
}

.zib-live-alert-user-wrapper img,
.zib-live-alert-user-wrapper svg,
.zib-live-alert-user-wrapper i,
.zib-live-alert-user-wrapper .vip-icon,
.zib-live-alert-user-wrapper .level-badge,
.zib-live-alert-user-wrapper .auth-badge {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 15px !important;
    width: auto !important;
    float: none !important;
    position: static !important;
    margin: 0 2px !important;
    padding: 0 !important;
    vertical-align: middle !important;
    top: auto !important;
    left: auto !important;
    box-shadow: none !important;
}

.zib-live-alert-user-wrapper .zib-live-alert-user {
    display: inline-block !important;
    vertical-align: middle !important;
    font-weight: 700;
    margin: 0 !important;
    padding: 0 !important;
}

/* 4. Text Content */
.zib-live-alert-content {
    font-size: 12px;
    line-height: 1.5;
    color: #4a5568;
    display: block !important;
    vertical-align: middle;
}

.zib-live-alert-user {
    font-weight: 700;
    color: #1a202c;
}

body.dark-theme .zib-live-alert-user,
.dark-theme .zib-live-alert-user {
    color: #ffffff !important;
}

/* Tối ưu hiển thị cho Khung thẻ tên (Name Tag Frame) bên trong thông báo */
.zib-live-alert-content name.has-name-tag-frame {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: flex-start !important; /* Dồn tất cả phần tử bên trong sát nhau về bên trái */
    gap: 4px !important; /* Tạo khoảng cách nhỏ đều giữa tên và icon */
    background-repeat: no-repeat !important;
    background-size: 100% 100% !important;
    padding: 0 16px 0 10px !important; /* Tự thu hẹp padding để tránh lồi ra ngoài */
    margin: 0 4px !important;
    vertical-align: middle !important;
    height: 24px !important; /* Giảm nhẹ chiều cao để thon gọn hơn */
    line-height: 24px !important;
    width: auto !important;
    max-width: 140px !important; /* Giới hạn chiều dài thẻ tên tối đa tránh tràn */
    min-width: 80px !important;
    border-radius: 4px !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
}

/* Đè màu chữ trong thẻ tên luôn là màu sáng nổi bật */
.zib-live-alert-content name.has-name-tag-frame .zib-live-alert-user,
.zib-live-alert-content name.has-name-tag-frame .display-name,
.zib-live-alert-content name.has-name-tag-frame a {
    color: #ffffff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8) !important;
    font-size: 11px !important;
    font-weight: bold !important;
}

/* Đè vị trí và size của icon/badges bên trong thẻ tên, dẹp bỏ định vị tuyệt đối/float của theme */
.zib-live-alert-content name.has-name-tag-frame img,
.zib-live-alert-content name.has-name-tag-frame svg,
.zib-live-alert-content name.has-name-tag-frame i,
.zib-live-alert-content name.has-name-tag-frame icon,
.zib-live-alert-content name.has-name-tag-frame span,
.zib-live-alert-content name.has-name-tag-frame a,
.zib-live-alert-content name.has-name-tag-frame .vip-icon,
.zib-live-alert-content name.has-name-tag-frame .level-badge,
.zib-live-alert-content name.has-name-tag-frame .auth-badge,
.zib-live-alert-content name.has-name-tag-frame .user-auth-icon {
    height: 12px !important;
    width: auto !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    vertical-align: middle !important;
    float: none !important;
    position: static !important; /* Hủy bỏ định vị tuyệt đối */
    margin: 0 2px !important;
    padding: 0 !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    bottom: auto !important;
    box-shadow: none !important;
}

.zib-live-alert-action {
    color: #718096;
    margin: 0 3px;
}

.zib-live-alert-post {
    font-weight: 600;
    color: var(--theme-color, #f04494);
    text-decoration: none;
    transition: opacity 0.15s ease;
    display: inline-block;
    max-width: 220px; /* Giới hạn độ dài tên bài viết tránh làm phồng bong bóng */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}

.zib-live-alert-post:hover {
    opacity: 0.85;
    text-decoration: underline;
}

/* 5. Zibll Dark Theme Support - Avatar border */
body.dark-theme .zib-live-alert-avatar-container img,
.dark-theme .zib-live-alert-avatar-container img {
    border-color: rgba(255, 255, 255, 0.1) !important;
}

body.dark-theme .zib-live-alert-content,
.dark-theme .zib-live-alert-content {
    color: #cbd5e0;
}

body.dark-theme .zib-live-alert-user,
.dark-theme .zib-live-alert-user {
    color: #e2e8f0;
}

body.dark-theme .zib-live-alert-action,
.dark-theme .zib-live-alert-action {
    color: #a0aec0;
}

/* Animations */

/* 1. Slide Left Keyframes */
@keyframes zib-slide-in-left {
    0% {
        opacity: 0;
        transform: translateX(-45px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}
@keyframes zib-fade-out-up {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-25px) scale(0.9);
    }
}

/* 2. Bubble Float Keyframes */
@keyframes zib-bubble-in {
    0% {
        opacity: 0;
        transform: translateY(50px) scale(0.6);
    }
    70% {
        opacity: 1;
        transform: translateY(-6px) scale(1.05);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
@keyframes zib-bubble-pop {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    40% {
        opacity: 0.85;
        transform: scale(1.12);
    }
    100% {
        opacity: 0;
        transform: scale(0.4) translateY(-15px);
    }
}

/* 3. Fade & Zoom Keyframes */
@keyframes zib-zoom-in {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}
@keyframes zib-zoom-out {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.85) translateY(-15px);
    }
}

/* 4. Slide Right Keyframes */
@keyframes zib-slide-in-right {
    0% {
        opacity: 0;
        transform: translateX(60px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}
@keyframes zib-fade-out-right {
    0% {
        opacity: 1;
        transform: translateX(0);
    }
    100% {
        opacity: 0;
        transform: translateX(45px);
    }
}

/* 5. Slide Up Keyframes */
@keyframes zib-slide-in-up {
    0% {
        opacity: 0;
        transform: translateY(40px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 6. 3D Flip Keyframes */
@keyframes zib-flip-in-3d {
    0% {
        opacity: 0;
        transform: rotateX(-70deg);
        transform-origin: top;
    }
    100% {
        opacity: 1;
        transform: rotateX(0deg);
        transform-origin: top;
    }
}
@keyframes zib-flip-out-3d {
    0% {
        opacity: 1;
        transform: rotateX(0deg);
        transform-origin: top;
    }
    100% {
        opacity: 0;
        transform: rotateX(70deg);
        transform-origin: top;
    }
}

/* 7. Elastic Bounce Keyframes */
@keyframes zib-elastic-bounce-in {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.1);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}
@keyframes zib-elastic-bounce-out {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    30% {
        transform: scale(1.08);
    }
    100% {
        opacity: 0;
        transform: scale(0.4) translateY(-10px);
    }
}

/* 8. Mobile Responsiveness and Hiding Option */
@media (max-width: 991px) {
    body.live-alerts-hide-mobile #zib-live-alerts-stack {
        display: none !important;
    }
}
