/* ==================== HALLOWEEN CHATBOX STYLES ==================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(to bottom, #0a0e27 0%, #1a0933 50%, #2d1b3d 100%);
    color: #fff;
    min-height: 100vh;
    padding: 20px;
}

/* Test Container */
.test-container {
    text-align: center;
    padding: 40px;
}

.test-container h1 {
    font-size: 2.5rem;
    color: #ffa500;
    text-shadow: 0 0 20px rgba(255, 165, 0, 0.8);
    margin-bottom: 20px;
}

.status {
    margin-top: 20px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    display: inline-block;
}

#status-indicator {
    font-size: 1.1rem;
    font-weight: bold;
}

/* ==================== CHATBOX WIDGET ==================== */
.chatbox-widget {
    position: fixed;
    top: 0; /* Full height từ top */
    right: 0; /* Sát lề phải */
    width: 400px; /* Tăng width */
    height: 100vh; /* Full chiều cao màn hình */
    background: linear-gradient(135deg,
        rgba(20, 10, 30, 0.97) 0%,
        rgba(30, 15, 40, 0.95) 50%,
        rgba(25, 10, 35, 0.96) 100%
    );
    border-left: 3px solid transparent;
    border-image: linear-gradient(to bottom, 
        #ff6b00 0%,
        #ffa500 50%,
        #ff6b00 100%
    ) 1;
    border-radius: 0; /* Bỏ bo góc để full màn hình */
    box-shadow: 
        -8px 0 40px rgba(0, 0, 0, 0.6),
        -2px 0 20px rgba(255, 107, 0, 0.3),
        inset 2px 0 0 rgba(255, 165, 0, 0.1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 9999;
    animation: chatboxGlowPulse 4s ease-in-out infinite;
}

@keyframes chatboxGlowPulse {
    0%, 100% {
        box-shadow: 
            -8px 0 40px rgba(0, 0, 0, 0.6),
            -2px 0 20px rgba(255, 107, 0, 0.3),
            inset 2px 0 0 rgba(255, 165, 0, 0.1);
    }
    50% {
        box-shadow: 
            -8px 0 40px rgba(0, 0, 0, 0.6),
            -2px 0 30px rgba(255, 107, 0, 0.5),
            inset 2px 0 0 rgba(255, 165, 0, 0.15);
    }
}

.chatbox-widget.minimized {
    width: 350px; /* Thu nhỏ width khi minimize */
    height: auto;
    max-height: 60px;
    top: auto; /* Bỏ top */
    bottom: 20px; /* Chuyển xuống bottom */
    border-radius: 15px; /* Trở lại bo góc */
    border: 2px solid #ff6b00;
}

.chatbox-widget.minimized .chatbox-body,
.chatbox-widget.minimized .chatbox-footer {
    display: none;
}

/* Chatbox Header */
.chatbox-header {
    background: linear-gradient(135deg, #ff6b00, #ffa500);
    padding: 15px;
    border-radius: 0; /* Bỏ bo góc cho full màn hình */
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.chatbox-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
    font-size: 1.1rem;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.chatbox-title i {
    font-size: 1.3rem;
    animation: ghostFloat 2s ease-in-out infinite;
}

@keyframes ghostFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.online-count {
    font-size: 0.8rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 3px 8px;
    border-radius: 10px;
    margin-left: 5px;
}

.minimize-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.minimize-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.minimize-btn i {
    color: #fff;
    transition: transform 0.3s;
}

.chatbox-widget.minimized .minimize-btn i {
    transform: rotate(180deg);
}

/* Header Buttons Container */
.header-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Popout Button */
.popout-btn {
    display: none !important; /* Tắt popout button */
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.popout-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.popout-btn i {
    color: #fff;
    font-size: 0.85rem;
}

/* Chatbox Body */
.chatbox-body {
    flex: 1; /* Chiếm toàn bộ không gian còn lại */
    overflow-y: auto;
    padding: 15px;
    height: 100%; /* Full height */
    max-height: none; /* Bỏ giới hạn chiều cao */
}

.messages-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 8px;
    padding-bottom: 20px;
    
    /* ===== SUBTLE PATTERN BACKGROUND ===== */
    background-image: 
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 35px,
            rgba(255, 107, 0, 0.02) 35px,
            rgba(255, 107, 0, 0.02) 70px
        );
    
    /* ===== PERFORMANCE OPTIMIZATION ===== */
    contain: layout style paint;
    will-change: scroll-position;
}

/* Loading indicator for older messages */
.loading-older-messages {
    text-align: center;
    padding: 8px;
    color: #ffa500;
    font-size: 0.8rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    margin: 8px;
    animation: loadingPulse 1.5s infinite;
}

@keyframes loadingPulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

.message {
    position: relative;
    /* ===== GLASSMORPHISM EFFECT ===== */
    background: linear-gradient(135deg, 
        rgba(255, 107, 0, 0.12) 0%, 
        rgba(139, 0, 139, 0.08) 50%,
        rgba(75, 0, 130, 0.1) 100%
    );
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 165, 0, 0.35) !important;
    border-image: none !important; /* Remove any border-image */
    border-radius: 28px !important; /* VERY rounded corners */
    padding: 18px;
    padding-top: 36px; /* Space for timestamp top-right */
    padding-right: 18px;
    padding-bottom: 54px; /* Space for reactions bottom-right */
    margin: 10px 12px;
    
    /* ===== MODERN SHADOWS ===== */
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.15),
        0 1px 3px rgba(255, 107, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    
    /* ===== SMOOTH ANIMATIONS ===== */
    animation: messageSlideIn 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    
    /* ===== GPU ACCELERATION ===== */
    transform: translateZ(0);
    will-change: transform, opacity;
    transition: all 0.3s ease;
}

.message:hover {
    transform: translateY(-2px) translateZ(0);
    box-shadow: 
        0 8px 20px rgba(0, 0, 0, 0.25),
        0 2px 6px rgba(255, 107, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 0 30px rgba(255, 107, 0, 0.15);
    border-color: rgba(255, 165, 0, 0.4);
}

@keyframes messageSlideIn {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
        filter: blur(4px);
    }
    60% {
        transform: translateY(-2px) scale(1.01);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
    gap: 8px;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid transparent;
    background: linear-gradient(#1a0933, #1a0933) padding-box,
                linear-gradient(135deg, #ff6b00, #ffa500, #ff00ff) border-box;
    object-fit: cover;
    box-shadow: 
        0 2px 8px rgba(255, 107, 0, 0.3),
        0 0 15px rgba(255, 165, 0, 0.2);
    transition: all 0.3s ease;
    filter: brightness(1.1);
}

.message-avatar:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 
        0 4px 12px rgba(255, 107, 0, 0.5),
        0 0 25px rgba(255, 165, 0, 0.4);
}

.message-author {
    font-weight: 700;
    color: #ffa500;
    font-size: 0.95rem;
    flex: 1;
    width: 100%;
    text-shadow: 
        0 1px 2px rgba(0, 0, 0, 0.5),
        0 0 8px rgba(255, 165, 0, 0.3);
    transition: all 0.2s ease;
    letter-spacing: 0.3px;
}

.message:hover .message-author {
    color: #ffb84d;
    text-shadow: 
        0 1px 3px rgba(0, 0, 0, 0.6),
        0 0 12px rgba(255, 165, 0, 0.5);
}

.message-time {
    font-size: 0.75rem;
    color: rgba(255, 165, 0, 0.6);
    white-space: nowrap;
}

.message-text {
    color: #fff;
    font-size: 0.95rem;
    word-wrap: break-word;
    line-height: 1.6;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    padding: 6px 0;
    letter-spacing: 0.3px;
}

/* System Message - Enhanced */
.message.system {
    background: linear-gradient(135deg, 
        rgba(139, 0, 255, 0.15) 0%,
        rgba(75, 0, 130, 0.12) 100%
    ) !important;
    border: 2px dashed rgba(139, 0, 255, 0.4) !important;
    border-radius: 28px !important; /* Keep rounded */
    text-align: center;
    backdrop-filter: blur(8px);
    box-shadow: 
        0 2px 10px rgba(139, 0, 255, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
}

.message.system .message-text {
    color: #c77dff;
    font-style: italic;
    font-size: 0.85rem;
    text-shadow: 0 0 10px rgba(139, 0, 255, 0.5);
    font-weight: 500;
}

/* Moderator Message - EPIC VIP EFFECTS */
.message.moderator-message {
    background: linear-gradient(135deg, 
        rgba(255, 215, 0, 0.2) 0%,
        rgba(255, 165, 0, 0.15) 50%,
        rgba(255, 100, 0, 0.12) 100%
    ) !important;
    border: 3px solid #FFD700 !important;
    border-radius: 28px !important; /* MUST keep rounded */
    position: relative;
    animation: moderatorGlow 3s ease-in-out infinite !important;
    backdrop-filter: blur(12px) !important;
    overflow: visible !important;
    
    /* Gradient border using box-shadow trick */
    box-shadow: 
        0 0 0 1px #FFA500,
        0 0 20px rgba(255, 215, 0, 0.4),
        0 0 40px rgba(255, 165, 0, 0.2),
        0 4px 15px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
}

@keyframes moderatorGlow {
    0%, 100% {
        box-shadow: 
            0 0 0 1px #FFA500,
            0 0 20px rgba(255, 215, 0, 0.4),
            0 0 40px rgba(255, 165, 0, 0.2),
            0 4px 15px rgba(0, 0, 0, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.1);
    }
    50% {
        box-shadow: 
            0 0 0 1px #FFD700,
            0 0 30px rgba(255, 215, 0, 0.6),
            0 0 60px rgba(255, 165, 0, 0.3),
            0 6px 20px rgba(0, 0, 0, 0.4),
            inset 0 1px 0 rgba(255, 255, 255, 0.15);
    }
}

/* Animated crown badge */
.message.moderator-message::before {
    content: '👑';
    position: absolute;
    top: -12px;
    right: -12px;
    font-size: 1.8rem;
    animation: crownFloat 3s ease-in-out infinite;
    z-index: 10;
    filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.8));
}

@keyframes crownFloat {
    0%, 100% {
        transform: translateY(0) rotate(-5deg) scale(1);
    }
    25% {
        transform: translateY(-4px) rotate(5deg) scale(1.05);
    }
    50% {
        transform: translateY(-8px) rotate(-5deg) scale(1.1);
    }
    75% {
        transform: translateY(-4px) rotate(5deg) scale(1.05);
    }
}

/* Sparkle effect for moderator messages */
.message.moderator-message::after {
    content: '✨';
    position: absolute;
    top: -8px;
    left: -8px;
    font-size: 1.2rem;
    animation: sparkle 2s ease-in-out infinite;
    z-index: 10;
}

@keyframes sparkle {
    0%, 100% {
        opacity: 0.6;
        transform: scale(0.8) rotate(0deg);
    }
    50% {
        opacity: 1;
        transform: scale(1.2) rotate(180deg);
    }
}

/* Moderator Action Buttons */
.mod-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 8px;
    margin-bottom: 50px; /* Space for reactions below */
    padding-top: 8px;
    border-top: 1px solid rgba(255, 215, 0, 0.3);
    position: relative;
    z-index: 1; /* Below reactions */
}

.mod-btn {
    padding: 7px 14px;
    border: none;
    border-radius: 18px; /* Very rounded */
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
}

.mod-btn-delete {
    background: rgba(255, 0, 85, 0.2);
    color: #ff0055;
    border: 1px solid rgba(255, 0, 85, 0.4);
}

.mod-btn-delete:hover {
    background: rgba(255, 0, 85, 0.4);
    transform: scale(1.05);
}

.mod-btn-ban {
    background: rgba(255, 107, 0, 0.2);
    color: #ff6b00;
    border: 1px solid rgba(255, 107, 0, 0.4);
}

.mod-btn-ban:hover {
    background: rgba(255, 107, 0, 0.4);
    transform: scale(1.05);
}

.mod-btn-promote {
    background: rgba(255, 215, 0, 0.2);
    color: #FFD700;
    border: 1px solid rgba(255, 215, 0, 0.4);
}

.mod-btn-promote:hover {
    background: rgba(255, 215, 0, 0.4);
    transform: scale(1.05);
}

/* Scrollbar */
.chatbox-body::-webkit-scrollbar {
    width: 8px;
}

.chatbox-body::-webkit-scrollbar-track {
    background: linear-gradient(to bottom, 
        rgba(0, 0, 0, 0.3) 0%,
        rgba(255, 107, 0, 0.05) 50%,
        rgba(0, 0, 0, 0.3) 100%
    );
    border-radius: 10px;
    margin: 4px 0;
}

.chatbox-body::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, 
        rgba(255, 165, 0, 0.6) 0%,
        rgba(255, 107, 0, 0.7) 50%,
        rgba(255, 69, 0, 0.6) 100%
    );
    border-radius: 10px;
    border: 1px solid rgba(255, 165, 0, 0.3);
    box-shadow: 
        0 0 10px rgba(255, 107, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.chatbox-body::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, 
        rgba(255, 165, 0, 0.8) 0%,
        rgba(255, 107, 0, 0.9) 50%,
        rgba(255, 69, 0, 0.8) 100%
    );
    box-shadow: 
        0 0 15px rgba(255, 107, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.chatbox-body::-webkit-scrollbar-thumb:active {
    background: linear-gradient(180deg, 
        rgba(255, 215, 0, 0.9) 0%,
        rgba(255, 165, 0, 1) 50%,
        rgba(255, 107, 0, 0.9) 100%
    );
}

/* Chatbox Footer */
.chatbox-footer {
    padding: 15px;
    border-top: 1px solid rgba(255, 107, 0, 0.3);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#name-input,
#message-input {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 107, 0, 0.5);
    border-radius: 8px;
    padding: 10px;
    color: #fff;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.3s;
}

#name-input:focus,
#message-input:focus {
    border-color: #ffa500;
    box-shadow: 0 0 10px rgba(255, 165, 0, 0.3);
}

