
/* ========================================
   CORE ANIMATIONS & KEYFRAMES
   ======================================== */

/* Spinner animation for loading states */
.spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Fade in animation */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

/* Fade out animation */
.fade-out {
    animation: fadeOut 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* ========================================
   FORM VALIDATION STYLES
   ======================================== */

/* Professional Tailwind-powered validation styling */

/* Only show validation states after user interaction */
input:user-invalid,
textarea:user-invalid,
select:user-invalid {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 1px #ef4444 !important;
}

/* Removed :user-valid rules - handled by JavaScript validation */

/* Focus states for better UX */
input:focus:user-invalid,
textarea:focus:user-invalid,
select:focus:user-invalid {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

/* Removed focus:user-valid rules - handled by JavaScript validation */

/* Ensure browser validation bubble messages are visible */
input:user-invalid::-webkit-validation-bubble-text,
textarea:user-invalid::-webkit-validation-bubble-text,
select:user-invalid::-webkit-validation-bubble-text {
    color: #333 !important;
    font-weight: 500 !important;
}

input:user-invalid::-webkit-validation-bubble-message,
textarea:user-invalid::-webkit-validation-bubble-message,
select:user-invalid::-webkit-validation-bubble-message {
    color: #333 !important;
    font-weight: 500 !important;
}

/* Firefox validation message styling */
input:user-invalid::-moz-ui-invalid,
textarea:user-invalid::-moz-ui-invalid,
select:user-invalid::-moz-ui-invalid {
    box-shadow: none !important;
}

/* Ensure custom error messages are always visible */
.field-error {
    color: #dc2626 !important;
    font-weight: 500 !important;
    text-shadow: none !important;
}

/* Fallback for browsers that don't support :user-invalid/:user-valid */
@supports not (input:user-invalid) {
    .show-validation input:invalid,
    .show-validation textarea:invalid,
    .show-validation select:invalid {
        border-color: #ef4444 !important;
        box-shadow: 0 0 0 1px #ef4444 !important;
    }
    
    /* Removed .show-validation :valid rules - handled by JavaScript validation */
}

/* ========================================
   BUTTON COMPONENTS
   ======================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s ease-in-out;
    cursor: pointer;
    border: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background-color: #3b82f6;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: #2563eb;
}

.btn-secondary {
    background-color: #6b7280;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #4b5563;
}

.btn-danger {
    background-color: #dc2626;
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background-color: #b91c1c;
}

.btn-success {
    background-color: #059669;
    color: white;
}

.btn-success:hover:not(:disabled) {
    background-color: #047857;
}

/* Enhanced login button styling */
.btn-login {
    position: relative;
    overflow: hidden;
}

.btn-login:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn-login:hover:before {
    left: 100%;
}

/* ========================================
   CARD COMPONENTS
   ======================================== */

.card {
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    padding: 1.5rem;
}

.card-header {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.card-subtitle {
    color: #6b7280;
    margin-top: 0.25rem;
}

/* Enhanced form container styling */
.form-container {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* ========================================
   ALERT COMPONENTS
   ======================================== */

.alert {
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
    border: 1px solid;
    backdrop-filter: blur(10px);
    border-left: 4px solid;
    animation: slideInFromTop 0.3s ease-out;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: block;
    position: relative;
    z-index: 20;
}

.alert-success {
    background-color: #d1fae5;
    border-color: #a7f3d0;
    color: #065f46;
    border-left-color: #10b981;
    background: rgba(16, 185, 129, 0.15) !important;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.alert-error {
    background-color: #fee2e2;
    border-color: #fecaca;
    color: #991b1b;
    border-left-color: #ef4444;
    background: rgba(239, 68, 68, 0.15) !important;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.alert-warning {
    background-color: #fef3c7;
    border-color: #fde68a;
    color: #92400e;
    border-left-color: #f59e0b;
    background: rgba(245, 158, 11, 0.15) !important;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.alert-info {
    background-color: #dbeafe;
    border-color: #bfdbfe;
    color: #1e40af;
    border-left-color: #3b82f6;
    background: rgba(59, 130, 246, 0.15) !important;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

@keyframes slideInFromTop {
    from {
        transform: translateY(-10px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ========================================
   NAVIGATION COMPONENTS
   ======================================== */

.nav-link {
    color: #374151;
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    transition: all 0.15s ease-in-out;
    position: relative;
    display: inline-block;
}

.nav-link:hover {
    color: #3b82f6;
    background-color: rgba(59, 130, 246, 0.1);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.1);
}

.nav-link.active {
    color: #3b82f6;
    font-weight: 500;
    background-color: rgba(59, 130, 246, 0.05);
    border-bottom: 2px solid #3b82f6;
    position: relative;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0.5rem;
    right: 0.5rem;
    height: 2px;
    background-color: #3b82f6;
    border-radius: 1px;
}

/* Enhanced hover effect for desktop */
@media (min-width: 768px) {
    .nav-link:hover {
        background-color: rgba(59, 130, 246, 0.15);
        box-shadow: 0 4px 8px rgba(59, 130, 246, 0.15);
    }
    
    .nav-link.active:hover {
        background-color: rgba(59, 130, 246, 0.1);
    }
}

.nav-container {
    border-bottom: 1px solid #e5e7eb;
    background-color: #ffffff;
}

/* Remove conflicting underline effects */
.nav-link[data-nav="home"]:after,
.nav-link[data-nav="contact"]:after,
.nav-link[data-nav="dashboard"]:after,
.nav-link[data-nav="chat"]:after,
.nav-link[data-nav="profile"]:after {
    display: none;
}

/* Enhanced mobile navigation links */
@media (max-width: 767px) {
    .nav-link {
        padding: 0.375rem 0.75rem;
        margin: 0.0625rem 0;
        border-radius: 0.375rem;
        font-size: 0.875rem;
        line-height: 1.2;
        color: #374151;
        text-decoration: none;
        transition: all 0.15s ease-in-out;
        position: relative;
        display: block;
    }
    
    .nav-link:hover {
        color: #3b82f6;
        background-color: rgba(59, 130, 246, 0.1);
        transform: translateY(-1px);
        box-shadow: 0 2px 4px rgba(59, 130, 246, 0.1);
    }
    
    .nav-link.active {
        color: #3b82f6;
        font-weight: 500;
        background-color: rgba(59, 130, 246, 0.05);
        position: relative;
    }
    
    .nav-link.active::after {
        content: '';
        position: absolute;
        left: 0.75rem;
        right: 0.75rem;
        bottom: 0.125rem;
        height: 2px;
        background-color: #3b82f6;
        border-radius: 1px;
    }
    
    /* Ensure no double underlines */
    .nav-link.active[data-nav="dashboard"]::after,
    .nav-link.active[data-nav="chat"]::after,
    .nav-link.active[data-nav="profile"]::after {
        left: 0.75rem;
        right: 0.75rem;
    }
    
    /* Compact mobile menu container */
    #mobile-menu {
        max-height: calc(100vh - 4rem);
        overflow-y: auto;
        background: white;
        border-top: 1px solid #e5e7eb;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    }
    
    #mobile-menu .border-t {
        margin-top: 0.25rem;
        padding-top: 0.25rem;
        border-color: #e5e7eb !important;
    }
    
    /* Enhanced user section styling */
    #mobile-menu .px-2\.py-1\.5 {
        background: rgba(59, 130, 246, 0.05);
        border-radius: 0.375rem;
        margin: 0.5rem;
        border: 1px solid rgba(59, 130, 246, 0.1);
    }
    
    #mobile-menu .px-2\.py-1\.5 p:first-child {
        color: #3b82f6;
        font-weight: 600;
    }
    
    #mobile-menu .px-2\.py-1\.5 p:last-child {
        color: #6b7280;
    }
    
    /* Enhanced mobile menu buttons */
    #mobile-menu button[type="submit"] {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
        line-height: 1.2;
        color: #374151;
        background: transparent;
        border: none;
        border-radius: 0.375rem;
        transition: all 0.15s ease-in-out;
        cursor: pointer;
        width: 100%;
        text-align: left;
    }
    
    #mobile-menu button[type="submit"]:hover {
        color: #3b82f6;
        background-color: rgba(59, 130, 246, 0.1);
        transform: translateY(-1px);
        box-shadow: 0 2px 4px rgba(59, 130, 246, 0.1);
    }
    
    /* Enhanced dropdown menu items for mobile */
    #mobile-menu .dropdown-menu-item {
        padding: 0.5rem 0.75rem;
        color: #374151;
        text-decoration: none;
        border-radius: 0.375rem;
        transition: all 0.15s ease-in-out;
        display: flex;
        align-items: center;
        font-size: 0.875rem;
        line-height: 1.2;
    }
    
    #mobile-menu .dropdown-menu-item:hover {
        color: #3b82f6;
        background-color: rgba(59, 130, 246, 0.1);
        transform: translateY(-1px);
        box-shadow: 0 2px 4px rgba(59, 130, 246, 0.1);
    }
    
    #mobile-menu .dropdown-menu-item svg {
        width: 1rem;
        height: 1rem;
        margin-right: 0.75rem;
        color: #9ca3af;
        transition: color 0.15s ease-in-out;
    }
    
    #mobile-menu .dropdown-menu-item:hover svg {
        color: #3b82f6;
    }
}

