:root {
            --sidebar-width: 180px;
            
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
            background: #f5f7fa;
        }
		body:has(#messages.active) {
		  overflow: hidden !important;
		}
        /* Header */
        .header {
            
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            z-index: 1000;
			backdrop-filter: blur(2px);
        }

        .header-content {
            height: 100%;
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 5px 15px;
			height:55px;
        }

        .logo {
            display: flex;
            align-items: center;
            font-size: 20px;
            font-weight: 600;
            color: var(--primary-color);
        }

        .logo i {
            font-size: 28px;
            margin-right: 10px;
        }

        /* Sidebar */
        .sidebar {
            position: fixed;
            top: 55px;
            left: 0;
            bottom: 0;
            width: var(--sidebar-width);
            overflow-y: auto;
            z-index: 1099;
			
        }

        .sidebar-menu {
            padding: 20px 0 0 0;
            display: flex;
            flex-direction: column;
            min-height: calc(100vh - 55px);
        }

        .menu-section {
            margin-bottom: 30px;
        }

        .menu-title {
            padding: 0 20px;
            margin-bottom: 10px;
            font-size: 11px;
            font-weight: 600;
            text-transform: uppercase;
            color: #8492a6;
            letter-spacing: 0.5px;
        }

        .menu-item {
            display: block;
            padding: 12px 20px;
            color: #3c4858;
            text-decoration: none;
            transition: all 0.3s;
            border-left: 3px solid transparent;
        }

        .menu-item:hover {
            background: #f8f9fa;
            color: var(--primary-color);
            border-left-color: var(--warning-color);
        }

        .menu-item.active {
            background: #e7f3ff;
            color: var(--danger-color);
            -webkit-border-top-right-radius: 10px;
            -webkit-border-bottom-right-radius: 10px;
            -moz-border-radius-topright: 10px;
            -moz-border-radius-bottomright: 10px;
            border-top-right-radius: 10px;
            border-bottom-right-radius: 10px;
            border-left-color: var(--primary-color);
        }

        .dropdown-item.active {
            background-color: var(--primary-color) !important;
            color: white !important;
        }

        .menu-item i {
            width: 20px;
        }

		#adminMenu{
			position:sticky;
			bottom:0;
			margin-top: auto;
		}
        /* Main Content */
        .main-content {
            margin-left: var(--sidebar-width);
            margin-top: 55px;
            padding: 10px;
            min-height: calc(100vh - 80px);
        }

        /* Cards */
        .stat-card {
            background: white;
            border-radius: var(--bs-card-border-radius);
            padding: 5px;
            box-shadow: 0 .125rem .25rem rgba(0,0,0,.075) !important;
            margin-bottom: 15px;
            transition: transform 0.3s;
        }

        .stat-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 5px 20px rgba(0,0,0,0.12);
        }

        .stat-icon {
            width: 60px;
            height: 60px;
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 24px;
            margin-bottom: 15px;
        }

        .stat-value {
            font-size: 32px;
            font-weight: 700;
            margin-bottom: 5px;
        }

        .stat-label {
            color: #8492a6;
            font-size: 14px;
        }

        /* ==================== TABLES STYLING ==================== */

        /* DataTables Wrapper */
        .dataTables_wrapper {
            padding: 0;
        }

        .dataTables_wrapper .dataTables_length,
        .dataTables_wrapper .dataTables_filter {
            padding: 10px 15px;
        }

        .dataTables_wrapper .dataTables_length select {
            padding: 4px 20px 4px 8px;
            border: 1px solid #dee2e6;
            border-radius: 4px;
            margin: 0 5px;
            outline: none;
            transition: border-color 0.2s;
        }

        .dataTables_wrapper .dataTables_length select:focus {
            border-color: var(--primary-color);
        }

        .dataTables_wrapper .dataTables_filter input {
            padding: 6px 12px;
            border: 1px solid #dee2e6;
            border-radius: 4px;
            margin-left: 5px;
            outline: none;
            transition: border-color 0.2s;
        }

        .dataTables_wrapper .dataTables_filter input:focus {
            border-color: var(--primary-color);
        }

        /* Table Base Styles */
        .table {
            margin-bottom: 0;
            border-collapse: separate;
            border-spacing: 0;
        }

        .table thead th {
            background: #f8f9fa;
            color: #495057;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.3px;
            padding: 10px 8px;
            border-bottom: 1px solid #dee2e6;
            border-top: none;
            white-space: nowrap;
            position: relative;
        }

        .table thead th:first-child {
            border-top-left-radius: 4px;
        }

        .table thead th:last-child {
            border-top-right-radius: 4px;
        }

        /* Sorting Indicators */
        .table thead th.sorting,
        .table thead th.sorting_asc,
        .table thead th.sorting_desc {
            cursor: pointer;
            padding-right: 24px;
        }

        .table thead th.sorting:after,
        .table thead th.sorting_asc:after,
        .table thead th.sorting_desc:after {
            position: absolute;
            right: 8px;
            font-family: "bootstrap-icons";
            opacity: 0.3;
            font-size: 11px;
        }

        .table thead th.sorting:after {
            content: "\f229";
        }

        .table thead th.sorting_asc:after {
            content: "\f145";
            opacity: 1;
            color: var(--primary-color);
        }

        .table thead th.sorting_desc:after {
            content: "\f13b";
            opacity: 1;
            color: var(--primary-color);
        }

        .table thead th.sorting:hover,
        .table thead th.sorting_asc:hover,
        .table thead th.sorting_desc:hover {
            background: #e9ecef;
        }

        /* Table Body */
        .table tbody tr {
            transition: background-color 0.15s;
            border-bottom: 1px solid #f0f0f0;
        }

        .table tbody tr:hover {
            background-color: #f8f9ff;
        }

        .table tbody td {
            padding: 4px 8px;
            vertical-align: middle;
            color: #495057;
            border-top: none;
        }

        .table tbody tr:last-child td:first-child {
            border-bottom-left-radius: 4px;
        }

        .table tbody tr:last-child td:last-child {
            border-bottom-right-radius: 4px;
        }

        /* Striped Table */
        .table-striped tbody tr:nth-of-type(odd) {
            background-color: rgba(0, 0, 0, 0.015);
        }

        .table-striped tbody tr:nth-of-type(odd):hover {
            background-color: #f8f9ff;
        }

        /* Table Actions */
        .table .btn-sm {
            padding: 4px 10px;
            font-size: 13px;
            border-radius: 4px;
            transition: opacity 0.15s;
        }

        .table .btn-sm:hover {
            opacity: 0.85;
        }

        /* Badges in Table */
        .table .badge {
            padding: 4px 10px;
            font-size: 12px;
            font-weight: 500;
            border-radius: 4px;
        }

        /* DataTables Info & Pagination */
        .dataTables_wrapper .dataTables_info,
        .dataTables_wrapper .dataTables_paginate {
            padding: 10px 15px;
            color: #6c757d;
            font-size: 14px;
        }

        /* Pagination Styling */
        .dataTables_wrapper .dataTables_paginate .paginate_button {
            padding: 0;
            margin: 0 2px;
            border: 1px solid #dee2e6;
            border-radius: 4px;
            color: #495057 !important;
            background: white;
            transition: all 0.15s;
            font-size: 14px;
            cursor: pointer;
        }

        .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
            background: var(--primary-color) !important;
            color: white !important;
            border-color: var(--primary-color);
        }

        .dataTables_wrapper .dataTables_paginate .paginate_button.current {
            background: var(--primary-color) !important;
            color: white !important;
            border-color: var(--primary-color);
            font-weight: 600;
        }

        .dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }

        .dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
            background: white !important;
            color: #495057 !important;
        }

        /* DataTables Processing */
        .dataTables_wrapper .dataTables_processing {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background: white;
            padding: 15px 30px;
            border-radius: 4px;
            border: 1px solid #dee2e6;
            font-weight: 500;
            color: var(--primary-color);
            font-size: 14px;
        }

        /* Empty Table State */
        .dataTables_empty {
            padding: 30px 15px !important;
            text-align: center;
            color: #6c757d;
            font-size: 14px;
        }

        /* Responsive DataTables */
        .table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control:before,
        .table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control:before {
            background-color: var(--primary-color);
            border: 1px solid white;
        }

        /* Card containing table */
        .card:has(.table) {
            overflow: hidden;
        }

        .card .card-body:has(.table) {
            padding: 0;
        }

        /* Table Title */
        .table-title {
            font-size: 16px;
            font-weight: 600;
            margin-bottom: 0;
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 12px 15px;
            background: white;
            border-bottom: 1px solid #f0f0f0;
        }

        /* Loading Animation for Tables */
        .table-loading {
            position: relative;
        }

        .table-loading:after {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(255, 255, 255, 0.85);
        }

        /* Responsive Table Adjustments */
        @media (max-width: 768px) {
            .dataTables_wrapper .dataTables_filter input {
                width: 150px;
            }

            .table thead th {
                font-size: 11px;
                padding: 8px 6px;
            }

            .table tbody td {
                padding: 8px 6px;
                font-size: 12px;
            }

            .dataTables_wrapper .dataTables_length,
            .dataTables_wrapper .dataTables_filter {
                padding: 8px 12px;
            }

            .dataTables_wrapper .dataTables_info,
            .dataTables_wrapper .dataTables_paginate {
                padding: 8px 12px;
            }
        }

        /* Account Cards */
        .account-card {
            background: white;
            border-radius: 12px;
            padding: 20px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.08);
            margin-bottom: 20px;
            position: relative;
        }

        .account-status {
            position: absolute;
            top: 20px;
            right: 20px;
            width: 12px;
            height: 12px;
            border-radius: 50%;
        }

        .status-online { background: #10b981; }
        .status-offline { background: #ef4444; }
        .status-connecting { background: #f59e0b; animation: pulse 2s infinite; }

        @keyframes pulse {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.5; }
        }

        /* Modals */
        .modal-content {
            border-radius: 12px;
            border: none;
        }

        .modal-header {
            padding: 10px 20px;
			box-shadow: 0 .125rem .25rem rgba(0,0,0,.075) !important;
        }

        .modal-body {
            padding: 20px 20px 50px 20px;
        }

        /* QR Code */
        .qr-container {
            text-align: center;
            padding: 30px;
        }

        .qr-code {
            display: inline-block;
            padding: 20px;
            background: white;
            border-radius: 12px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        }

        /* Forms */
        .form-group {
            margin-bottom: 20px;
        }

        .form-label {
            font-weight: 500;
            margin-bottom: 8px;
            color: #3c4858;
        }

        /* Badges */
        .badge-role {
            padding: 5px 12px;
            border-radius: 20px;
            font-size: 12px;
            font-weight: 500;
        }

        .badge-admin { background: #ef4444; color: white; }
        .badge-user { background: #3b82f6; color: white; }

        
/* Loading Animation */
.spinner-border {
    width: 1rem;
    height: 1rem;
    border-width: 0.2em;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Auto Reply Table */
#autoReplyList td {
    vertical-align: middle;
}

/* Search Input */
#searchContact {
    min-width: 200px;
}

/* Modal */
.modal-content {
    border-radius: 10px;
}


/* Navbar */
.navbar {
    box-shadow: 0 2px 4px rgba(0,0,0,.1);
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 1030;
}

.navbar-brand i {
    font-size: 24px;
    margin-right: 10px;
}
.showAlert{
	top: 70px;
	z-index: 10000099!important;
}

/* Code */
code {
    padding: 2px 6px;
    background-color: #f8f9fa;
    border-radius: 3px;
    font-size: 85%;
}

/* Animations */
@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.badge.bg-success.animation {
    animation: pulse 2s infinite;
}

/* Custom Colors */
.bg-primary {
    background-color: var(--primary-color) !important;
}

.bg-success {
    background-color: var(--success-color) !important;
}

.bg-warning {
    background-color: var(--warning-color) !important;
}

.bg-danger {
    background-color: var(--danger-color) !important;
}

.bg-info {
    background-color: var(--info-color) !important;
}

/* Hover Effects */
.table-hover tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.025);
}

/* File Input */
input[type="file"] {
    cursor: pointer;
}

/* Textarea */
textarea.form-control {
    resize: vertical;
}

.btn,
.nav-link,
.badge
{
	border-radius:20px!important;
	transition: transform 0.3s;
}
.btn:hover {
	transition: transform 0.3s;
	transform: translateY(-2px);
	box-shadow: 0 2px 10px rgba(0,0,0,0.12);
}

.input-group .btn:hover,
.btn-group .btn:hover
{
	
	transform: unset!important;
}
.input-group .btn:last-child,
.btn-group .btn:last-child
{
	-webkit-border-top-left-radius: 0px!important;
	-webkit-border-bottom-left-radius: 0px!important;
	-moz-border-radius-topleft: 0px!important;
	-moz-border-radius-bottomleft: 0px!important;
	border-top-left-radius: 0px!important;
	border-bottom-left-radius: 0px!important;
}
.input-group .btn:first-child,
.btn-group .btn:first-child
{
	-webkit-border-top-right-radius: 0px!important;
	-webkit-border-bottom-right-radius: 0px!important;
	-moz-border-radius-topright: 0px!important;
	-moz-border-radius-bottomright: 0px!important;
	border-top-right-radius: 0px!important;
	border-bottom-right-radius: 0px!important;
}
.input-group .btn:not(:first-child):not(:last-child),
.btn-group .btn:not(:first-child):not(:last-child)
{
	-webkit-border-radius: 0px!important;
	-moz-border-radius: 0px!important;
	border-radius: 0px!important;
}
.rounded-0{
	border-radius:0!important;
}
/* Badge in table */
.table .badge {
    font-size: 12px;
    padding: 5px 10px;
}

/* Action buttons in table */
.table .btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}
/* Back button for mobile */
.mobile-back-btn {
    display: none;
    position: absolute;
    left: 10px;
    background: none;
    border: none;
    font-size: 24px;
    color: #333;
    cursor: pointer;
    z-index: 10;
}
#mobileActionsDropdown:after{
	display:none;
}
.chat-layout {
                    height: calc(100vh - 90px);
                    display: flex;
                    gap: 0;
                    background: #f0f2f5;
                    border-radius: 12px;
                    overflow: hidden;
                    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
                }

                /* Left Sidebar - Conversations */
                .chat-sidebar-left {
                    width: 320px;
                    background: white;
                    border-right: 1px solid #e0e0e0;
                    display: flex;
                    flex-direction: column;
                }

                .chat-account-selector {
                    padding: 15px;
                    border-bottom: 1px solid #e0e0e0;
                    background: #f8f9fa;
                }

                .conversations-header {
                    padding: 5px 15px;
                    background: white;
                    border-bottom: 1px solid #e0e0e0;
                    display: flex;
                    justify-content: space-between;
                    align-items: center;
                }

                .conversations-search {
                    padding: 10px 15px;
                    border-bottom: 1px solid #f0f0f0;
                }

                .conversations-search input {
                    width: 100%;
                    padding: 8px 12px;
                    border: 1px solid #e0e0e0;
                    border-radius: 20px;
                    outline: none;
                }

                .conversations-list {
                    flex: 1;
                    overflow-y: auto;
                }

                .conversation-item {
                    padding: 6px 15px;
                    border-bottom: 1px solid #f0f0f0;
                    cursor: pointer;
                    transition: background 0.2s;
                    display: flex;
                    align-items: center;
                    gap: 12px;
                }

                .conversation-item:hover {
                    background: #f5f5f5;
                }

                .conversation-item.active {
                    background: #e3f2fd;
                }

                .conversation-avatar {
                    width: 48px;
                    height: 48px;
                    border-radius: 50%;
                    background: linear-gradient(135deg, #FF791D 0%, #ED542C 100%);
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    color: white;
                    font-weight: bold;
                    font-size: 18px;
                    flex-shrink: 0;
					box-shadow: 0 .5rem 1rem rgba(0,0,0,.15) !important;
					-webkit-mask-image: -webkit-radial-gradient(#FF791D, #ED542C);
					mask-image: radial-gradient(#FF791D, #ED542C);
                }

                .conversation-info {
                    flex: 1;
                    min-width: 0;
                }

                .conversation-name {
                    font-weight: 600;
                    color: #333;
                    margin-bottom: 2px;
                    overflow: hidden;
                    text-overflow: ellipsis;
                    white-space: nowrap;
                }

                .conversation-last-msg {
                    font-size: 13px;
                    color: #65676b;
                    overflow: hidden;
                    text-overflow: ellipsis;
                    white-space: nowrap;
                }

                .conversation-meta {
                    display: flex;
                    flex-direction: column;
                    align-items: flex-end;
                    gap: 4px;
                }

                .conversation-time {
                    font-size: 12px;
                    color: #999;
                }

                .conversation-unread {
                    background: #0084ff;
                    color: white;
                    border-radius: 10px;
                    padding: 2px 6px;
                    font-size: 11px;
                    font-weight: 600;
                    min-width: 18px;
                    text-align: center;
                }

                /* Center - Chat Area */
                .chat-main {
                    flex: 1;
                    background: white;
                    display: flex;
                    flex-direction: column;
                }

                .chat-header {
                    height: 60px;
                    padding: 0 20px;
                    background: white;
                    border-bottom: 1px solid #e0e0e0;
                    display: flex;
                    align-items: center;
                    justify-content: space-between;
                }

                .chat-header-info {
                    display: flex;
                    align-items: center;
                    gap: 12px;
                }

                .chat-header-avatar {
                    width: 40px;
                    height: 40px;
                    border-radius: 50%;
                    background: linear-gradient(135deg, #FF791D 0%, #ED542C 100%);
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    color: white;
                    font-weight: bold;
                }

                .chat-header-details h4 {
                    margin: 0;
                    font-size: 16px;
                    font-weight: 600;
                }

                .chat-header-status {
                    font-size: 13px;
                    color: #65676b;
                }

                .chat-header-actions {
                    display: flex;
                    gap: 2px;
                }

                .chat-header-btn {
                    width: 36px;
                    height: 36px;
                    border-radius: 50%;
                    border: none;
                    background: #f0f2f5;
                    color: #65676b;
                    cursor: pointer;
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    transition: background 0.2s;
                }

                .chat-header-btn:hover {
                    background: #e0e2e5;
                }

                /* Hide mobile dropdown on desktop */
                .show-mobile-inline {
                    display: none;
                }

                .chat-messages {
                    flex: 1;
                    overflow-y: auto;
                    padding: 20px;
                    background: #f0f2f5;
                }

                .message-date-divider {
                    text-align: center;
                    margin: 20px 0;
                    position: relative;
                }

                .message-date-divider span {
                    background: #f0f2f5;
                    padding: 0 12px;
                    color: #65676b;
                    font-size: 12px;
                    position: relative;
                    z-index: 1;
                }

                .message-date-divider::before {
                    content: '';
                    position: absolute;
                    top: 50%;
                    left: 0;
                    right: 0;
                    height: 1px;
                    background: #d0d0d0;
                }

                .message-wrapper {
                    display: flex;
                    margin-bottom: 15px;
                    align-items: flex-start;
                    gap: 8px;
                }

                .message-wrapper.message-sent {
                    justify-content: flex-end;
                }
				
                .message-avatar {
                    width: 32px;
                    height: 32px;
                    border-radius: 50%;
                    background: #e0e0e0;
                    flex-shrink: 0;
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    font-size: 14px;
                    font-weight: 500;
                    color: #666;
                }

                .message-wrapper.message-sent .message-avatar {
                    display: none;
                }

                /* Hide avatar for personal threads (2 people chatting) */
                .chat-messages[data-thread-type="personal"] .message-wrapper.message-received .message-avatar {
                    display: none;
                }

                .message-content {
                    max-width: 70%;
                    display: flex;
                    flex-direction: column;
                    gap: 2px;
                }

                .message-sender {
                    font-size: 12px;
                    color: #666;
                    margin-bottom: 2px;
                    padding: 0 8px;
                }

                .message-bubble {
                    padding: 8px 12px;
                    border-radius: 18px;
                    word-wrap: break-word;
                    line-height: 1.4;
					max-width:450px;
					min-width:200px;
					text-wrap: wrap;
                }
				.message-bubble img{
					max-width:100%!important;
				}
				.message-bubble .local-sender-badge{
					display:none;
				}
				.message-time .badge{
					font-weight:normal;
					background-color:#fff!important;					
				}
                .message-wrapper.message-received {
                    justify-content: flex-start;
                }

                .message-wrapper.message-received .message-bubble {
                    background: white;
                    color: #333;
                    border: 1px solid #e0e0e0;
                }

                .message-wrapper.message-sent .message-bubble {
                    background: #fffffb;
                    color: var(--primary);
					box-shadow: 0 1px 3px rgba(0,0,0,0.1);
                }
				
                .message-time {
                    font-size: 11px;
                    color: #999;
                    margin-top: 2px;
                    padding: 0 8px;
                }

                .message-wrapper.message-sent .message-time {
                    text-align: right;
                }

                .message-date-separator {
                    text-align: center;
                    margin: 20px 0;
                    position: relative;
                }

                .message-date-separator span {
                    background: #f8f9fa;
                    padding: 5px 15px;
                    border-radius: 12px;
                    font-size: 12px;
                    color: #666;
                    display: inline-block;
                }
                
                /* Quote/Reply styles */
                .message-bubble {
                    position: relative;
                }
                
                .reply-button {
                    position: absolute;
                    top: -10px;
                    right: 20px;
                    background: rgba(0,0,0,0.1);
                    border: none;
                    color: #666;
                    padding: 2px 10px;
                    border-radius: 20px;
                    font-size: 12px;
                    cursor: pointer;
                    opacity: 0;
                    transition: opacity 0.2s;
                }
                
                
                
                .message-wrapper:hover .reply-button {
                    opacity: 1;
                }
                
                .message-wrapper.message-sent .reply-button {
                    background: rgba(0,0,0,0.3);
                    color: #fff;
					right: calc(100% - 50px);
                }
                
                .reply-button:hover {
                    background: rgba(0,0,0,0.2);
                }

                .message-wrapper.message-sent .reply-button:hover {
                    background: rgba(0,0,0,0.5);
                }

                /* Add Task Button - same style as reply button */
                .add-task-button {
                    position: absolute;
                    top: -10px;
                    right: -22px;  /* Position to the left of reply button */
                    background: rgba(0, 123, 255, 0.2);  /* Blue tint */
                    border: none;
                    color: #007bff;
                    padding: 2px 10px;
                    border-radius: 20px;
                    font-size: 12px;
                    cursor: pointer;
                    opacity: 0;
                    transition: opacity 0.2s;
                }

                .message-wrapper:hover .add-task-button {
                    opacity: 1;
                }

                .message-wrapper.message-sent .add-task-button {
                    background: rgba(0, 123, 255, 0.3);
                    color: #fff;
                    right: calc(100% - 10px);
                    
                }

                .add-task-button:hover {
                    background: rgba(0, 123, 255, 0.4);
                }

                .message-wrapper.message-sent .add-task-button:hover {
                    background: rgba(0, 123, 255, 0.6);
                }

                .delete-button {
                    position: absolute;
                    top: -10px;
                    right: -20px;
                    background: rgba(220, 53, 69, 0.8);
                    border: none;
                    color: #fff;
                    padding: 2px 10px;
                    border-radius: 20px;
                    font-size: 12px;
                    cursor: pointer;
                    opacity: 0;
                    transition: opacity 0.2s;
                    
                }
				.message-wrapper.message-sent .delete-button{
					right: calc(100% - 85px);  /* Adjusted for add-task button */
				}
                .message-wrapper:hover .delete-button {
                    opacity: 1;
                }
                .delete-button:hover {
                    background: rgba(220, 53, 69, 1);
                }
				.reactions-button{
                    position: absolute;
                    top: -10px;					
					left:100%;                    
                    border: none;
                    color: #666;
                    padding: 2px 10px;
                    border-radius: 20px;
                    font-size: 12px;
                    cursor: pointer;
                    transition: opacity 0.2s;
                }
				.message-wrapper:hover .reactions-button {
                    background: #fff;
					cursor: pointer;
                }
				.message-wrapper.message-sent .reactions-button{
					left:auto;
					right: 100%;
				}

				/* Reaction picker styles */
				.reactions-container {
					position: absolute;
					top: 100%;
					left: 100%;
				}

				.reaction-picker {
					display: none;
					position: absolute;
					bottom: 10px;
					left: 50%;
					transform: translateX(-50%);
					background: white;
					border-radius: 24px;
					padding: 4px;
					box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
					white-space: nowrap;
					z-index: 1000;
				}

				/* Add invisible bridge between button and picker */
				.reaction-picker::before {
					content: '';
					position: absolute;
					top: 100%;
					left: 0;
					right: 0;
					height: 8px;
					background: transparent;
				}

				.reactions-container:hover:has(.reactions-button:hover) .reaction-picker,
				.reaction-picker:hover {
					display: flex;
					gap: 2px;
					animation: reactionPickerShow 0.2s ease;
				}

				@keyframes reactionPickerShow {
					from {
						opacity: 0;
						transform: translateX(-50%) translateY(5px);
					}
					to {
						opacity: 1;
						transform: translateX(-50%) translateY(0);
					}
				}

				.reaction-option {
					font-size: 18px;
					cursor: pointer;
					padding: 4px 6px;
					border-radius: 50%;
					transition: transform 0.2s;
					display: inline-block;
				}

				.reaction-option:hover {
					transform: scale(1.3);
					background: rgba(0, 0, 0, 0.05);
				}

				/* For sent messages */
				.message-wrapper.message-sent .reactions-container {
					left: auto;
					right: 100%;
				}

                /* Message reactions */
                .message-reactions {
                    display: flex;
                    gap: 1px;
                    position: absolute;
                    margin-top: -10px;
                    margin-left: calc(100% - 50px);                   
                }

                .message-wrapper.message-sent .message-reactions {
                    justify-content: flex-end;
                    margin-left: 5px; 
                }

                .message-reaction {
                    display: inline-flex;
                    align-items: center;
                    gap: 1px;
                    padding: 2px;
                    font-size: 14px;
                    cursor: pointer;
                    transition: all 0.2s;
					border-radius: 20px;
					border: 1px solid #cccccc50;
					background:#fff;
                }

                .message-reaction:hover {
                    background: rgba(0, 0, 0, 0.08);
                    transform: scale(1.05);
                }

                .reaction-emoji {
                    font-size: 16px;
                    line-height: 1;
                }

                .reaction-count {
                    font-size: 12px;
                    color: #666;
                    font-weight: 500;
                }

                .quote-preview {
                    background: #f0f2f5;
                    border-left: 3px solid var(--primary);
                    padding: 5px 10px;
                    margin-bottom: 10px;
                    border-radius: 5px;
                    display: block;
                }
                
                .quote-content {
                    position: relative;
                }
                
                .quote-header {
                    display: flex;
                    justify-content: space-between;
                    align-items: center;
                }
                
                .quote-sender {
                    font-weight: 600;
                    color: var(--primary);
                    font-size: 13px;
                }
                
                .quote-body {
                    color: #666;
                    font-size: 14px;
                    overflow: hidden;
                    text-overflow: ellipsis;
                }
                
                .quote-cancel {
                    background: none;
                    border: none;
                    color: #999;
                    cursor: pointer;
                    padding: 0;
                    font-size: 18px;
                    line-height: 1;
                }
                
                .quote-cancel:hover {
                    color: #666;
                }
                
                /* Quoted message in chat */
                .message-quote {
                    background: rgba(0,0,0,0.05);
                    border-left: 2px solid var(--primary);
                    padding: 5px 8px;
                    margin-bottom: 5px;
                    border-radius: 4px;
                    font-size: 13px;
                    transition: background 0.2s;
                }

                .message-quote:hover {
                    background: rgba(0,0,0,0.08);
                }

                /* Highlight effect when scrolling to quoted message */
                .message-highlight {
                    animation: highlight-pulse 2s ease-in-out;
                }

                @keyframes highlight-pulse {
                    0%, 100% {
                        background-color: transparent;
                    }
                    50% {
                        background-color: rgba(23, 71, 133, 0.2);
                    }
                }

                .message-quote-sender {
                    font-weight: 600;
                    color: var(--primary);
                    font-size: 12px;
                    margin-bottom: 2px;
                }
                
                .message-quote-text {
                    color: #666;
                }
                
                .message-wrapper.message-sent .message-quote {
                    background: rgba(255,255,255,1);
                    border-left-color: var(--primary);
					text-align:left!important;
                }
                
                .message-wrapper.message-sent .message-quote-sender {
                    color:var(--primary);
                }
                
                .message-wrapper.message-sent .message-quote-text {
                    color: var(--primary);
                }

                .chat-input-area {
                    padding: 5px 15px;
                    background: white;
                    border-top: 1px solid #e0e0e0;
                    position: relative;
                    z-index: 100;
                }

                /* Mobile keyboard support - FIXED position for all mobile */
                @media (max-width: 768px) {
                    .chat-input-area {
                        position: fixed !important;
                        bottom: 0 !important;
                        left: 0;
                        right: 0;
                        width: 100%;
                        z-index: 1000;
                        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
						box-sizing: border-box;
						transition: bottom 0.2s ease-out;
                    }

                    /* Add padding to chat container to prevent last message being hidden */
                    .chat-container {
                        padding-bottom: 80px !important;
                    }

                    .chat-messages {
                        padding-bottom: 20px;
                    }
                }

                .chat-input-wrapper {
                    display: flex;
                    gap: 10px;
                    align-items: center;
                }

                .chat-input-actions {
                    display: flex;
                    gap: 5px;
                }

                .chat-input-btn {
                    width: 36px;
                    height: 36px;
                    border-radius: 50%;
                    border: none;
                    background: transparent;
                    color: #0084ff;
                    cursor: pointer;
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    transition: background 0.2s;
                }

                .chat-input-btn:hover {
                    background: #f0f2f5;
                }

                .chat-input-field {
                    flex: 1;
                    padding: 8px 15px;
                    border: 1px solid #e0e0e0;
                    border-radius: 20px;
                    outline: none;
                    font-size: 14px;
                }

                .chat-send-btn {
                    width: 36px;
                    height: 36px;
                    border-radius: 50%;
                    border: none;
                    background: #0084ff;
                    color: white;
                    cursor: pointer;
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    transition: opacity 0.2s;
                }

                .chat-send-btn:hover {
                    opacity: 0.9;
                }

                /* Right Sidebar - Info */
                .chat-sidebar-right {
                    width: 280px;
                    background: white;
                    border-left: 1px solid #e0e0e0;
                    overflow-y: auto;
                }

                @media (min-width: 1200px) {
                    .chat-area-wrapper.with-info .chat-area {
                        margin-right: 280px;
                    }
                }

                .chat-info-section {
                    padding: 20px;
                    border-bottom: 1px solid #f0f0f0;
                }

                .chat-info-header {
                    text-align: center;
                    padding-bottom: 15px;
                }

                .chat-info-avatar {
                    width: 80px;
                    height: 80px;
                    border-radius: 50%;
                    background: linear-gradient(135deg, #FF791D 0%, #ED542C 100%);
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    color: white;
                    font-size: 32px;
                    font-weight: bold;
                    margin: 0 auto 10px;
					-webkit-mask-image: -webkit-radial-gradient(white, black);
					mask-image: radial-gradient(white, black);
                }

                .chat-info-name {
                    font-size: 18px;
                    font-weight: 600;
                    margin-bottom: 5px;
                }

                .chat-info-status {
                    color: #65676b;
                    font-size: 14px;
                }

                .chat-info-item {
                    display: flex;
                    align-items: center;
                    gap: 12px;
                    padding: 10px 0;
                    cursor: pointer;
                    transition: background 0.2s;
                    border-radius: 8px;
                    padding: 10px;
                }

                .chat-info-item:hover {
                    background: #f5f5f5;
                }

                .chat-info-icon {
                    width: 36px;
                    height: 36px;
                    border-radius: 50%;
                    background: #f0f2f5;
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    color: #65676b;
                }

                .chat-info-text {
                    flex: 1;
                }

                .chat-info-label {
                    font-size: 14px;
                    font-weight: 500;
                    color: #333;
                }

                .chat-info-value {
                    font-size: 12px;
                    color: #65676b;
                }

                /* Empty State */
                .chat-empty-state {
                    flex: 1;
                    display: flex;
                    flex-direction: column;
                    align-items: center;
                    justify-content: center;
                    color: #65676b;
                    padding: 40px;
                    text-align: center;
                }

                .chat-empty-icon {
                    font-size: 64px;
                    color: #d0d0d0;
                    margin-bottom: 20px;
                }

                .chat-empty-title {
                    font-size: 20px;
                    font-weight: 600;
                    margin-bottom: 10px;
                    color: #333;
                }

                .chat-empty-desc {
                    font-size: 14px;
                    color: #65676b;
                }
				#defenderOutput pre{
					text-wrap: wrap;
				}

                /* Tasks Panel Styles */
                .tasks-panel {
                    background: #fff;
                    border-bottom: 1px solid #e0e0e0;
                    max-height: 300px;
                    display: flex;
                    flex-direction: column;
                }

                .tasks-panel-header {
                    display: flex;
                    justify-content: space-between;
                    align-items: center;
                    padding: 10px 15px;
                    background: #f8f9fa;
                }

                .tasks-panel-body:has(.task-details) {
                    flex: 1;
                    overflow-y: auto;
                    padding: 10px 15px;
					position: absolute;
					  top: 0px;
					  bottom: 0px;
					  right: 0px;
					  width: 30%;
					  min-width:320px;
					  background: rgb(255, 255, 255);
					  z-index: 1040;
					  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
                }
				.list-group-item label{
				line-height:1.2
				}
				.list-group-item .bi-grip-vertical:not(:hover){
				color:#cccccc!important;
				}
				.badge.badge-sm{
					font-weight:normal;
				}
				div.mt-1:has(>.badge.badge-sm){
				display:flex;
				}
				/* Modal hiển thị từ bên phải */
				.modal-dialog {
				  position: fixed;
				  margin: 0;
				  width: 50%;
				  max-width: 50%;
				  height: 100%;
				  right: 0;
				  top: 0;
				  bottom: 0;
				  transform: translateX(100%);
				  transition: transform 0.3s ease-out;
				  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
				}
				
				/* Khi modal hiển thị */
				.modal.show .modal-dialog {
				  transform: translateX(0);
				}

				/* Bỏ border-radius và thêm màu nền xám nhạt */
				.modal-content {
				  height: 100%;
				  border-radius: 0;
				  border: none;
				  background-color: #f8f9fa;
				}

				/* Màu nền cho header */
				.modal-header {
				  background-color: #ffffff;
				  border-bottom: 0px solid #dee2e6;
				  height: 60px; /* Chiều cao cố định cho header */
				  border-radius:0;
				}

				/* Modal body với chiều cao calc */
				.modal-body {
				  overflow-y: auto;
				  background-color: #f8f9fa;
				  height: calc(100vh - 60px - 70px); /* 100vh - header height - footer height */
				}
				#allFilesModal .modal-body{
					height: calc(100vh - 60px)!important;
					max-height: calc(100vh - 60px)!important;
				}
				#allFilesModal .modal-body > div{
					height: calc(100vh - 120px)!important;
					max-height: calc(100vh - 120px)!important;
				}
				/* Footer cố định ở cuối */
				.modal-footer {
				  background-color: #ffffff80;
				  border-top: 0px solid #dee2e6;
				  height: auto; /* Chiều cao cố định cho footer */
				  padding:5px;
				}

				/* Bỏ overlay (backdrop) */
				.modal-backdrop {
				  display: none;
				}
				.bg-danger-linear{
					background: linear-gradient(135deg, #FF791D 0%, #ED542C 100%);
					color:#fff;
				}
#task-management{
	margin-bottom:50px!important;
}
.commentsList{
	background:#fff;
	padding:5px;
}
/* ==================== MOBILE CHAT OPTIMIZATION ==================== */
/* Mobile responsive for chat interface */

@media (max-width: 768px) {
			:root{
				--sidebar-width:360px;
			}
		.header-content{
			padding-left:0;
		}
            .sidebar {
                transform: translateX(-100%);
                transition: transform 0.3s;
				background:#fff;
				padding-right:10px;
            }

            .sidebar.show {
                transform: translateX(0);
				
            }
		
            .main-content {
                margin-left: 0;
				padding:0;
            }

    /* Chat layout container */
    .chat-layout {
        height: calc(100vh - 55px);
        position: relative;
    }

    /* Sidebar with thread list */
    .chat-sidebar-left {
        width: 100% !important;
        height: 100%;
        display: flex;
        flex-direction: column;
        transition: transform 0.3s ease;
    }

    /* Ensure conversations list can scroll */
    .conversations-list {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Chat area */
    #chatArea {
        position: fixed;
        top: 56px;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: calc(100vh - 56px);
        background: white;
        z-index: 1000;
        display: none !important;
        transform: translateX(100%);
        transition: transform 0.3s ease;
    }

    /* When a thread is selected (active), show chat area */
    #chatArea.active {
        display: block !important;
        transform: translateX(0) !important;
    }
	.chat-header-avatar{
		margin-left:25px;
	}
    /* Hide sidebar when chat is active */
    .chat-sidebar-left.hidden {
        transform: translateX(-100%);
    }
	.modal-dialog{
		width:80%;
		max-width:80%;
	}
    .mobile-back-btn {
        display: block;
    }
	.chat-header{
		padding:0 10px;
	}
	.chat-header-avatar{
		margin-left:0;
	}
	.chat-messages {
        height: calc(100vh - 60px)!important;
		padding-bottom:200px!important;
    }
	.chat-input-area{
		position: fixed;
		bottom: 0;
		width: 100%;
	}
	.header{
		box-shadow:none!important;
	}
    .sidebar {
		z-index:1099;
        padding: 0 20px 0 0;
        margin-bottom: 0;
		height:100%;
		overflow-y:auto;
    }
    .message-content {
        max-width: 85%;
    }
	.mobile-back-btn {
        display: block;
		margin-left:-5px;
    }
	.chat-sidebar-right{
		right:0;
		position:absolute!important;
		z-index:1060;
		overflow-y: auto;
		top:60px;
		height: calc(100vh - 197px);
	}
	.chat-header-details h4{
		max-width:140px;
		overflow: hidden;
		white-space: nowrap;
		text-overflow: ellipsis ellipsis;
	}
	.chat-header-actions{
		gap:2px;
	}
	/* Mobile: Hide some buttons, show dropdown */
	.hide-mobile-inline {
		display: none !important;
	}

	.show-mobile-inline {
		display: inline-block !important;
	}

	.chat-input-area{
		padding: 5px 0;
	}
	.chat-send-btn{
		margin-right:10px;
	}
	.chat-header-info{
		margin-left:25px;
	}
	.col,
	.col-auto
	{
		flex: fit-content;
	}
}
@media (min-width: 744px) and (max-width: 990px) {
	.header{
		box-shadow:none!important;
		background:unset!important;
	}
	.chat-sidebar-left{
		width: 220px;
		max-width: 220px;
	}
	.mobile-back-btn {
        display: none;
	}
	#allFilesModal .modal-dialog,
   .modal-dialog{
		width:70%!important;
		max-width:70%!important;
	}
	#chatArea{
		all:unset!important;
		width:100%!important;
	}
	.chat-messages {
        height: calc(100vh - 60px)!important;
		padding-bottom:200px!important;
    }
	#chatInfoPanel{
		position: absolute!important;
		top:60px!important;
		right: 0!important;
		bottom: 0!important;
		overflow-y: auto !important;
		height: 100%!important;
		border-left:0!important;
		box-shadow: 0 2px 4px rgba(0,0,0,0.08)!important;
		padding-bottom:50px;
	}
}
