/* ===== Chat Workspace Specific CSS ===== */
        :root {
            --user-bubble: linear-gradient(135deg, #5850ec, #7c3aed);
            --glass-border: rgba(17, 24, 39, 0.08);
            --glass-shadow: 0 4px 24px rgba(17, 24, 39, 0.06);
            --primary: #6366f1;
            --primary-hover: #4f46e5;
            --text-muted: #6b7280;
        }
        body {
            font-family: 'Inter', sans-serif;
            background-color: #ffffff;
            color: #111827;
            height: 100vh;
            overflow: hidden;
        }

        /* Hide global chat widget on chat page */
        .chat-widget {
            display: none !important;
        }

        /* Preloader */
        #preloader {
            position: fixed;
            top: 0;
            left: 0;
            width: 100vw;
            height: 100vh;
            background: #ffffff;
            z-index: 9999;
            display: flex;
            justify-content: center;
            align-items: center;
            transition: opacity 0.6s ease-out, visibility 0.6s ease-out;
        }
        .loader-content {
            text-align: center;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 1.5rem;
        }
        .glow-orbit {
            width: 80px;
            height: 80px;
            border-radius: 50%;
            border: 3px solid transparent;
            border-top-color: var(--primary);
            border-bottom-color: #a855f7;
            animation: spin 1.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
            position: relative;
            display: flex;
            justify-content: center;
            align-items: center;
        }
        .glow-orbit::before {
            content: '';
            position: absolute;
            width: 50px;
            height: 50px;
            border-radius: 50%;
            border: 3px solid transparent;
            border-left-color: #0ea5e9;
            border-right-color: #ec4899;
            animation: spin 1s linear infinite reverse;
        }
        .loader-text {
            font-size: 1.4rem;
            font-weight: 700;
            background: linear-gradient(to right, #818cf8, #c084fc, #38bdf8);
            -webkit-background-clip: text;
            background-clip: text;
            -webkit-text-fill-color: transparent;
            letter-spacing: 1px;
        }
        @keyframes spin {
            to { transform: rotate(360deg); }
        }

        /* Background blobs */
        .bg-blobs {
            position: fixed;
            top: 0;
            left: 0;
            width: 100vw;
            height: 100vh;
            z-index: -1;
            overflow: hidden;
            background: #fcfdfe;
        }
        .blob {
            position: absolute;
            border-radius: 50%;
            filter: blur(120px);
            opacity: 0.15;
            animation: float 15s infinite alternate ease-in-out;
        }
        .blob-1 { top: -10%; left: -10%; width: 45vw; height: 45vw; background: #e0e7ff; }
        .blob-2 { bottom: -10%; right: -10%; width: 40vw; height: 40vw; background: #fae8ff; }
        @keyframes float {
            0% { transform: translate(0, 0) scale(1); }
            100% { transform: translate(6%, 10%) scale(1.05); }
        }

        /* Navbar Layout */
        nav {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 70px;
            padding: 0 5%;
            z-index: 1000;
            display: flex;
            justify-content: space-between;
            align-items: center;
            background: rgba(255, 255, 255, 0.75);
            backdrop-filter: blur(16px);
            -webkit-backdrop-filter: blur(16px);
            border-bottom: 1px solid var(--glass-border);
            box-shadow: var(--glass-shadow);
        }

        /* Full Height Split-pane Wrapper */
        .workspace-wrapper {
            display: flex;
            height: calc(100vh - 70px);
            margin-top: 70px;
            position: relative;
        }

        /* Sidebar Pane styling */
        .chat-sidebar {
            width: 300px;
            height: calc(100vh - 70px);
            border-right: 1px solid var(--glass-border);
            display: flex;
            flex-direction: column;
            background: rgba(255, 255, 255, 0.45);
            backdrop-filter: blur(20px);
            -webkit-backdrop-filter: blur(20px);
            flex-shrink: 0;
            transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
            z-index: 100;
        }

        .sidebar-header {
            padding: 1.25rem 1.5rem 0.75rem;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        .sidebar-header h2 {
            font-size: 1.15rem;
            font-weight: 800;
            color: #111827;
        }

        .comm-socket-badge {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            font-size: 0.72rem;
            font-weight: 700;
            padding: 4px 10px;
            border-radius: 20px;
            transition: all 0.3s ease;
        }
        .comm-socket-badge.offline { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
        .comm-socket-badge.syncing { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }
        .comm-socket-badge.online { background: rgba(16, 185, 129, 0.1); color: #10b981; }
        
        .comm-socket-dot {
            width: 7px;
            height: 7px;
            border-radius: 50%;
            transition: all 0.3s;
        }
        .comm-socket-badge.offline .comm-socket-dot { background: #ef4444; box-shadow: 0 0 6px #ef4444; }
        .comm-socket-badge.syncing .comm-socket-dot { background: #f59e0b; box-shadow: 0 0 6px #f59e0b; animation: spin 1s linear infinite; }
        .comm-socket-badge.online .comm-socket-dot { background: #10b981; box-shadow: 0 0 8px #10b981; animation: pulse-dot 2s infinite; }

        @keyframes pulse-dot {
            0%, 100% { transform: scale(1); opacity: 1; }
            50% { transform: scale(0.85); opacity: 0.6; }
        }

        .search-box {
            padding: 0.5rem 1.5rem 1rem;
            border-bottom: 1px solid rgba(17, 24, 39, 0.04);
        }
        .search-input {
            width: 100%;
            padding: 10px 14px;
            font-size: 0.85rem;
            border: 1px solid var(--glass-border);
            border-radius: 12px;
            outline: none;
            font-family: inherit;
            background: rgba(255, 255, 255, 0.6);
            transition: all 0.3s;
        }
        .search-input:focus {
            border-color: var(--primary);
            box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
            background: #ffffff;
        }

        .contacts-list {
            flex: 1;
            overflow-y: auto;
            display: flex;
            flex-direction: column;
        }
        .contact-item {
            display: flex;
            align-items: center;
            gap: 1rem;
            padding: 1.1rem 1.5rem;
            cursor: pointer;
            border-bottom: 1px solid rgba(17, 24, 39, 0.02);
            transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        }
        .contact-item:hover {
            background: rgba(99, 102, 241, 0.04);
        }
        .contact-item.active {
            background: rgba(99, 102, 241, 0.07);
            border-left: 4px solid var(--primary);
        }
        .avatar-wrapper {
            position: relative;
            width: 44px;
            height: 44px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.35rem;
            color: #ffffff;
            font-weight: 700;
            flex-shrink: 0;
            box-shadow: 0 4px 10px rgba(17, 24, 39, 0.08);
        }
        .status-dot {
            position: absolute;
            bottom: -1px;
            right: -1px;
            width: 12px;
            height: 12px;
            border-radius: 50%;
            border: 2px solid #ffffff;
        }
        .status-dot.online { background: #10b981; }
        .status-dot.away { background: #f59e0b; }
        .status-dot.offline { background: #94a3b8; }
        
        .contact-details {
            flex: 1;
            min-width: 0;
        }
        .contact-name-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 2px;
        }
        .contact-name {
            font-size: 0.9rem;
            font-weight: 800;
            color: #111827;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .unread-count {
            background: var(--primary);
            color: #ffffff;
            font-size: 0.65rem;
            font-weight: 700;
            padding: 2px 7px;
            border-radius: 10px;
            min-width: 18px;
            text-align: center;
            box-shadow: 0 2px 6px rgba(88, 80, 236, 0.3);
        }
        .contact-desc {
            font-size: 0.76rem;
            color: var(--text-muted);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        /* Main Workspace Console styling */
        .chat-console {
            flex: 1;
            display: flex;
            flex-direction: column;
            background: #ffffff;
            height: calc(100vh - 70px);
            max-height: calc(100vh - 70px);
            overflow: hidden;
            position: relative;
            z-index: 10;
            min-width: 0;
        }

        /* Chat Header Details */
        .chat-console-header {
            height: 70px;
            min-height: 70px;
            flex-shrink: 0;
            padding: 0 2rem;
            border-bottom: 1px solid var(--glass-border);
            display: flex;
            justify-content: space-between;
            min-width: 0;
        }

        /* Chat Header Details */
        .chat-console-header {
            height: 70px;
            min-height: 70px;
            flex-shrink: 0;
            padding: 0 2rem;
            border-bottom: 1px solid var(--glass-border);
            display: flex;
            justify-content: space-between;
            align-items: center;
            background: #ffffff;
            z-index: 50;
        }
        .header-profile-wrap {
            display: flex;
            align-items: center;
            gap: 0.85rem;
        }
        .back-sidebar-btn {
            display: none;
            background: none;
            border: none;
            color: var(--text-muted);
            cursor: pointer;
            padding: 6px;
            border-radius: 50%;
            transition: background 0.2s, color 0.2s;
        }
        .back-sidebar-btn:hover {
            background: #f1f5f9;
            color: #111827;
        }
        .back-sidebar-btn svg {
            width: 22px;
            height: 22px;
        }
        .header-avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.2rem;
            color: #ffffff;
            font-weight: 700;
        }
        .header-name {
            font-size: 0.95rem;
            font-weight: 800;
            color: #111827;
            margin: 0;
        }
        .header-status {
            display: flex;
            align-items: center;
            gap: 4px;
            font-size: 0.75rem;
            font-weight: 500;
        }
        .header-status.online { color: #10b981; }
        .header-status.away { color: #f59e0b; }
        .header-status.offline { color: #94a3b8; }
        .header-status-dot {
            width: 6px;
            height: 6px;
            border-radius: 50%;
            background: currentColor;
        }

        .screen-share-action-btn {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            background: rgba(99, 102, 241, 0.08);
            color: var(--primary);
            border: 1px solid rgba(99, 102, 241, 0.2);
            padding: 7px 14px;
            border-radius: 10px;
            font-size: 0.8rem;
            font-weight: 700;
            cursor: pointer;
            transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
        }
        .screen-share-action-btn:hover {
            background: rgba(99, 102, 241, 0.16);
            transform: translateY(-1px);
        }
        .screen-share-action-btn.active {
            background: #ef4444;
            color: #ffffff;
            border-color: #ef4444;
            box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
        }

        /* Messages stream */
        .messages-container {
            flex: 1 1 0;

            flex: 1;
            min-height: 0;
            overflow-y: auto;
            overflow-x: hidden;
            padding: 2rem 2.5rem;
            display: flex;
            flex-direction: column;
            gap: 1rem;
            background: #fbfcfd;
            scroll-behavior: smooth;
            z-index: 10;
        }
        .messages-container::-webkit-scrollbar {
            width: 6px;
        }
        .messages-container::-webkit-scrollbar-track {
            background: transparent;
        }
        .messages-container::-webkit-scrollbar-thumb {
            background: rgba(99, 102, 241, 0.15);
            border-radius: 3px;
        }

        .msg-row {
            display: flex;
            align-items: flex-end;
            gap: 0.6rem;
            animation: msg-slide-up 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
        }
        @keyframes msg-slide-up {
            from { opacity: 0; transform: translateY(12px) scale(0.96); }
            to { opacity: 1; transform: translateY(0) scale(1); }
        }

        .msg-row.user { justify-content: flex-end; }
        .msg-row.peer, .msg-row.bot { justify-content: flex-start; }
        .msg-row.system { justify-content: center; }

        .msg-avatar {
            width: 32px;
            height: 32px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 0.95rem;
            color: #ffffff;
            font-weight: 700;
            flex-shrink: 0;
            box-shadow: 0 2px 6px rgba(17, 24, 39, 0.05);
        }
        .msg-row.user .msg-avatar { display: none; }

        .msg-bubble-wrap {
            display: flex;
            flex-direction: column;
            max-width: 70%;
        }
        .msg-row.user .msg-bubble-wrap { align-items: flex-end; }
        .msg-row.peer .msg-bubble-wrap, .msg-row.bot .msg-bubble-wrap { align-items: flex-start; }
        .msg-row.system .msg-bubble-wrap { align-items: center; max-width: 85%; }

        .msg-bubble {
            padding: 0.75rem 1.1rem;
            border-radius: 16px;
            font-size: 0.9rem;
            line-height: 1.55;
            word-break: break-word;
        }
        .msg-row.user .msg-bubble {
            background: linear-gradient(135deg, #5850ec, #7c3aed);
            color: #ffffff !important;
            border-bottom-right-radius: 3px;
            box-shadow: 0 4px 14px rgba(88, 80, 236, 0.3);
        }
        .msg-row.user .msg-bubble * {
            color: #ffffff !important;
        }
        .msg-row.peer .msg-bubble, .msg-row.bot .msg-bubble {
            background: #ffffff;
            color: #111827;
            border: 1px solid var(--glass-border);
            border-bottom-left-radius: 3px;
            box-shadow: 0 3px 10px rgba(17, 24, 39, 0.02);
        }
        .msg-row.system .msg-bubble {
            background: rgba(148, 163, 184, 0.1);
            color: var(--text-muted);
            font-size: 0.78rem;
            font-weight: 600;
            border-radius: 8px;
            padding: 4px 12px;
            border: 1px solid var(--glass-border);
            box-shadow: none;
        }

        .msg-meta {
            display: flex;
            align-items: center;
            gap: 4px;
            font-size: 0.68rem;
            color: var(--text-muted);
            margin-top: 3px;
            padding: 0 4px;
        }
        .msg-tick { font-weight: 800; }
        .msg-tick.sent { color: var(--text-muted); }
        .msg-tick.delivered { color: var(--text-muted); }
        .msg-tick.read { color: var(--primary); }

        /* Typing animations */
        .typing-bubble {
            display: flex;
            gap: 4px;
            align-items: center;
            padding: 10px 16px !important;
        }
        .typing-dot {
            width: 6px;
            height: 6px;
            border-radius: 50%;
            background: var(--primary);
            animation: typing-bounce 1.2s infinite ease-in-out;
        }
        .typing-dot:nth-child(2) { animation-delay: 0.2s; }
        .typing-dot:nth-child(3) { animation-delay: 0.4s; }
        @keyframes typing-bounce {
            0%, 80%, 100% { transform: translateY(0); }
            40% { transform: translateY(-5px); }
        }

        .quick-options-row {
            display: flex;
            flex-wrap: wrap;
            gap: 0.5rem;
            margin-top: 0.6rem;
        }
        .opt-btn {
            background: rgba(99, 102, 241, 0.06);
            border: 1px solid rgba(99, 102, 241, 0.16);
            color: var(--primary);
            padding: 6px 12px;
            border-radius: 10px;
            font-size: 0.78rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
            backdrop-filter: blur(10px);
        }
        .opt-btn:hover {
            background: var(--primary);
            border-color: var(--primary);
            color: #ffffff;
            transform: translateY(-1px);
            box-shadow: 0 4px 10px rgba(99, 102, 241, 0.2);
        }

        /* Screen sharing float frame */
        .screen-broadcast-preview {
            position: absolute;
            bottom: 85px;
            right: 25px;
            width: 280px;
            background: rgba(255, 255, 255, 0.88);
            border: 1px solid rgba(99, 102, 241, 0.25);
            border-radius: 20px;
            padding: 10px;
            box-shadow: 0 16px 40px -10px rgba(17, 24, 39, 0.2);
            backdrop-filter: blur(16px);
            -webkit-backdrop-filter: blur(16px);
            z-index: 100;
            animation: preview-slide-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
        }
        @keyframes preview-slide-in {
            from { opacity: 0; transform: translateY(20px) scale(0.95); }
            to { opacity: 1; transform: translateY(0) scale(1); }
        }

        .preview-header-bar {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 8px;
            font-size: 0.75rem;
            font-weight: 800;
            color: #111827;
            padding: 0 2px;
        }
        .stop-broadcast-btn {
            background: #ef4444;
            color: #ffffff;
            border: none;
            padding: 3px 8px;
            border-radius: 6px;
            font-size: 0.68rem;
            font-weight: 700;
            cursor: pointer;
            transition: background 0.2s;
        }
        .stop-broadcast-btn:hover { background: #dc2626; }
        
        .preview-video-element {
            width: 100%;
            height: 155px;
            border-radius: 12px;
            background: #000000;
            object-fit: cover;
            border: 1px solid rgba(17, 24, 39, 0.05);
        }

        /* Chat input frame */
        .chat-input-panel {
            flex-shrink: 0;
            display: block;
            padding: 1rem 1.5rem 1.25rem;
            border-top: 1px solid var(--glass-border);
            background: #ffffff;
            z-index: 20;
            position: relative;
        }
        .chat-input-flex-row {
            display: flex;
            gap: 0.6rem;
            align-items: flex-end;
            background: #f8fafc;
            border: 1.5px solid var(--glass-border);
            border-radius: 18px;
            padding: 0.5rem 0.5rem 0.5rem 1.1rem;
            transition: border-color 0.2s, box-shadow 0.2s;
        }
        .chat-input-flex-row:focus-within {
            border-color: var(--primary);
            box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
            background: #ffffff;
        }
        .console-textarea {
            flex: 1;
            padding: 0.45rem 0;
            font-size: 0.92rem;
            border: none;
            border-radius: 0;
            outline: none;
            resize: none;
            font-family: inherit;
            line-height: 1.55;
            min-height: 36px;
            max-height: 110px;
            background: transparent;
            color: #111827;
            overflow-y: auto;
        }
        .console-textarea::placeholder {
            color: #9ca3af;
            font-size: 0.88rem;
        }
        .console-send-btn {
            width: 38px;
            height: 38px;
            border-radius: 13px;
            background: var(--primary);
            border: none;
            color: #ffffff;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            box-shadow: 0 4px 12px rgba(88, 80, 236, 0.3);
            transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
            flex-shrink: 0;
            align-self: flex-end;
        }
        .console-send-btn:hover {
            background: var(--primary-hover);
            transform: translateY(-1px) scale(1.05);
            box-shadow: 0 6px 18px rgba(88, 80, 236, 0.4);
        }
        .console-send-btn:active {
            transform: scale(0.93);
        }
        .console-send-btn svg {
            width: 16px;
            height: 16px;
            transform: rotate(45deg);
        }
        .console-input-hint {
            font-size: 0.67rem;
            color: var(--text-muted);
            margin-top: 5px;
            text-align: center;
            padding: 0 0.5rem;
        }
        .console-input-hint span { color: var(--primary); font-weight: 600; }

        /* Responsive slider layouts */
        @media (max-width: 768px) {
            .nav-links .nav-link {
                display: none;
            }
            .chat-console-header {
                padding: 0 1rem;
            }
            .header-name {
                max-width: 120px;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
            }
            .screen-share-action-btn {
                padding: 6px 10px;
                font-size: 0.75rem;
            }
            .chat-sidebar {
                position: absolute;
                left: 0;
                top: 0;
                width: 100%;
                height: 100%;
                z-index: 500;
                background: #ffffff;
            }
            .chat-sidebar.collapsed {
                transform: translateX(-100%);
                pointer-events: none;
            }
            .chat-console {
                width: 100%;
            }
            .back-sidebar-btn {
                display: inline-flex !important;
            }
            .messages-container {
                padding: 1.5rem;
            }
            .chat-input-panel {
                padding: 1rem 1.5rem 1.5rem;
            }
            .screen-broadcast-preview {
                width: calc(100% - 40px);
                left: 20px;
                right: 20px;
                bottom: 80px;
            }
        }