/* Dropdown menu styles */
.dropdown-menu {
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease-in-out;
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Enhanced dropdown menu items */
.dropdown-menu a {
    transition: all 0.15s ease-in-out;
}

.dropdown-menu a:hover {
    transform: translateX(2px);
    background-color: rgba(59, 130, 246, 0.05);
}

.dropdown-menu button:hover {
    transform: translateX(2px);
    background-color: rgba(59, 130, 246, 0.05);
}

/* Enhanced user info header in dropdown */
.dropdown-menu .border-b {
    border-color: #f3f4f6 !important;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.05) 0%, rgba(59, 130, 246, 0.02) 100%);
    margin: 0;
    border-radius: 0.375rem 0.375rem 0 0;
}

.dropdown-menu .border-b + * {
    border-top: none;
}

/* User avatar styles */
.user-avatar {
    width: 2rem;
    height: 2rem;
    background-color: #3b82f6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.875rem;
    font-weight: 500;
}

/* ========================================
   DASHBOARD COMPONENTS
   ======================================== */

.stat-card {
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    padding: 1.25rem;
}

.stat-icon {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: white;
}

.stat-icon-blue { background-color: #3b82f6; }
.stat-icon-green { background-color: #10b981; }
.stat-icon-purple { background-color: #8b5cf6; }

.stat-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
}

/* ========================================
   WEBSOCKET STATUS - DISABLED
   ======================================== */

/* WebSocket status indicator hidden */
.ws-status {
    display: none !important;
}

.status-indicator {
    display: none !important;
}

.status-connected { display: none !important; }
.status-disconnected { display: none !important; }


/* ========================================
   UTILITY CLASSES
   ======================================== */

/* Text alignment */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

/* Spacing utilities */
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }

.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }

/* Layout utilities */
.w-full { width: 100%; }
.h-full { height: 100%; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }

.space-x-3 > :not([hidden]) ~ :not([hidden]) { margin-left: 0.75rem; }
.space-x-4 > :not([hidden]) ~ :not([hidden]) { margin-left: 1rem; }

/* Grid utilities */
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }

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