#name-input::placeholder,
#message-input::placeholder {
    color: rgba(255, 165, 0, 0.5);
}

.message-input-container {
    display: flex;
    gap: 10px;
}

#message-input {
    flex: 1;
}

.send-btn {
    background: linear-gradient(135deg, #ff6b00, #ffa500);
    border: none;
    border-radius: 8px;
    padding: 10px 15px;
    cursor: pointer;
    transition: all 0.3s;
    color: #fff;
    font-size: 1.1rem;
    min-width: 50px;
}

.send-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
    background: linear-gradient(135deg, #666, #888);
}

.send-btn:not(:disabled):hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(255, 107, 0, 0.5);
}

.send-btn:not(:disabled):active {
    transform: scale(0.95);
}

.send-btn i {
    pointer-events: none;
}

#message-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ==================== LOGIN SECTION ==================== */
.login-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 20px;
    background: rgba(255, 107, 0, 0.1);
    border-radius: 10px;
}

.login-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: #ffa500;
    font-size: 0.95rem;
    line-height: 1.5;
    text-align: center;
}

.login-message i {
    font-size: 2rem;
    color: #ff6b00;
}

.login-message p {
    margin: 0;
    font-weight: 500;
}

.google-login-btn {
    background: #fff;
    color: #333;
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    width: auto;
}