/* Mobile menu styles */
@media (max-width: 768px) {
    .mobile-menu {
        transform: translateY(-100%);
        transition: transform 0.15s ease-out; /* Faster closing animation */
    }
    
    .mobile-menu.show {
        transform: translateY(0);
        transition: transform 0.3s ease-in-out; /* Slower opening animation */
    }
    
    .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    
    /* Enhanced mobile menu scroll behavior */
    #mobile-menu {
        scrollbar-width: thin;
        scrollbar-color: rgba(59, 130, 246, 0.3) transparent;
    }
    
    #mobile-menu::-webkit-scrollbar {
        width: 3px;
    }
    
    #mobile-menu::-webkit-scrollbar-track {
        background: transparent;
    }
    
    #mobile-menu::-webkit-scrollbar-thumb {
        background: rgba(59, 130, 246, 0.3);
        border-radius: 2px;
    }
    
    #mobile-menu::-webkit-scrollbar-thumb:hover {
        background: rgba(59, 130, 246, 0.5);
    }
    
    /* Ensure menu doesn't overflow viewport */
    #mobile-menu {
        max-height: calc(100vh - 64px); /* Account for header height */
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Compact spacing for all mobile menu elements */
    #mobile-menu > div {
        padding-top: 0.25rem !important;
        padding-bottom: 0.25rem !important;
    }
    
    /* Tighter spacing for user section */
    #mobile-menu .border-t > div:first-child {
        padding-top: 0.375rem !important;
        padding-bottom: 0.375rem !important;
    }
}

@media (min-width: 1024px) {
    .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ========================================
   MODAL COMPONENTS
   ======================================== */

/* Online Users Modal */
.online-users-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1000;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 2rem 1rem;
}

.online-users-modal.show {
    display: flex;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    animation: overlayFadeIn 0.3s ease-out;
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 1rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.1);
    max-width: 480px;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    animation: modalSlideDown 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin-top: 1rem;
}

@keyframes modalSlideDown {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes overlayFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-header {
    background: linear-gradient(135deg, var(--sjzcloud-blue) 0%, var(--sjzcloud-blue-dark) 100%);
    color: white;
    padding: 1.5rem 1.5rem 1rem 1.5rem;
    border-radius: 1rem 1rem 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.modal-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M30 30c0-5.5-4.5-10-10-10s-10 4.5-10 10 4.5 10 10 10 10-4.5 10-10zm0 0c0 5.5 4.5 10 10 10s10-4.5 10-10-4.5-10-10-10-10 4.5-10 10z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    color: white;
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-title::before {
    content: '';
    width: 0.75rem;
    height: 0.75rem;
    background: #4ade80;
    border-radius: 50%;
    animation: pulse 2s infinite;
    box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7);
}

.modal-close-btn {
    width: 2.5rem;
    height: 2.5rem;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    z-index: 1;
}

.modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.modal-body {
    padding: 0;
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.online-count-info {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0;
    text-align: center;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid #e2e8f0;
    font-weight: 500;
    position: relative;
}

/* Modal Search */
.modal-search-container {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    background: #fafbfc;
}

.modal-search-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 0.75rem;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s ease;
    background: white;
}

.modal-search-input:focus {
    border-color: var(--sjzcloud-blue);
    box-shadow: 0 0 0 3px rgba(30, 144, 255, 0.1);
}

.modal-search-input::placeholder {
    color: #9ca3af;
}

.online-users-modal-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.online-users-modal-list::-webkit-scrollbar {
    width: 4px;
}

.online-users-modal-list::-webkit-scrollbar-track {
    background: transparent;
}

.online-users-modal-list::-webkit-scrollbar-thumb {
    background: var(--sjzcloud-blue);
    border-radius: 2px;
}

.online-users-modal-list::-webkit-scrollbar-thumb:hover {
    background: var(--sjzcloud-blue-dark);
}

/* Online Users Button in Header */
.users-btn {
    position: relative;
    width: auto;
    height: 2.25rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    gap: 0.25rem;
    padding: 0 0.75rem;
}

.users-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.users-btn .btn-text {
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1;
    margin-left: 0.25rem;
}

.users-btn .online-badge {
    position: absolute;
    top: -0.25rem;
    right: -0.25rem;
    background: #ef4444;
    color: white;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.125rem 0.375rem;
    border-radius: 1rem;
    min-width: 1.1rem;
    height: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    animation: badgePulse 2s infinite;
}

/* Mobile responsive for header users button */
@media (max-width: 768px) {
    .users-btn {
        padding: 0 0.5rem;
    }
    
    .users-btn .btn-text {
        display: none;
    }
    
    .users-btn .online-badge {
        top: -0.15rem;
        right: -0.15rem;
        min-width: 1rem;
        height: 1rem;
        font-size: 0.6rem;
    }
}

/* Mobile Responsive Modal */
@media (max-width: 768px) {
    .online-users-modal {
        padding: 1rem 0.5rem;
        align-items: flex-start;
    }
    
    .modal-content {
        width: 100%;
        max-width: none;
        max-height: 85vh;
        border-radius: 1rem;
        animation: modalSlideDown 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
        margin-top: 0.5rem;
    }
    
    .modal-header {
        padding: 1.25rem 1.25rem 1rem 1.25rem;
    }
    
    .modal-title {
        font-size: 1.1rem;
    }
    
    .modal-search-container {
        padding: 0.75rem 1.25rem;
    }
    
    .online-count-info {
        padding: 0.75rem 1.25rem;
        font-size: 0.8rem;
    }
    
    .online-user {
        padding: 0.875rem 1.25rem;
        gap: 0.875rem;
    }
    
    .user-avatar-small {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 0.9rem;
    }
    
    .user-name {
        font-size: 0.9rem;
    }
    
    .user-status {
        font-size: 0.75rem;
    }
    
    .no-online-users {
        padding: 2.5rem 1.5rem;
    }
    
    .no-users-icon {
        width: 3.5rem;
        height: 3.5rem;
    }
    
    .no-users-icon svg {
        width: 1.75rem;
        height: 1.75rem;
    }
    
    .no-users-text {
        font-size: 1rem;
    }
    
    .no-users-subtitle {
        font-size: 0.85rem;
        max-width: 240px;
    }
}

/* ========================================
   WHATSAPP-STYLE CHAT COMPONENTS
   ======================================== */

/* SJZCloudChat Color Scheme */
:root {
    --sjzcloud-blue: #1E90FF;
    --sjzcloud-blue-dark: #1C7ED6;
    --sjzcloud-blue-light: #B3D7FF;
    --whatsapp-blue: #34B7F1;
    --whatsapp-gray: #ECE5DD;
    --whatsapp-dark-gray: #2A2F32;
    --whatsapp-light-gray: #F7F8FA;
    --whatsapp-border: #E0E0E0;
}

/* Chat container with WhatsApp styling */
.chat-container {
    height: calc(100vh - 200px);
    display: flex;
    flex-direction: column;
    background: var(--whatsapp-light-gray);
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
    position: relative;
    margin: 1rem;
    border-radius: 1rem;
}

/* WhatsApp-style Header */
.chat-header.whatsapp-header {
    background: var(--sjzcloud-blue);
    color: white;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 10;
}

.chat-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chat-avatar {
    position: relative;
}

.avatar-circle {
    width: 2.5rem;
    height: 2.5rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    backdrop-filter: blur(10px);
}

.online-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 0.75rem;
    height: 0.75rem;
    background: #4ade80;
    border: 2px solid white;
    border-radius: 50%;
    animation: pulse-online 2s infinite;
}