.google-login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    background: #f8f8f8;
}

.google-login-btn i {
    font-size: 1.2rem;
    color: #4285f4;
}

/* ==================== CHAT SECTION ==================== */
.chat-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(255, 107, 0, 0.1);
    border-radius: 8px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #ff6b00;
}

.user-name-display {
    flex: 1;
    color: #ffa500;
    font-weight: 600;
    font-size: 0.9rem;
}

.logout-btn {
    background: rgba(255, 107, 0, 0.2);
    border: 1px solid rgba(255, 107, 0, 0.5);
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    color: #ffa500;
    transition: all 0.3s;
}

.logout-btn:hover {
    background: rgba(255, 107, 0, 0.3);
    transform: scale(1.05);
}

.logout-btn i {
    font-size: 0.9rem;
}

/* Login Buttons (Small version in chatbox footer) */
.login-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.google-login-btn-small {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
    background: #fff;
    color: #333;
    border: 1px solid #ddd;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.google-login-btn-small:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.google-login-btn-small i {
    color: #4285f4;
}

/* ==================== USER INFO ==================== */
.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: rgba(255, 165, 0, 0.1);
    border-radius: 8px;
    margin-bottom: 10px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #ffa500;
}

.user-name-display {
    flex: 1;
    color: #ffa500;
    font-weight: 600;
    font-size: 0.9rem;
}