@keyframes pulse-online {
    0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7); }
    70% { box-shadow: 0 0 0 6px rgba(74, 222, 128, 0); }
    100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}

.chat-info {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.chat-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    margin: 0;
    line-height: 1.2;
}

.chat-status {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
    line-height: 1.2;
}

.chat-header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-btn {
    width: 2.25rem;
    height: 2.25rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.header-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

/* Search Container */
.search-container {
    background: white;
    border-bottom: 1px solid var(--whatsapp-border);
    padding: 0.75rem;
    animation: slideDown 0.3s ease;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    width: 100%;
    padding: 0.75rem 3rem 0.75rem 1rem;
    border: 1px solid var(--whatsapp-border);
    border-radius: 1.5rem;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s ease;
}

.search-input:focus {
    border-color: var(--sjzcloud-blue);
    box-shadow: 0 0 0 2px rgba(30, 144, 255, 0.1);
}

.search-close-btn {
    position: absolute;
    right: 0.5rem;
    width: 1.5rem;
    height: 1.5rem;
    background: var(--sjzcloud-blue);
    border: none;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-close-btn:hover {
    background: var(--sjzcloud-blue-dark);
}

.search-results {
    margin-top: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* WhatsApp-style Messages Area */
.chat-messages.whatsapp-messages {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    display: flex;
    flex-direction: column;
    scroll-behavior: smooth;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23f0f2f5' fill-opacity='0.1'%3E%3Cpath d='M30 30c0-11.046-8.954-20-20-20s-20 8.954-20 20 8.954 20 20 20 20-8.954 20-20zm0 0c0 11.046 8.954 20 20 20s20-8.954 20-20-8.954-20-20-20-20 8.954-20 20z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

/* WhatsApp-style Welcome Message */
.chat-welcome.whatsapp-welcome {
    text-align: center;
    padding: 1rem 1.5rem;
    color: #6b7280;
    flex: 1;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    background: linear-gradient(135deg, var(--sjzcloud-blue) 0%, var(--sjzcloud-blue-dark) 100%);
    margin: 0.5rem;
    border-radius: 0.75rem;
    color: white;
    box-shadow: 0 4px 15px rgba(30, 144, 255, 0.2);
    min-height: 3rem;
    max-height: 3rem;
}

.welcome-content {
    text-align: left;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: none;
}

.welcome-icon {
    margin: 0;
    opacity: 0.9;
    flex-shrink: 0;
}

.welcome-icon svg {
    width: 1.5rem !important;
    height: 1.5rem !important;
}

.welcome-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    color: white;
}

.welcome-subtitle {
    font-size: 0.8rem;
    opacity: 0.9;
    margin: 0;
    line-height: 1.2;
    white-space: nowrap;
}

.welcome-features {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    opacity: 0.9;
}

.feature-icon {
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    flex-shrink: 0;
}

.feature-icon.online {
    background: #4ade80;
    animation: pulse 2s infinite;
}

.feature-icon.users {
    background: var(--whatsapp-blue);
}

.feature-icon.secure {
    background: #fbbf24;
}

/* WhatsApp-style Message Bubbles */
.message {
    display: flex;
    flex-direction: column;
    max-width: 70%;
    margin: 0.25rem 0;
    animation: messageSlideIn 0.3s ease-out;
    position: relative;
}

.message.own-message {
    align-self: flex-end;
}

.message.other-message {
    align-self: flex-start;
}

.message.system-message {
    align-self: center;
    max-width: 50%;
    margin: 0.5rem auto;
    background: transparent;
    border: none;
    box-shadow: none;
    animation: systemMessageSlideIn 0.3s ease-out;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-content {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
    max-width: 100%;
}

.own-message .message-content {
    flex-direction: row-reverse;
}

/* Message Avatar */
.message-avatar {
    width: 1.75rem;
    height: 1.75rem;
    background: var(--sjzcloud-blue);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.7rem;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* WhatsApp-style Message Body */
.message-body {
    background: white;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem 1.5rem 0.75rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--whatsapp-border);
    position: relative;
    max-width: 100%;
    word-wrap: break-word;
}

.own-message .message-body {
    background: var(--sjzcloud-blue-light);
    border-color: var(--sjzcloud-blue-light);
    border-bottom-right-radius: 0.25rem;
}

.other-message .message-body {
    border-bottom-left-radius: 0.25rem;
}

.system-message .message-body {
    background: linear-gradient(135deg, #e0f2fe 0%, #b3e5fc 100%);
    color: #0277bd;
    font-style: normal;
    font-weight: 500;
    font-size: 0.8rem;
    border: none;
    border-radius: 1.5rem;
    padding: 0.375rem 1rem;
    box-shadow: 0 2px 8px rgba(2, 119, 189, 0.15);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.system-message .message-body::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: systemMessageShimmer 2s infinite;
}

@keyframes systemMessageShimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

@keyframes systemMessageSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Message Header */
.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
    gap: 0.75rem;
}

.own-header {
    justify-content: flex-end;
}

.message-author {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--sjzcloud-blue);
    display: block;
}

.own-message .message-author {
    display: none;
}

.system-message .message-content {
    display: block;
    width: 100%;
    text-align: center;
}

.system-message .message-body {
    display: inline-block;
    max-width: 100%;
}

.system-message .message-header {
    display: none;
}

.system-message .message-text {
    margin: 0;
    color: inherit;
    font-size: inherit;
    font-weight: inherit;
    font-style: inherit;
}

/* Remove avatar and other message elements for system messages */
.system-message .message-avatar {
    display: none;
}

.system-message .inline-timestamp {
    font-size: 0.65rem;
    color: #0277bd;
    opacity: 0.8;
    margin-left: 0.5rem;
    font-weight: 400;
}

.message-time {
    font-size: 0.7rem;
    color: #9ca3af;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.own-message .message-time {
    color: #6b7280;
}

/* Message Status Icons */
.message-status {
    display: flex;
    align-items: center;
    gap: 0.125rem;
}

.status-icon {
    width: 1rem;
    height: 1rem;
    color: #9ca3af;
}

.status-icon.sent {
    color: #9ca3af;
}

.status-icon.delivered {
    color: #9ca3af;
}

.status-icon.read {
    color: var(--whatsapp-blue);
}

/* Message Text */
.message-text {
    font-size: 0.9rem;
    line-height: 1.4;
    word-wrap: break-word;
    white-space: pre-wrap;
    color: #374151;
}

.own-message .message-text {
    color: #1f2937;
}

/* WhatsApp-style Input Area */
.chat-input-container.whatsapp-input {
    background: #f0f2f5;
    border-top: 1px solid var(--whatsapp-border);
    padding: 0.75rem 1rem;
    flex-shrink: 0;
}

.chat-input-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    background: white;
    border-radius: 1.5rem;
    padding: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.emoji-btn {
    width: 2rem;
    height: 2rem;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.emoji-btn:hover {
    background: #f3f4f6;
    color: var(--sjzcloud-blue);
}

.input-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

/* WhatsApp-style Chat Input */
.chat-input.whatsapp-input {
    border: none;
    border-radius: 0;
    padding: 0.5rem 0;
    font-size: 0.95rem;
    line-height: 1.4;
    resize: none;
    min-height: 1.5rem;
    max-height: 6rem;
    overflow-y: auto;
    background: transparent;
    outline: none;
    width: 100%;
}

.chat-input.whatsapp-input::placeholder {
    color: #9ca3af;
}

.input-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 0 0.25rem;
}

.char-counter {
    font-size: 0.7rem;
    color: #9ca3af;
    font-weight: 500;
}

.char-counter.warning {
    color: #f59e0b;
}

.char-counter.error {
    color: #ef4444;
}

/* WhatsApp-style Send Button */
.send-btn.whatsapp-send-btn {
    width: 2.25rem;
    height: 2.25rem;
    background: var(--sjzcloud-blue);
    border: none;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(30, 144, 255, 0.3);
}

.send-btn.whatsapp-send-btn:hover:not(:disabled) {
    background: var(--sjzcloud-blue-dark);
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(30, 144, 255, 0.4);
}

.send-btn.whatsapp-send-btn:disabled {
    background: #d1d5db;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.send-icon {
    width: 1.1rem;
    height: 1.1rem;
    transform: rotate(0deg);
    transition: transform 0.2s ease;
}

.send-btn.whatsapp-send-btn:hover:not(:disabled) .send-icon {
    transform: rotate(10deg);
}

/* WhatsApp-style Typing Indicator */
.typing-indicator.whatsapp-typing {
    position: fixed;
    bottom: 5rem;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border-radius: 1.5rem;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 50;
    animation: typingSlideIn 0.3s ease-out;
    border: 1px solid var(--whatsapp-border);
}

.typing-avatar {
    width: 1.5rem;
    height: 1.5rem;
    background: var(--sjzcloud-blue);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.typing-avatar-circle {
    width: 0.75rem;
    height: 0.75rem;
}

.typing-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.typing-dots.whatsapp-dots {
    display: flex;
    gap: 0.25rem;
}

.typing-dots.whatsapp-dots span {
    width: 0.375rem;
    height: 0.375rem;
    background: var(--sjzcloud-blue);
    border-radius: 50%;
    animation: whatsappTyping 1.4s infinite ease-in-out;
}

.typing-dots.whatsapp-dots span:nth-child(1) {
    animation-delay: 0s;
}

.typing-dots.whatsapp-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots.whatsapp-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes whatsappTyping {
    0%, 60%, 100% {
        transform: scale(1);
        opacity: 0.5;
    }
    30% {
        transform: scale(1.2);
        opacity: 1;
    }
}



/* Connection Status with WhatsApp Styling */
.chat-connected .send-btn.whatsapp-send-btn {
    background: var(--sjzcloud-blue);
}

.chat-disconnected .send-btn.whatsapp-send-btn {
    background: #ef4444;
}

.chat-disconnected .chat-input.whatsapp-input {
    background: #fef2f2;
    border-color: #fecaca;
}

/* Custom scrollbar for WhatsApp-style */
.chat-messages.whatsapp-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages.whatsapp-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages.whatsapp-messages::-webkit-scrollbar-thumb {
    background: var(--sjzcloud-blue);
    border-radius: 3px;
}

.chat-messages.whatsapp-messages::-webkit-scrollbar-thumb:hover {
    background: var(--sjzcloud-blue-dark);
}

/* Loading state for messages */
.message.loading {
    opacity: 0.7;
    pointer-events: none;
}

.message.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 1rem;
    width: 1rem;
    height: 1rem;
    margin: -0.5rem 0 0 0;
    border: 2px solid var(--sjzcloud-blue);
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Additional WhatsApp-style enhancements */
.message:hover .message-body {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
}

.own-message:hover .message-body {
    box-shadow: 0 2px 8px rgba(30, 144, 255, 0.3);
}

/* Smooth animations for all interactive elements */
* {
    transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

/* Focus styles for accessibility */
.header-btn:focus,
.send-btn:focus,
.emoji-btn:focus,
.modal-close-btn:focus,
.toggle-users-btn:focus {
    outline: 2px solid var(--whatsapp-blue);
    outline-offset: 2px;
}

.chat-input.whatsapp-input:focus {
    outline: 2px solid var(--sjzcloud-blue);
    outline-offset: 2px;
    border-radius: 0.25rem;
}

/* Status indicators */
.status-online {
    color: #10b981;
}

.status-offline {
    color: #6b7280;
}

.status-away {
    color: #f59e0b;
}

/* Professional animations */
@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.message.other-message {
    animation: slideInFromLeft 0.3s ease-out;
}

/* Search Results Styling */
.search-no-results {
    padding: 1rem;
    text-align: center;
    color: #6b7280;
    font-style: italic;
}

.search-results-header {
    padding: 0.5rem 1rem;
    background: var(--whatsapp-light-gray);
    border-bottom: 1px solid var(--whatsapp-border);
    font-size: 0.8rem;
    font-weight: 600;
    color: #6b7280;
}

.search-result-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--whatsapp-border);
    cursor: pointer;
    transition: background-color 0.2s ease;
    background: white;
}

.search-result-item:hover {
    background: var(--sjzcloud-blue-light);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.search-result-author {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--sjzcloud-blue);
}

.search-result-time {
    font-size: 0.75rem;
    color: #9ca3af;
}

.search-result-preview {
    font-size: 0.8rem;
    color: #374151;
    line-height: 1.4;
}

/* Enhanced Message Status */
.message-status {
    display: flex;
    align-items: center;
    gap: 0.125rem;
}

.status-icon {
    width: 1rem;
    height: 1rem;
    color: #9ca3af;
}

.status-icon.sent {
    color: #9ca3af;
}

.status-icon.delivered {
    color: #9ca3af;
}

.status-icon.read {
    color: var(--whatsapp-blue);
}

/* Enhanced User Info */
.user-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.user-status {
    font-size: 0.7rem;
    font-weight: 500;
}

.user-status.status-online {
    color: #10b981;
}

.user-status.status-offline {
    color: #6b7280;
}

.user-status.status-away {
    color: #f59e0b;
}

/* Enhanced Online User Items */
.online-user {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f1f5f9;
    position: relative;
    animation: userSlideIn 0.3s ease-out;
}

.online-user:hover {
    background: linear-gradient(135deg, rgba(30, 144, 255, 0.05) 0%, rgba(30, 144, 255, 0.02) 100%);
    transform: translateX(4px);
}

.online-user:last-child {
    border-bottom: none;
}

@keyframes userSlideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.user-avatar-small {
    width: 3rem;
    height: 3rem;
    background: linear-gradient(135deg, var(--sjzcloud-blue) 0%, var(--sjzcloud-blue-dark) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(30, 144, 255, 0.3);
    position: relative;
    border: 3px solid white;
}

.user-avatar-small::before {
    content: '';
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 0.875rem;
    height: 0.875rem;
    background: #4ade80;
    border-radius: 50%;
    border: 2px solid white;
    animation: pulse-online 2s infinite;
}

.user-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.user-name {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-status {
    font-size: 0.8rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.user-status.status-online {
    color: #10b981;
}

.user-status.status-online::before {
    content: '';
    width: 0.5rem;
    height: 0.5rem;
    background: #10b981;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.user-actions {
    display: flex;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.online-user:hover .user-actions {
    opacity: 1;
}

.user-action-btn {
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 50%;
    background: rgba(30, 144, 255, 0.1);
    color: var(--sjzcloud-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.8rem;
}

.user-action-btn:hover {
    background: var(--sjzcloud-blue);
    color: white;
    transform: scale(1.1);
}

/* Enhanced Empty State */
.no-online-users {
    padding: 3rem 2rem;
    text-align: center;
    color: #6b7280;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    animation: emptyStateFadeIn 0.5s ease-out;
}

@keyframes emptyStateFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.no-users-icon {
    width: 4rem;
    height: 4rem;
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    animation: float 3s ease-in-out infinite;
}

.no-users-icon::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border: 2px dashed #cbd5e1;
    border-radius: 50%;
    animation: rotate 10s linear infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.no-users-icon svg {
    width: 2rem;
    height: 2rem;
    color: #94a3b8;
    z-index: 1;
    position: relative;
}

.no-users-text {
    font-size: 1.125rem;
    font-weight: 700;
    color: #374151;
    margin: 0;
    line-height: 1.4;
}

.no-users-subtitle {
    font-size: 0.9rem;
    color: #6b7280;
    margin: 0;
    line-height: 1.5;
    max-width: 280px;
}

.no-users-hint {
    font-size: 0.8rem;
    color: #9ca3af;
    margin: 0;
    font-style: italic;
    background: #f8fafc;
    padding: 0.5rem 1rem;
    border-radius: 1rem;
    border: 1px solid #e2e8f0;
}

.message.own-message {
    animation: slideInFromRight 0.3s ease-out;
}

/* ========================================
   ROLE BADGES
   ======================================== */

.role-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.125rem 0.375rem;
    border-radius: 0.375rem;
    border: 1px solid;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.role-badge:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Role badge colors */
.role-badge.bg-red-100 {
    background-color: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}

.role-badge.bg-purple-100 {
    background-color: #faf5ff;
    color: #7c3aed;
    border-color: #e9d5ff;
}

.role-badge.bg-blue-100 {
    background-color: #eff6ff;
    color: #1d4ed8;
    border-color: #bfdbfe;
}

.role-badge.bg-gray-100 {
    background-color: #f9fafb;
    color: #374151;
    border-color: #e5e7eb;
}

/* Message header with role badges */
.message-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
    margin-bottom: 0.25rem;
}

.message-author {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--sjzcloud-blue);
    display: block;
    flex-shrink: 0;
}

.own-message .message-author {
    display: none;
}

/* User roles display in user list */
.user-roles {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.125rem;
}

.user-roles .role-badge {
    font-size: 0.6rem;
    padding: 0.0625rem 0.25rem;
    margin: 0;
}

/* Mobile responsive for role badges */
@media (max-width: 768px) {
    .role-badge {
        font-size: 0.6rem;
        padding: 0.0625rem 0.25rem;
    }
    
    .message-header {
        gap: 0.25rem;
    }
    
    .user-roles .role-badge {
        font-size: 0.55rem;
        padding: 0.0625rem 0.1875rem;
    }
}

/* Admin broadcast messages */
.message.is-admin-broadcast .message-body {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border-color: #fca5a5;
    border: 2px solid #ef4444;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.message.is-admin-broadcast .message-author {
    color: #dc2626;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.message.is-admin-broadcast .message-text {
    color: #991b1b;
    font-weight: 600;
}

/* Admin broadcast notification animation */
@keyframes adminBroadcastPulse {
    0% { box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2); }
    50% { box-shadow: 0 4px 20px rgba(239, 68, 68, 0.4), 0 0 0 4px rgba(239, 68, 68, 0.1); }
    100% { box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2); }
}

.message.is-admin-broadcast {
    animation: adminBroadcastPulse 2s ease-in-out;
}

/* Admin broadcast button styling */
.admin-broadcast-btn {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.admin-broadcast-btn:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}