.logout-btn {
    background: rgba(255, 107, 0, 0.2);
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    color: #ffa500;
    font-size: 1rem;
    transition: all 0.3s;
}

.logout-btn:hover {
    background: rgba(255, 107, 0, 0.4);
    transform: scale(1.05);
}

/* ==================== ANONYMOUS COUNTER ==================== */
.anonymous-counter {
    text-align: center;
    font-size: 0.85rem;
    color: #ffa500;
    padding: 8px 0 0 0;
    opacity: 0.8;
}

.anonymous-counter span {
    font-weight: bold;
    color: #ff6b00;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: rgba(255, 165, 0, 0.6);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 0.95rem;
}

/* ==================== POPUP MODE - FULL CHATBOX ==================== */
/* Khi mở trong cửa sổ popup, chatbox full màn hình */

html.chatbox-popup-mode body {
    padding: 0;
    overflow: hidden;
}

/* Hide test container in popup mode */
html.chatbox-popup-mode .test-container {
    display: none !important;
}

/* Full screen chatbox in popup mode */
html.chatbox-popup-mode .chatbox-widget {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100vh !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    max-height: none !important;
}

/* Force show chatbox body and footer in popup mode (override minimized) */
html.chatbox-popup-mode .chatbox-widget .chatbox-body,
html.chatbox-popup-mode .chatbox-widget .chatbox-footer {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Force show login section in popup mode */
html.chatbox-popup-mode .login-section,
html.chatbox-popup-mode .chat-section {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Remove minimized styles in popup mode */
html.chatbox-popup-mode .chatbox-widget.minimized {
    width: 100% !important;
    height: 100vh !important;
    top: 0 !important;
    bottom: auto !important;
    max-height: none !important;
    border-radius: 0 !important;
}

/* Ensure minimized class doesn't hide content in popup */
html.chatbox-popup-mode .chatbox-widget.minimized .chatbox-body,
html.chatbox-popup-mode .chatbox-widget.minimized .chatbox-footer,
html.chatbox-popup-mode .chatbox-widget.minimized .login-section,
html.chatbox-popup-mode .chatbox-widget.minimized .chat-section {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Hide popout button in popup mode (already in popup) */
html.chatbox-popup-mode .popout-btn {
    display: none !important;
}

/* ==================== LOGIN ENCOURAGEMENT NOTIFICATION ==================== */
.login-encouragement-notification {
    position: absolute;
    top: 70px; /* Ngay dưới header (header height ~60px + spacing) */
    left: 10px;
    right: 10px;
    z-index: 10000; /* Cao hơn chatbox-widget (9999) */
    animation: slideDown 0.3s ease-out;
    transition: opacity 0.3s ease;
    pointer-events: auto; /* Cho phép click vào notification */
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.notification-content {
    background: linear-gradient(135deg, rgba(255, 165, 0, 0.95), rgba(255, 107, 0, 0.95));
    border: 2px solid #ffa500;
    border-radius: 12px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 
        0 4px 15px rgba(255, 165, 0, 0.4),
        0 0 30px rgba(255, 165, 0, 0.2);
    position: relative;
}

.notification-content i.fa-info-circle {
    font-size: 1.8rem;
    color: #fff;
    flex-shrink: 0;
}

.notification-text {
    flex: 1;
    color: #fff;
}

.notification-text strong {
    display: block;
    font-size: 1rem;
    margin-bottom: 4px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.notification-text p {
    font-size: 0.85rem;
    margin: 0;
    opacity: 0.95;
    line-height: 1.3;
}

.notification-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.2);
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.notification-close:hover {
    background: rgba(0, 0, 0, 0.4);
    transform: scale(1.1);
}

/* Responsive */
@media (max-width: 480px) {
    .chatbox-widget {
        width: calc(100vw - 20px);
        right: 10px;
        bottom: 10px;
    }
}

/* ==================== THEMED ERROR NOTIFICATION ==================== */
.themed-error-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10000;
    animation: errorSlideIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-width: 90%;
    width: 420px;
    will-change: transform, opacity;
}

@keyframes errorSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -55%) scale(0.92);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.themed-error-notification.fade-out {
    animation: errorFadeOut 0.2s ease-out forwards;
}

@keyframes errorFadeOut {
    to {
        opacity: 0;
        transform: translate(-50%, -45%) scale(0.95);
    }
}

.themed-error-content {
    background: linear-gradient(135deg, 
        rgba(139, 0, 0, 0.96) 0%,
        rgba(75, 0, 130, 0.96) 100%
    );
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 2px solid rgba(255, 69, 0, 0.7);
    border-radius: 20px;
    padding: 25px 30px;
    box-shadow: 
        0 20px 60px rgba(255, 0, 0, 0.5),
        0 0 40px rgba(255, 69, 0, 0.4),
        0 5px 15px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: flex-start;
    gap: 20px;
    position: relative;
    overflow: hidden;
    will-change: transform;
    transform: translateZ(0);
}

/* Halloween/Christmas theme glow effect */
.themed-error-content::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(
        circle,
        rgba(255, 69, 0, 0.15) 0%,
        transparent 70%
    );
    animation: errorGlow 2.5s ease-in-out infinite;
    will-change: transform, opacity;
}

@keyframes errorGlow {
    0%, 100% { 
        transform: translate(0, 0) scale(1); 
        opacity: 0.6; 
    }
    50% { 
        transform: translate(8px, 8px) scale(1.08); 
        opacity: 0.9; 
    }
}

.themed-error-icon {
    font-size: 3rem;
    flex-shrink: 0;
    animation: errorPulse 1.2s ease-in-out infinite;
    filter: drop-shadow(0 0 12px rgba(255, 69, 0, 0.9));
    will-change: transform;
}

@keyframes errorPulse {
    0%, 100% { 
        transform: scale(1) rotate(0deg); 
    }
    25% { 
        transform: scale(1.08) rotate(-3deg); 
    }
    75% { 
        transform: scale(1.08) rotate(3deg); 
    }
}

.themed-error-text {
    flex: 1;
    z-index: 1;
}

.themed-error-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 8px;
    text-shadow: 
        0 0 10px rgba(255, 69, 0, 0.8),
        0 2px 4px rgba(0, 0, 0, 0.5);
    letter-spacing: 0.5px;
    will-change: opacity;
}

.themed-error-message {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.92);
    line-height: 1.5;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
    will-change: opacity;
}

.themed-error-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    font-size: 1rem;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 2;
}

.themed-error-close:hover {
    background: rgba(255, 69, 0, 0.9);
    border-color: rgba(255, 69, 0, 1);
    transform: rotate(90deg) scale(1.15);
    box-shadow: 0 0 20px rgba(255, 69, 0, 0.7);
}

.themed-error-close:active {
    transform: rotate(90deg) scale(0.9);
    transition-duration: 0.1s;
}

/* Mobile responsive */
@media (max-width: 480px) {
    .themed-error-notification {
        width: calc(100% - 30px);
        max-width: none;
    }
    
    .themed-error-content {
        padding: 20px;
        gap: 15px;
    }
    
    .themed-error-icon {
        font-size: 2.5rem;
    }
    
    .themed-error-title {
        font-size: 1.1rem;
    }
    
    .themed-error-message {
        font-size: 0.9rem;
    }
}

/* Dark overlay for better focus */
.themed-error-notification::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: -1;
    animation: overlayFadeIn 0.2s ease-out;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

@keyframes overlayFadeIn {
    from { 
        opacity: 0;
        backdrop-filter: blur(0);
    }
    to { 
        opacity: 1;
        backdrop-filter: blur(2px);
    }
}

/* ==================== MESSAGE REACTIONS - MODERN DESIGN ==================== */
.message-reactions {
    position: absolute;
    bottom: 8px;
    right: 8px;
    display: inline-flex !important; /* Force inline-flex */
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 6px;
    align-items: center;
    justify-content: flex-end;
    z-index: 10; /* Higher than mod-actions */
    white-space: nowrap;
    pointer-events: auto; /* Ensure clickable */
    max-width: none;
    min-width: max-content;
}

.reaction-btn {
    display: inline-flex !important;
    flex-shrink: 0 !important;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 5px 10px;
    min-width: 50px;
    background: linear-gradient(135deg, 
        rgba(255, 107, 0, 0.15) 0%,
        rgba(139, 0, 139, 0.1) 100%
    );
    border: 1.5px solid rgba(255, 165, 0, 0.35);
    border-radius: 24px; /* More rounded */
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    white-space: nowrap !important;
    float: none !important;
}

.reaction-btn:hover {
    transform: translateY(-2px) scale(1.05);
    background: linear-gradient(135deg, 
        rgba(255, 107, 0, 0.25) 0%,
        rgba(139, 0, 139, 0.2) 100%
    );
    border-color: rgba(255, 165, 0, 0.5);
    box-shadow: 
        0 4px 12px rgba(255, 107, 0, 0.3),
        0 0 20px rgba(255, 165, 0, 0.2);
}

.reaction-btn:active {
    transform: translateY(0) scale(0.98);
}

.reaction-btn .emoji {
    font-size: 1.1rem;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
    transition: transform 0.2s ease;
}

.reaction-btn:hover .emoji {
    transform: scale(1.2) rotate(-5deg);
}

.reaction-btn .count {
    font-weight: 600;
    font-size: 0.8rem;
    color: #ffa500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    min-width: 16px;
    text-align: center;
}

/* Active states */
.reaction-btn.liked {
    background: linear-gradient(135deg, 
        rgba(0, 255, 127, 0.25) 0%,
        rgba(46, 213, 115, 0.15) 100%
    );
    border-color: rgba(0, 255, 127, 0.5);
    box-shadow: 0 0 15px rgba(0, 255, 127, 0.3);
    animation: likedPulse 0.5s ease;
}

.reaction-btn.disliked {
    background: linear-gradient(135deg, 
        rgba(255, 71, 87, 0.25) 0%,
        rgba(255, 0, 85, 0.15) 100%
    );
    border-color: rgba(255, 71, 87, 0.5);
    box-shadow: 0 0 15px rgba(255, 71, 87, 0.3);
    animation: dislikedPulse 0.5s ease;
}

@keyframes likedPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

@keyframes dislikedPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* ==================== MESSAGE TIMESTAMP - ELEGANT ==================== */
.message-timestamp-bottom {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 0.7rem;
    color: rgba(255, 165, 0, 0.45);
    font-style: italic;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    transition: color 0.2s ease;
    z-index: 1;
    background: rgba(0, 0, 0, 0.4);
    padding: 5px 12px;
    border-radius: 18px; /* Very rounded pill */
    backdrop-filter: blur(8px);
}

.message:hover .message-timestamp-bottom {
    color: rgba(255, 165, 0, 0.8);
    background: rgba(0, 0, 0, 0.4);
}

/* ==================== LEVEL BADGE - ENHANCED ==================== */
.level-badge {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px !important;
    background: linear-gradient(135deg, 
        var(--badge-color, #ff6b00) 0%,
        rgba(139, 0, 139, 0.8) 100%
    ) !important;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px !important; /* Full pill shape */
    font-weight: 600 !important;
    font-size: 0.75rem !important;
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    cursor: help;
}

.level-badge:hover {
    transform: scale(1.05);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        0 0 15px var(--badge-color, #ff6b00);
}

/* ==================== LOADING OLDER MESSAGES - ENHANCED ==================== */
.loading-older-messages {
    text-align: center;
    padding: 12px;
    margin: 12px 8px;
    color: #ffa500;
    font-size: 0.85rem;
    font-weight: 500;
    background: linear-gradient(135deg, 
        rgba(255, 107, 0, 0.12) 0%,
        rgba(139, 0, 139, 0.08) 100%
    );
    border: 1px dashed rgba(255, 165, 0, 0.3);
    border-radius: 16px; /* Softer corners */
    backdrop-filter: blur(8px);
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    animation: loadingPulse 1.5s ease-in-out infinite;
}

