.chat-dropdown-item {
    padding: 0px 20px;
    border-bottom: 1px solid #f1f3f4;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-dropdown-item-content { flex: 1; min-width: 0; }
.chat-dropdown-item-content { padding: 12px; }
.chat-item-title {
    color: #333;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chat-item-preview {
    font-size: 16px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-dropdown-item-actions .btn { visibility: hidden; opacity: 0; transition: opacity .15s ease; }
.chat-dropdown-item:hover .chat-dropdown-item-actions .btn { visibility: visible; opacity: 1; }

.sidebar {
    width: 100px;
    min-height: 93vh;
    position: relative;
    overflow: visible;
    background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
    border-right: 1px solid #e9ecef;
    box-shadow: 2px 0 15px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
}

/* Hamburger menu removed - sidebar is now permanent */

.sidebar-content {
    /* height: 100vh; */
    overflow-y: auto;
    padding: 0;
    opacity: 1;
}

.sidebar-icons {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
    padding: 30px 0;
    opacity: 1;
    position: relative;
    z-index: 10;
}

.sidebar-icons .btn {
    /* width: 60px; */
    height: auto;
    border-radius: 12px;
    border: none;
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
    padding: 12px 8px;
    /* min-height: 70px; */
    margin: 4px 0;
}

.sidebar-icons .btn i,
.sidebar-icons .btn img {
    opacity: 1;
    transition: opacity 0.3s ease;
    flex-shrink: 0;
}

/* Icons are always visible */

/* Ensure icons are always visible regardless of sidebar state */
.sidebar-icons .btn i,
.sidebar-icons .btn img {
    opacity: 1 !important;
    display: block;
}

/* Override sidebar-content opacity for icons */
.sidebar-icons {
    opacity: 1 !important;
}

/* Navigation items are always in expanded style */

.sidebar-text {
    opacity: 1;
    font-size: 11px;
    font-weight: 400;
    text-align: center;
    margin-top: 4px;
    line-height: 1.2;
}



.sidebar-icons .btn img {
    filter: brightness(0.8);
    transition: all 0.3s ease;
}

.sidebar-icons .btn:hover img {
    filter: brightness(1) drop-shadow(0 2px 4px rgba(0,123,255,0.3));
}

.sidebar-icons .btn.active img {
    filter: brightness(1.2) drop-shadow(0 2px 6px rgba(255,255,255,0.5));
}

.sidebar-section {
    margin-bottom: 5px;
}

.sidebar-section-title {
    font-size: 12px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    padding: 0 20px;
    opacity: 1;
    transition: opacity 0.3s ease;
}

/* Section titles always visible */

.new-chat-btn {
    width: calc(100% - 40px);
    margin: 0 20px 20px 20px;
    padding: 12px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0;
    transform: translateX(-20px);
    transition: all 0.3s ease;
}

.sidebar.expanded .new-chat-btn {
    opacity: 1;
    transform: translateX(0);
}

.new-chat-btn:hover {
    background: #0056b3;
}

.chat-history-section {
    max-height: 400px;
    overflow-y: auto;
}

.clear-all-btn {
    width: calc(100% - 40px);
    margin: 20px 20px 0 20px;
    padding: 10px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    opacity: 0;
    transform: translateX(-20px);
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(220,53,69,0.2);
}

.sidebar.expanded .clear-all-btn {
    opacity: 1;
    transform: translateX(0);
}

.clear-all-btn:hover {
    background: #c82333;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(220,53,69,0.3);
}

/* Chat Dropdown Styles */
.nav-item-container {
    position: relative;
}

.chat-dropdown {
    position: fixed;
    left: 150px;
    top: 0;
    width: 230px;
    /* height: 100vh; */
    background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
    border-right: 2px solid #e9ecef;
   
    opacity: 0;
    visibility: hidden;
    transform: translateX(-20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Show dropdown on click - controlled by JavaScript */
.chat-dropdown.show {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateX(0) !important;
    pointer-events: auto !important;
}

/* Adjust main content when sidebar appears - controlled by JavaScript */
.main-content {
    transition: margin-left 0.3s ease;
}

.main-content.sidebar-open {
    margin-left: 300px;
}

/* Ensure container has proper positioning */
.nav-item-container {
    position: relative;
}

/* Make sure dropdown is above everything */
.chat-dropdown {
    pointer-events: none;
    transition: all 0.2s ease;
}

.nav-item-container:hover .chat-dropdown {
    pointer-events: auto;
}

.chat-dropdown-header {
    padding: 20px 20px 15px;
    font-weight: 600;
    font-size: 16px;
    color: #333;
    border-bottom: 1px solid #e9ecef;
    background: white;
    flex-shrink: 0;
}

.chat-dropdown-list {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

/* Custom scrollbar for chat dropdown */
.chat-dropdown-list::-webkit-scrollbar {
    width: 6px;
}

.chat-dropdown-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.chat-dropdown-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.chat-dropdown-list::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

.chat-dropdown-item {
    padding: 0px 20px;
    border-bottom: 1px solid #f1f3f4;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-dropdown-item:hover {
    background: #f8f9fa;
    border-left: 3px solid #007bff;
}

.chat-dropdown-item.active {
    background: #e3f2fd;
    border-left: 3px solid #007bff;
}

.chat-dropdown-item:last-child {
    border-bottom: none;
}

.chat-dropdown-item-content {
    flex: 1;
    min-width: 0;
}

.chat-dropdown-item-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.chat-dropdown-item:hover .chat-dropdown-item-actions {
    opacity: 1;
}

.chat-item-title {
    font-weight: 500;
    font-size: 13px;
    color: #333;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-item-preview {
    font-size: 12px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-dropdown-footer {
    padding: 20px;
    border-top: 1px solid #e9ecef;
    background: white;
    flex-shrink: 0;
}

.chat-dropdown-footer .btn {
    font-size: 13px;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
    width: 100%;
}

.chat-dropdown-footer .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(220,53,69,0.2);
}

/* Sidebar toggle removed */



.chat-history-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f3f4;
    cursor: pointer;
    transition: background-color 0.2s ease;
    position: relative;
}

.chat-history-item:hover {
    background-color: #f8f9fa;
}

.chat-history-item.active {
    background-color: #e3f2fd;
    border-left: 3px solid #2196f3;
}

.chat-title {
    font-weight: 500;
    font-size: 14px;
    color: #333;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-preview {
    font-size: 12px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-timestamp {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
}

.chat-actions {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.chat-history-item:hover .chat-actions {
    opacity: 1;
}

.delete-chat-btn {
    background: none;
    border: none;
    color: #dc3545;
    padding: 4px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.delete-chat-btn:hover {
    background-color: #f8d7da;
}

.history-header {
    padding: 16px;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
}

.history-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.clear-all-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
}

.clear-all-btn:hover {
    background: #c82333;
}

.close-history-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
}

.close-history-btn:hover {
    background: #5a6268;
}

/* Header Search Bar Styles */
.header-search-container {
    flex: 1;
    max-width: 500px;
    margin: 0 20px;
    position: relative;
}

.header-search-container .search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.header-search-container .search-icon {
    position: absolute;
    left: 15px;
    color: #6c757d;
    font-size: 16px;
    z-index: 2;
    pointer-events: none;
}

.header-search-input {
    border-radius: 30px;
    border: 2px solid #e9ecef;
    padding: 12px 50px 12px 45px;
    font-size: 15px;
    background: #f8f9fa;
    transition: all 0.3s ease;
    width: 100%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.header-search-container .clear-search-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    padding: 6px 10px;
    border: none;
    background: transparent;
    color: #6c757d;
    font-size: 14px;
    z-index: 2;
    border-radius: 50%;
    transition: all 0.2s ease;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-search-container .clear-search-btn:hover {
    background: #e9ecef;
    color: #495057;
}

.header-search-input:focus {
    border-color: #007bff;
    background: white;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.15), 0 4px 12px rgba(0,0,0,0.1);
    outline: none;
}

.header-search-container .search-input-wrapper:focus-within .search-icon {
    color: #007bff;
}

.header-search-input::placeholder {
    color: #6c757d;
    font-size: 14px;
}

/* Search Suggestions Dropdown */
.search-suggestions-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    z-index: 10000;
    max-height: 400px;
    overflow-y: auto;
    margin-top: 4px;
}

.search-suggestions-list {
    padding: 8px 0;
}

.search-suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f8f9fa;
    transition: background-color 0.2s ease;
}

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

.search-suggestion-item:hover {
    background-color: #f8f9fa;
}

.search-suggestion-item.active {
    background-color: #e3f2fd;
}

.suggestion-title {
    font-weight: 500;
    color: #333;
    margin-bottom: 2px;
    font-size: 14px;
}

.suggestion-preview {
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 2px;
}

.suggestion-meta {
    font-size: 11px;
    color: #999;
    display: flex;
    align-items: center;
    gap: 8px;
}

.suggestion-highlight {
    background-color: #fff3cd;
    padding: 1px 2px;
    border-radius: 2px;
    font-weight: 500;
}

.no-suggestions {
    padding: 16px;
    text-align: center;
    color: #6c757d;
    font-size: 14px;
}

/* Responsive design for header */
@media (max-width: 768px) {
    .header-search-container {
        max-width: 300px;
        margin: 0 10px;
    }
    
    .header-search-input {
        padding: 10px 40px 10px 35px;
        font-size: 14px;
    }
    
    .header-search-container .search-icon {
        left: 12px;
        font-size: 14px;
    }
}

@media (max-width: 576px) {
    .header-search-container {
        max-width: 250px;
        margin: 0 5px;
    }
    
    header h1 {
        font-size: 1rem !important;
    }
    
    .sidebar-icons .btn {
        width: 50px;
        min-height: 60px;
        padding: 8px 4px;
    }
    
    .sidebar-text {
        font-size: 10px;
    }
}

.input-group .btn {
    border-radius: 0 8px 8px 0;
    border-left: none;
    padding: 8px 12px;
}

.input-group .btn:hover {
    background-color: #e9ecef;
    border-color: #e9ecef;
}

/* Search results highlighting */
.search-highlight {
    background-color: #fff3cd;
    padding: 1px 2px;
    border-radius: 2px;
}

/* No results message */
.no-search-results {
    padding: 20px;
    text-align: center;
    color: #6c757d;
    font-style: italic;
}

.chat-input {
    border-radius: 16px;
    resize: none;
    padding: 20px;
    font-size: 16px;
    line-height: 1.5;
    overflow-y: auto;
    margin-bottom: 10px;
}

.input-actions {
    position: absolute;
    bottom: 20px;
    left: 30px;
    right: 30px;
    z-index: 10;
}

/* Thinking/loading message styles */
.thinking-message {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 18px;
    margin-bottom: 16px;
    max-width: 50%;
}

.thinking-dots {
    display: flex;
    gap: 4px;
}

.thinking-dot {
    width: 8px;
    height: 8px;
    background: #6c757d;
    border-radius: 50%;
    animation: thinking 1.4s infinite ease-in-out;
}

.thinking-dot:nth-child(1) { animation-delay: -0.32s; }
.thinking-dot:nth-child(2) { animation-delay: -0.16s; }

html[data-theme="dark"] .thinking-message {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

html[data-theme="dark"] .thinking-message .text-muted,
html[data-theme="dark"] .ai-thinking-label {
    color: #cbd5e1 !important;
}

html[data-theme="dark"] .thinking-dot {
    background: #94a3b8;
}

html[data-theme="dark"] .ai-avatar {
    background: #1e293b;
    border-color: #334155;
}

.dc-send-error-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 16px 20px;
    background: #fff5f5;
    border: 1px solid #fecaca;
    border-radius: 18px;
    margin-bottom: 16px;
    max-width: 50%;
}

.dc-send-error-text {
    color: #991b1b;
    font-size: 14px;
    line-height: 1.45;
}

.dc-send-error-retry {
    border: 0;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    padding: 6px 14px;
    cursor: pointer;
}

.dc-send-error-retry:hover,
.dc-send-error-retry:focus {
    background: #b91c1c;
}

html.dc-dealchief-embed .dc-send-error-card {
    max-width: 85%;
    padding: 10px 14px;
}

@keyframes thinking {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.send-btn {
    width: 32px;
    height: 32px;
    transform: rotate(45deg);
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1; /* avoid baseline shifts across fonts */
}

.send-btn img {
    display: block; /* remove inline-img baseline alignment jitter */
}

.profile-popup {
    position: fixed;
    bottom: 60px;
    left: 53px;
    width: 256px;
    z-index: 1050;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.message-bubble {
    /* max-width: 70%; */
    border-radius: 18px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Role-colored DealChief / A2I2 bubbles (classes set by myct.js) */
.message-role-badge {
    display: inline-flex;
    align-items: center;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-radius: 999px;
    padding: 2px 8px;
    margin-bottom: 6px;
    line-height: 1.4;
}

.message-role-badge--customer {
    background: #eef2ff;
    color: #4338ca;
}

.message-role-badge--sales {
    background: #ecfdf5;
    color: #047857;
}

.message-role-badge--agent {
    background: #eff6ff;
    color: #1d4ed8;
}

.message-bubble--customer {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-color: transparent;
}

.message-bubble--sales {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #fff;
    border-color: transparent;
}

.message-bubble--agent {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
    border-color: transparent;
}

.message-bubble--assistant {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    color: #212529;
}

.message-bubble--incoming {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    color: #212529;
}

.message-bubble--incoming-customer {
    border-left: 3px solid #6366f1;
}

.message-bubble--incoming-sales {
    border-left: 3px solid #10b981;
}

.message-bubble--incoming-agent {
    border-left: 3px solid #3b82f6;
}

.d-flex.justify-content-end .message-bubble--customer .message-text,
.d-flex.justify-content-end .message-bubble--sales .message-text,
.d-flex.justify-content-end .message-bubble--agent .message-text {
    color: #fff;
}

.message-bubble--customer .message-text,
.message-bubble--sales .message-text,
.message-bubble--agent .message-text {
    color: inherit;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
    font-size: 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    margin: 0 12px 0 0;
    overflow: hidden;
    position: relative;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.user-avatar span {
    position: relative;
    z-index: 1;
}

.user-avatar:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102,126,234,0.3);
}

.ai-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin: 0 12px 0 0;
}

/* For user messages (right side), adjust avatar margin */
.chat-messages .d-flex.justify-content-end .user-avatar {
    margin: 0 0 0 12px;
    order: 2;
}

.chat-messages .d-flex.justify-content-end .message-container {
    order: 1;
}

.chat-messages {
    max-height: 60vh;
    overflow-y: auto;
    padding: 20px 0;
}

/* =======================================================================
   AI Chat layout: full-height pane + bottom docked input (ChatGPT style)
   ======================================================================= */
.AIChatBox {
    height: 100% !important;
    min-height: 0;
    margin: 0 !important;
    border-radius: 0 !important;
}

.AIChatBox > main {
    height: 100%;
    min-height: 0;
}

/* AI header auto-hide while chatting (show again on mouse move) */
.AIChatBox > main > header {
    max-height: 88px;
    overflow: hidden;
    transition: max-height 0.22s ease, opacity 0.2s ease, padding 0.2s ease, border-color 0.2s ease;
    opacity: 1;
}

.AIChatBox.ai-header-hidden > main > header {
    max-height: 0;
    opacity: 0;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    border-top-color: transparent !important;
    border-bottom-color: transparent !important;
    pointer-events: none;
}

/* Chat content wrapper (messages + input) must be a true flex column */
.AIChatBox > main > .flex-grow-1.d-flex.flex-column {
    flex: 1;
    min-height: 0;
}

/* Message viewport grows to full available height */
.AIChatBox > main > .flex-grow-1.d-flex.flex-column > .flex-grow-1.px-4.py-3 {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.AIChatBox #chatMessages.chat-messages {
    flex: 1;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    padding: 20px 0;
}

/* Keep welcome state centered in available space */
.AIChatBox #welcomeMessage {
    margin: auto 0;
}

/* Input dock pinned at bottom without legacy top spacing */
.AIChatBox .ai-chat-input-dock {
    margin-top: auto !important;
    padding-top: 12px !important;
    padding-bottom: 12px !important;
    background: #fff;
}

/* Empty state is controlled explicitly by .ai-chat-empty. */
.AIChatBox.ai-chat-empty > main > .flex-grow-1.d-flex.flex-column {
    justify-content: center;
}

/* Hide the empty messages viewport in initial screen */
.AIChatBox.ai-chat-empty > main > .flex-grow-1.d-flex.flex-column > .flex-grow-1.px-4.py-3 {
    display: none;
}

.AIChatBox.ai-chat-empty #welcomeMessage {
    margin: 0 0px 0 0;
    overflow-y: auto;
}

.AIChatBox #welcomeMessage > h2 {
    font-size: 22px;
}

.AIChatBox.ai-chat-empty .ai-chat-input-dock {
    margin-top: 0 !important;
    border-top: none;
    padding-top: 0 !important;
}

/* ===== A2I2 attachment popup (#attachPlusA2I2) ===== */
#attachPlusA2I2.attach-plus-a2i2,
.AIChatBox #attachPlusA2I2 {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 0;
    z-index: 1000;
    min-width: 188px;
    max-width: min(240px, calc(100vw - 24px));
    padding: 6px;
    background: #fff;
    border: 1px solid rgba(59, 130, 246, 0.22);
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12), 0 2px 6px rgba(15, 23, 42, 0.06);
    box-sizing: border-box;
}

#attachPlusA2I2[hidden] {
    display: none !important;
}

#attachPlusA2I2 .image-upload {
    margin: 0 !important;
}

#attachPlusA2I2 .image-upload.mb-2,
#attachPlusA2I2 .image-upload.mt-2 {
    margin: 0 !important;
}

#attachPlusA2I2 .attach-plus-a2i2__option,
#attachPlusA2I2 .image-upload > label {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 8px 10px;
    border-radius: 12px;
    color: #1f2937;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    background: transparent;
    transition: background 0.15s ease;
}

#attachPlusA2I2 .attach-plus-a2i2__option:hover,
#attachPlusA2I2 .image-upload > label:hover {
    background: #f3f6fb;
}

#attachPlusA2I2 .attach-plus-a2i2__option > img,
#attachPlusA2I2 .attach-plus-a2i2__option > i,
#attachPlusA2I2 .image-upload > label > img,
#attachPlusA2I2 .image-upload > label > i {
    width: 28px;
    height: 28px;
    min-width: 28px;
    padding: 5px;
    border-radius: 999px;
    box-sizing: border-box;
    object-fit: contain;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    color: #374151;
    font-size: 14px;
    line-height: 1;
}

#attachPlusA2I2 .image-upload:nth-child(1) > label > img {
    background: #eff6ff;
}

#attachPlusA2I2 .image-upload:nth-child(2) > label > img {
    background: #f5f3ff;
}

#attachPlusA2I2 .image-upload:nth-child(3) > label > i {
    background: #fdf2f8;
    color: #db2777;
}

@media (max-width: 768px) {
    #attachPlusA2I2.attach-plus-a2i2,
    .AIChatBox #attachPlusA2I2 {
        min-width: 0;
        width: max-content;
        max-width: min(68vw, 176px);
        padding: 4px;
        border-radius: 14px;
        border-color: rgba(59, 130, 246, 0.28);
        bottom: calc(100% + 8px);
    }

    #attachPlusA2I2 .attach-plus-a2i2__option,
    #attachPlusA2I2 .image-upload > label {
        gap: 8px;
        padding: 6px 8px;
        border-radius: 10px;
        font-size: 12px;
    }

    #attachPlusA2I2 .attach-plus-a2i2__option > img,
    #attachPlusA2I2 .attach-plus-a2i2__option > i,
    #attachPlusA2I2 .image-upload > label > img,
    #attachPlusA2I2 .image-upload > label > i {
        width: 24px;
        height: 24px;
        min-width: 24px;
        padding: 4px;
        border-radius: 999px;
        font-size: 12px;
    }
}

/* Improve text readability in messages */
.message-bubble div:first-child {
    line-height: 1.4;
    word-wrap: break-word;
}

/* Formatting styles for AI messages */
.message-bubble p {
    margin-bottom: 0.5rem;
}

.message-bubble p:last-child {
    margin-bottom: 0;
}

.message-bubble .list-item {
    margin-bottom: 0.25rem;
    padding-left: 0.5rem;
}

.message-bubble .list-number {
    font-weight: 600;
    color: #0d6efd;
}

.message-bubble strong {
    font-weight: 600;
    color: inherit;
}

/* Script / teleprompter cues [PAUSE] — Google Chat–style accent */
.AIChatBox .message-text,
.AIChatBox .message-bubble .message-text {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.45;
}

.AIChatBox .chat-script-cue {
    font-weight: 500;
    color: #c5221f;
}

.message.right .message-bubble .chat-script-cue {
    color: #9c1c1a;
}

/* Additional improvements for chat bubbles */
.message-bubble {
    position: relative;
    /* box-shadow: 0 2px 8px rgba(0,0,0,0.1); */
    border: 1.5px solid #e9ecef;
    border-radius: 18px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}



.message-bubble.bg-light {
    background: #ffffff !important;
    border: 1px solid #e9ecef !important;
}

/* Remove any conflicting avatar styles */
.chat-messages .user-avatar,
.chat-messages .ai-avatar {
    position: static;
}

/* Message action buttons */
.message-actions {
    opacity: 0;
    transition: opacity 0.2s ease;
    margin-top: 8px;
    padding: 0 4px;
}

.message-container:hover .message-actions {
    opacity: 1;
}

.message-action-btn {
    background: transparent;
    border: 1px solid #dee2e6;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.2s ease;
    margin: 0 2px;
}

.message-action-btn:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.message-action-btn img {
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.message-action-btn:hover img {
    opacity: 1;
}

/* Message container styling */
.message-container {
    flex: 1;
    max-width: 70%;
    display: flex;
    flex-direction: column;
}

.message-sender-name {
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    line-height: 1.3;
    text-transform: none;
    letter-spacing: 0;
}

.d-flex.justify-content-end .sender-name {
    justify-content: flex-end;
}

/* Chat message alignment fixes */
.chat-messages .d-flex {
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

/* User message alignment (right side) */
.chat-messages .d-flex.justify-content-end {
    flex-direction: row;
}

.chat-messages .d-flex.justify-content-end .message-container {
    align-items: flex-end;
}

.chat-messages .d-flex.justify-content-end .message-actions {
    justify-content: flex-end;
}

/* AI message alignment (left side) */
.chat-messages .d-flex:not(.justify-content-end) .message-container {
    align-items: flex-start;
}

.chat-messages .d-flex:not(.justify-content-end) .message-actions {
    justify-content: flex-start;
}

/* Avatar alignment */
.user-avatar, .ai-avatar {
    align-self: flex-start;
    margin-top: 0;
}
.avatar-img{
    width: 36px;
    height: 36px;

   
    border-radius: 50%;
    display: flex
;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s 
ease;
    flex-shrink: 0;
    margin: 0 12px 0 0
}

/* Message bubble alignment */
.message-bubble {
    margin-bottom: 0;
}

.recent-ai-item{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    padding:10px 12px;
    cursor:pointer;
}

.recent-ai-item .ai-meta{
    display:flex;
    flex-direction:column;
    gap:4px;
    flex:1;
}

.recent-ai-item .userListPtag{ margin:0; }
.recent-ai-item .timespan{ color:#6b7280; font-size:12px; }

.recent-ai-item .ai-delete-btn{ 
    visibility:hidden; 
    opacity:0; 
    transition:opacity .15s ease; 
}
.recent-ai-item:hover .ai-delete-btn{ visibility:visible; opacity:1; }

/* Optional subtle hover highlight */
.recent-ai-item:hover{ box-shadow:0 0 0 2px #1da1f2 inset; border-radius:6px; }

/* AI panel lives inside #chatArea — keep the area visible, hide sibling panes only */
.AIChatBox.ai-panel-open,
.AIChatBox:not(.none)[style*="display: block"],
.AIChatBox:not(.none):not([style*="display: none"]) {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    min-width: 0 !important;
    flex: 1 1 auto !important;
}

#chatArea.container2.ai-chat-area-active,
.container2#chatArea.ai-chat-area-active {
    display: flex !important;
    flex-direction: column !important;
    visibility: visible !important;
    opacity: 1 !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    overflow: hidden !important;
}

#chatArea.container2.ai-chat-area-active > .AIChatBox.ai-panel-open,
.container2#chatArea.ai-chat-area-active > .AIChatBox.ai-panel-open {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    max-width: none !important;
    height: 100% !important;
    max-height: 100% !important;
    margin: 0 !important;
    flex: none !important;
}

#chatArea.container2.ai-chat-area-active > *:not(.AIChatBox):not(.mobile-chat-back-btn),
.container2#chatArea.ai-chat-area-active > *:not(.AIChatBox):not(.mobile-chat-back-btn) {
    display: none !important;
}

#chatArea.container2.friend-chat-area-active .AIChatBox,
.container2#chatArea.friend-chat-area-active .AIChatBox {
    display: none !important;
    visibility: hidden !important;
}

#chatArea.container2.friend-chat-area-active,
.container2#chatArea.friend-chat-area-active {
    display: flex !important;
    flex-direction: column !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Enhanced mobile responsiveness for AI Chat and Hamburger Menu */
@media (max-width: 1024px) {
    .AIChatBox {
        width: 100%;
        margin-left: 0;
    }
    
    .chat-messages {
        padding: 15px 10px !important;
    }
    
    .message-bubble {
        font-size: 14px !important;
        padding: 10px !important;
    }
    
    #chatHeaderTitle {
        font-size: 1.2rem !important;
    }
    
    .header-search-container {
        max-width: 150px;
    }
    
    .header-search-input {
        font-size: 13px;
        padding: 4px 30px 4px 30px;
    }
    
    .container1 {
        position: fixed !important;
        top: 0 !important;
        left: -101% !important;
        width: 380px !important;
        max-width: 90vw !important;
        height: 100vh !important;
        z-index: 10000 !important;
        transition: left 0.3s ease !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        box-shadow: 2px 0 10px rgba(0,0,0,0.1) !important;
        background: white !important;
        transform: translateX(0) !important;
    }
    
    .container1.active {
        left: 0 !important;
    }
    
    .overlay.active {
        z-index: 9999 !important;
    }
    
    .hamburger-btn {
        display: block !important;
    }
}

@media (max-width: 576px) {
    .AIChatBox {
        margin-left: 0 !important;
        width: 100% !important;
    }
    
    .hamburger-btn {
        display: block !important;
        top: 10px !important;
        left: 10px !important;
        padding: 10px 12px !important;
        font-size: 20px !important;
    }
    
    .chat-messages {
        padding: 10px 5px !important;
    }
    
    .message-bubble {
        font-size: 13px !important;
        padding: 8px !important;
    }
    
    .container1 {
        width: 100% !important;
        left: -101%;
    }
}

/* ========================================
   A2I2 Image & Video Preview Styles
   ======================================== */

/* A2I2 Image Upload Modal Container */
.a2i2-image-preview-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    animation: fadeIn 0.3s ease;
}

/* A2I2 Video Upload Modal Container */
.a2i2-video-preview-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    animation: fadeIn 0.3s ease;
}

/* Close Button for A2I2 Modals */
.a2i2-modal-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 32px;
    cursor: pointer;
    z-index: 10001;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.1);
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.a2i2-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

/* A2I2 Modal Content Wrapper */
.a2i2-modal-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 40px 20px;
    gap: 20px;
}

/* A2I2 Main Preview Image */
.a2i2-main-preview-img {
    max-width: 85%;
    max-height: 55%;
    object-fit: contain;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: zoomIn 0.4s ease;
}

/* A2I2 Main Preview Video */
.a2i2-main-preview-video {
    max-width: 85%;
    max-height: 55%;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: zoomIn 0.4s ease;
}

/* A2I2 Caption Input */
.a2i2-caption-input {
    width: 85%;
    max-width: 600px;
    padding: 14px 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 16px;
    outline: none;
    transition: all 0.3s ease;
}

.a2i2-caption-input:focus {
    border-color: #0d6efd;
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.2);
}

.a2i2-caption-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

/* A2I2 Thumbnails Container */
.a2i2-thumbnails-container {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    max-width: 85%;
    overflow-x: auto;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 16px;
    align-items: center;
    justify-content: center;
    min-height: 100px;
}

/* Custom Scrollbar for Thumbnails */
.a2i2-thumbnails-container::-webkit-scrollbar {
    height: 8px;
}

.a2i2-thumbnails-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.a2i2-thumbnails-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.a2i2-thumbnails-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Individual Thumbnail Wrapper */
.a2i2-thumbnail-wrapper {
    position: relative;
    width: 90px;
    height: 90px;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 3px solid transparent;
}

.a2i2-thumbnail-wrapper:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.3);
}

.a2i2-thumbnail-wrapper.active {
    border-color: #0d6efd;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.3);
}

/* Thumbnail Image */
.a2i2-thumbnail-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Thumbnail Delete Button */
.a2i2-thumbnail-delete {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    background: #dc3545;
    color: white;
    border: 2px solid white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.2s ease;
    z-index: 10;
}

.a2i2-thumbnail-delete:hover {
    background: #c82333;
    transform: scale(1.15);
}

/* Thumbnail Loader */
.a2i2-thumbnail-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    z-index: 5;
}

/* Add More Images Button */
.a2i2-add-more-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 2px dashed rgba(255, 255, 255, 0.5);
    color: white;
    padding: 10px 24px;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 15px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.a2i2-add-more-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.8);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.2);
}

/* Send Button for A2I2 */
.a2i2-send-btn {
    background: linear-gradient(135deg, #0d6efd 0%, #0056b3 100%);
    color: white;
    padding: 14px 35px;
    border-radius: 30px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 17px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    box-shadow: 0 4px 15px rgba(13, 110, 253, 0.4);
}

.a2i2-send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(13, 110, 253, 0.6);
}

.a2i2-send-btn:active {
    transform: translateY(0);
}

/* Send Button Icon */
.a2i2-send-icon {
    width: 24px;
    height: 24px;
}

/* Send Button Loader */
.a2i2-send-loader {
    display: none;
    width: 22px;
    height: 22px;
}

/* Video Thumbnail in Listing */
.a2i2-video-thumbnail-wrapper {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
}

.a2i2-video-thumbnail-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Responsive Design for A2I2 Modals */
@media (max-width: 768px) {
    .a2i2-main-preview-img,
    .a2i2-main-preview-video {
        max-width: 95%;
        max-height: 45%;
    }
    
    .a2i2-caption-input {
        width: 90%;
        font-size: 14px;
    }
    
    .a2i2-thumbnails-container {
        max-width: 95%;
        padding: 10px;
    }
    
    .a2i2-thumbnail-wrapper {
        width: 70px;
        height: 70px;
    }
    
    .a2i2-modal-close {
        top: 15px;
        right: 15px;
        font-size: 28px;
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 480px) {
    .a2i2-main-preview-img,
    .a2i2-main-preview-video {
        max-width: 100%;
        max-height: 40%;
        border-radius: 12px;
    }
    
    .a2i2-modal-content {
        padding: 30px 15px;
        gap: 15px;
    }
    
    .a2i2-caption-input {
        width: 95%;
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .a2i2-thumbnails-container {
        max-width: 100%;
        gap: 8px;
        padding: 8px;
    }
    
    .a2i2-thumbnail-wrapper {
        width: 60px;
        height: 60px;
    }
    
    .a2i2-send-btn {
        padding: 12px 28px;
        font-size: 15px;
    }
}

/* ========================================
   A2I2 Bootstrap Image / Video Upload Modals
   ======================================== */
.a2i2-bs-modal .modal-content {
    border-radius: 16px;
    border: none;
    overflow: hidden;
}

.a2i2-bs-modal .modal-header {
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    padding: 12px 16px;
}

.a2i2-bs-modal .modal-title {
    font-size: 16px;
    font-weight: 600;
    color: #212529;
    display: flex;
    align-items: center;
}

.a2i2-bs-modal .modal-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.a2i2-bs-modal .modal-footer {
    padding: 10px 16px;
    border-top: 1px solid #e9ecef;
    gap: 8px;
}

.a2i2-bs-modal .a2i2-preview-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f3f5;
    border-radius: 12px;
    min-height: 220px;
    max-height: 360px;
    overflow: hidden;
}

.a2i2-bs-modal #a2i2MainPreviewImg,
.a2i2-bs-modal #a2i2VideoPreview {
    max-width: 100%;
    max-height: 360px;
    object-fit: contain;
    border-radius: 8px;
    background: #000;
}

.a2i2-bs-modal #a2i2MainPreviewImg:not([src]),
.a2i2-bs-modal #a2i2MainPreviewImg[src=""] {
    display: none;
}

.a2i2-bs-modal .a2i2-caption-field {
    border-radius: 999px;
    border: 1px solid #dee2e6;
    padding: 10px 16px;
    font-size: 14px;
}

.a2i2-bs-modal .a2i2-caption-field:focus {
    border-color: #0f62fe;
    box-shadow: 0 0 0 3px rgba(15, 98, 254, 0.15);
}

.a2i2-bs-modal .a2i2-thumbnails-strip {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 4px 0;
}

.a2i2-bs-modal .a2i2-thumbnails-strip .a2i2-thumbnail-wrapper {
    width: 64px;
    height: 64px;
    border-radius: 10px;
    border-width: 2px;
    flex: 0 0 auto;
}

/* Compact modal in narrow chatbot embed iframe */
@media (max-width: 480px) {
    .a2i2-bs-modal .modal-dialog {
        margin: 8px;
    }
    .a2i2-bs-modal .a2i2-preview-wrap {
        min-height: 160px;
        max-height: 240px;
    }
    .a2i2-bs-modal #a2i2MainPreviewImg,
    .a2i2-bs-modal #a2i2VideoPreview {
        max-height: 240px;
    }
    .a2i2-bs-modal .modal-footer .btn {
        padding: 6px 14px;
        font-size: 14px;
    }
}

/* ========================================
   A2I2 Reaction Styles
   ======================================== */
.reaction-picker-a2i2 {
    display: none;
    position: absolute;
    bottom: 0;
    left: 0;
    right: auto;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 6px 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 1000;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 4px;
    white-space: nowrap;
    transform: translateY(calc(-100% - 8px));
}

.reaction-picker-a2i2[style*="flex"] {
    display: flex !important;
}

/* Ensure message-container is positioned relative for absolute positioning of picker */
.message-container {
    position: relative;
}

/* Position picker just above reactions-container (near timestamp area) */
/* The picker is inserted before reactions-container, so we position it relative to that area */
.message-container .reaction-picker-a2i2 {
    position: absolute;
    bottom: auto;
    top: auto;
    /* Position it just above the reactions-container area (which is after timestamp) */
    /* We'll use JavaScript to calculate exact position, but CSS provides base positioning */
}

/* For right-side messages - align to right edge */
.d-flex.justify-content-end .message-container .reaction-picker-a2i2 {
    left: auto;
    right: 0;
}

.reaction-picker-a2i2 .reaction {
    cursor: pointer;
    font-size: 20px;
    padding: 4px 8px;
    display: inline-block;
    transition: transform 0.2s;
}

.reaction-picker-a2i2 .reaction:hover {
    transform: scale(1.2);
}

.reactions-container-a2i2 {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.reaction-chip-a2i2 {
    display: inline-flex;
    align-items: center;
    background: #f0f2f5;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.reaction-chip-a2i2:hover {
    background: #e4e6eb;
}

/* New reaction chip styles for grouped reactions */
.reaction-a2i2-chip {
    display: inline-block;
    background: #f1f1f1;
    border-radius: 12px;
    padding: 4px 10px;
    margin-right: 6px;
    margin-top: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.reaction-a2i2-chip:hover {
    background: #e4e6eb;
}

.reaction-a2i2-count {
    font-weight: bold;
    margin-left: 4px;
    font-size: 12px;
    color: #666;
}

.deleted-message {
    font-style: italic;
    color: #999 !important;
}

/* Bootstrap modals above app overlays; backdrop must be BELOW .modal or it
   captures all clicks (BS default: backdrop 1050, dialog 1055). */
.modal-backdrop {
    z-index: 10990 !important;
}

.modal {
    z-index: 11000 !important;
}

/* Inline markdown link styling — subtle, only the link itself is coloured. */
.message-bubble .chat-md-link,
.AIChatBox .chat-md-link {
    color: #2563eb;
    text-decoration: underline;
    text-underline-offset: 2px;
    word-break: break-word;
}
.message-bubble .chat-md-link:hover,
.AIChatBox .chat-md-link:hover {
    color: #1d4ed8;
}

/* Markdown horizontal rule inside chat bubbles. */
.message-bubble .chat-md-hr,
.AIChatBox .chat-md-hr {
    border: 0;
    border-top: 1px solid #e5e7eb;
    margin: 10px 0;
    height: 0;
}
.AIChatBox #chatInput{
    position: relative;
}
/* Constrain inline-rendered chat media */
.chat-image-container {
    max-width: 400px;
    margin-bottom: 8px;
}

.chat-image {
    width: 100%;
    height: auto;
    max-width: 400px;
    max-height: 300px;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    cursor: pointer;
    display: block;
    transition: transform 0.2s;
}

.chat-image:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.image-caption,
.video-caption {
    margin-top: 8px;
    font-size: 0.9em;
    color: #666;
    word-wrap: break-word;
}

.chat-video-container {
    max-width: 400px;
    margin-bottom: 8px;
}

.video-thumbnail {
    width: 100%;
    height: auto;
    max-width: 400px;
    max-height: 300px;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    cursor: pointer;
    display: block;
    transition: transform 0.2s;
}

.video-thumbnail:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Responsive image/video sizing for mobile */
@media (max-width: 576px) {
    .chat-image-container,
    .chat-video-container {
        max-width: 100%;
    }
    
    .chat-image,
    .video-thumbnail {
        max-width: 100%;
        max-height: 250px;
    }
}

.myctai{
    max-height: calc(-220px + 90vh) !important;
}

/* ========================================
   Deal Chief sidebar lists (match Friends / Business chat)
   ======================================== */

#ai-accordion-panels {
    padding: 0;
    max-height: none;
}

#ai-accordion-panels .sidebar-section {
    background: var(--bg-white, #fff);
    border-bottom: 1px solid #eef0f4;
}

#ai-accordion-panels .sidebar-section-body {
    max-height: 28vh;
    overflow-y: auto;
}

#ai-accordion-panels .sidebar-section-body.collapsed {
    max-height: 0 !important;
    overflow: hidden;
}

#ai-customer-chats-card[hidden],
body:not(.dc-business-user) #ai-customer-chats-card {
    display: none !important;
}

#ai-recent-list,
#ai-customer-list,
#ai-companies-list {
    padding: 0;
}

#ai-accordion-panels .userListChat.ai-recent-item,
#ai-accordion-panels .userListChat.ai-company-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    margin: 0;
    cursor: pointer;
    border: none;
    border-radius: 0;
    background: var(--bg-white, #fff);
    position: relative;
    gap: 0;
}

#ai-accordion-panels .userListChat.ai-recent-item:hover,
#ai-accordion-panels .userListChat.ai-company-item:hover {
    background: #f5f5f5;
}

#ai-accordion-panels .userListImg.ai-recent-avatar,
#ai-accordion-panels .userListImg.ai-company-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 12px;
    margin-left: 0 !important;
    flex-shrink: 0;
    background: #e0e0e0;
}

#ai-accordion-panels .userListPtag.ai-recent-title,
#ai-accordion-panels .userListPtag.ai-company-name {
    font-size: 14px;
    font-weight: normal;
    color: var(--text-primary, #202124);
    margin: 0;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.4;
    padding-right: 72px;
}

#ai-accordion-panels .userListChat > .timespan,
#ai-recent-list .userListChat > .timespan,
#ai-customer-list .userListChat > .timespan,
#ai-companies-list .userListChat > .timespan {
    position: absolute !important;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    bottom: auto !important;
    font-size: 11px;
    color: #9aa0a6;
    white-space: nowrap;
    background: transparent;
}

#ai-accordion-panels .ai-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 999px;
    background: #e8f0fe;
    color: #1a73e8;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.02em;
    vertical-align: middle;
}

.ai-list-loading,
.ai-list-empty {
    text-align: center;
    padding: 16px;
    color: #9aa0a6;
    font-size: 13px;
}

/* Custom Scrollbar for AI Accordion */
#ai-accordion-panels::-webkit-scrollbar,
.ai-accordion-body::-webkit-scrollbar {
    width: 6px;
}

#ai-accordion-panels::-webkit-scrollbar-track,
.ai-accordion-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#ai-accordion-panels::-webkit-scrollbar-thumb,
.ai-accordion-body::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

#ai-accordion-panels::-webkit-scrollbar-thumb:hover,
.ai-accordion-body::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Responsive adjustments for AI accordion */
@media (max-width: 768px) {
    #ai-accordion-panels {
        padding: 8px;
        max-height: calc(90vh - 180px);
    }
    
    .ai-accordion-header {
        padding: 12px 14px;
    }
    
    .ai-accordion-title {
        font-size: 13px;
    }
    
    .ai-recent-title,
    .ai-company-name {
        font-size: 13px;
    }
    
    .ai-company-avatar {
        width: 36px;
        height: 36px;
    }
}

/* ===== Sales Members Modal (responsive) ===== */
#salesMembersModal .sales-members-modal-dialog {
    max-width: 520px;
    margin: 1.25rem auto;
    width: calc(100% - 1.5rem);
}

#salesMembersModal .sales-members-modal-content {
    max-height: min(88vh, 720px);
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#salesMembersModal .sales-members-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: nowrap;
    padding: 12px 14px;
    border-bottom: 1px solid #eef0f3;
}

#salesMembersModal .sales-members-back-btn {
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    color: #374151;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

#salesMembersModal .sales-members-back-btn[hidden] {
    display: none !important;
}

#salesMembersModal .sales-members-back-btn:hover {
    background: #f3f4f6;
}

#salesMembersModal .sales-members-modal-header .modal-title {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.3;
    font-weight: 600;
}

#salesMembersModal .sales-members-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

#salesMembersModal .sales-members-add-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    white-space: nowrap;
    padding: 0.28rem 0.7rem;
    font-size: 0.8125rem;
    line-height: 1.2;
    border-radius: 8px;
    width: auto !important;
    flex: 0 0 auto !important;
}

#salesMembersModal .sales-members-add-btn[hidden] {
    display: none !important;
}

#salesMembersModal .sales-members-add-label-short {
    display: none;
}

#salesMembersModal .sales-members-modal-body {
    padding: 12px 14px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1 1 auto;
    min-height: 0;
}

#salesMembersModal.is-adding-members .sales-members-list-container {
    display: none !important;
}

#salesMembersModal .friends-list-container-sales {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    height: 100%;
}

#salesMembersModal .friends-list-container-sales[hidden] {
    display: none !important;
}

#salesMembersModal .friends-list-sales-intro {
    padding: 0 2px;
}

#salesMembersModal .friends-list-sales-heading {
    font-size: 0.95rem;
    font-weight: 600;
    color: #111827;
}

#salesMembersModal .friends-list-sales-subtext {
    font-size: 0.8rem;
    color: #6b7280;
}

#salesMembersModal #friendsListForSalesMembers {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
    flex: 1 1 auto;
}

#salesMembersModal .friends-list-sales-search .form-control {
    border-radius: 10px;
    border-color: #e5e7eb;
    font-size: 0.9rem;
    padding: 0.55rem 0.85rem;
}

#salesMembersModal .friends-list-sales-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.78rem;
    color: #6b7280;
    padding: 0 2px;
}

#salesMembersModal .friends-list-sales-count {
    font-weight: 600;
    color: #2563eb;
}

#salesMembersModal .sales-members-list {
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #eef0f3;
}

#salesMembersModal .sales-members-list .list-group-item {
    border-left: 0;
    border-right: 0;
}

#salesMembersModal .sales-members-list .list-group-item:first-child {
    border-top: 0;
}

#salesMembersModal .sales-members-list .list-group-item:last-child {
    border-bottom: 0;
}

#salesMembersModal .sales-member-item {
    gap: 8px;
    padding: 12px 14px;
}

#salesMembersModal .sales-member-avatar,
#salesMembersModal .friend-item-sales-avatar {
    width: 44px;
    height: 44px;
    object-fit: cover;
    flex-shrink: 0;
}

#salesMembersModal .sales-member-name,
#salesMembersModal .friend-item-sales-text .fw-semibold {
    word-break: break-word;
}

#salesMembersModal .sales-member-remove-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

#salesMembersModal .sales-member-remove-label {
    display: none;
}

#salesMembersModal .friend-item-sales {
    border-bottom: 1px solid #eef0f3 !important;
    cursor: pointer;
    transition: background 0.15s ease;
}

#salesMembersModal .friend-item-sales:hover {
    background: #f8fafc;
}

#salesMembersModal .friend-item-sales.is-selected {
    background: #eff6ff;
}

#salesMembersModal .friend-item-sales-check {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin-top: 0;
    flex-shrink: 0;
}

#salesMembersModal .friends-list-items-sales {
    max-height: min(48vh, 380px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid #eef0f3;
    border-radius: 12px;
    background: #fff;
}

#salesMembersModal .sales-members-modal-footer {
    padding: 10px 14px;
    border-top: 1px solid #eef0f3;
    gap: 8px;
    justify-content: flex-end;
}

#salesMembersModal .sales-members-modal-footer[hidden] {
    display: none !important;
}

#salesMembersModal .sales-members-add-footer {
    display: flex;
    align-items: center;
    justify-content: stretch;
}

#salesMembersModal .sales-members-add-footer .btn {
    flex: 1 1 0;
}

@media (max-width: 768px) {
    #salesMembersModal .sales-members-modal-dialog {
        max-width: none;
        width: calc(100% - 1rem);
        margin: 0.5rem auto;
    }

    #salesMembersModal .sales-members-modal-content {
        max-height: calc(100dvh - 1rem);
        border-radius: 14px;
    }

    #salesMembersModal .sales-members-modal-header {
        padding: 10px 12px;
        gap: 8px;
        flex-wrap: nowrap;
    }

    #salesMembersModal .sales-members-modal-header .modal-title {
        font-size: 0.98rem;
        flex: 1 1 auto;
        order: 0;
    }

    #salesMembersModal .sales-members-header-actions {
        width: auto;
        justify-content: flex-end;
        order: 0;
        flex-shrink: 0;
    }

    /* Keep Add compact — never stretch full width */
    #salesMembersModal .sales-members-add-btn {
        flex: 0 0 auto !important;
        width: auto !important;
        min-width: 0;
        padding: 0.25rem 0.55rem;
        font-size: 0.75rem;
        gap: 4px;
    }

    #salesMembersModal .sales-members-add-label {
        display: none;
    }

    #salesMembersModal .sales-members-add-label-short {
        display: inline;
    }

    #salesMembersModal .sales-members-modal-body {
        padding: 10px 12px;
    }

    #salesMembersModal .sales-member-item {
        padding: 10px 12px;
        align-items: center;
    }

    #salesMembersModal .sales-member-avatar,
    #salesMembersModal .friend-item-sales-avatar {
        width: 38px;
        height: 38px;
    }

    #salesMembersModal .friend-item-sales {
        padding: 10px 12px !important;
        gap: 10px !important;
    }

    #salesMembersModal .friends-list-items-sales {
        max-height: min(52vh, 420px);
    }

    #salesMembersModal.is-adding-members .friends-list-items-sales {
        max-height: calc(100dvh - 15.5rem);
    }

    #salesMembersModal .sales-members-modal-footer {
        padding: 8px 12px;
    }

    #salesMembersModal #salesMembersListFooter .btn {
        width: 100%;
    }
}

@media (max-width: 420px) {
    #salesMembersModal .sales-member-remove-label {
        display: none;
    }

    #salesMembersModal .friends-list-sales-heading {
        font-size: 0.9rem;
    }

    #salesMembersModal .friends-list-sales-subtext {
        font-size: 0.75rem;
    }
}

@media (max-width: 768px) and (orientation: landscape) {
    #salesMembersModal .sales-members-modal-content {
        max-height: calc(100dvh - 0.75rem);
    }

    #salesMembersModal .friends-list-items-sales,
    #salesMembersModal.is-adding-members .friends-list-items-sales {
        max-height: 34vh;
    }
}

/* ===== A2I2 Group Info Sidebar ===== */
.group-info-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 10040;
}

.group-info-sidebar-backdrop.is-open {
    display: block;
}

.group-info-sidebar {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    width: min(350px, 100vw);
    height: 100vh;
    height: 100dvh;
    background: #fff;
    box-shadow: -2px 0 16px rgba(0, 0, 0, 0.12);
    z-index: 10050;
    overflow: hidden;
    flex-direction: column;
}

.group-info-sidebar.is-open {
    display: flex !important;
}

.group-info-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    padding-top: calc(14px + env(safe-area-inset-top, 0px));
    border-bottom: 1px solid #eef0f3;
    background: #fff;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 2;
}

.group-info-sidebar-header h5 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: #111827;
    min-width: 0;
}

.group-info-sidebar-close {
    width: 40px;
    height: 40px;
    min-width: 40px;
    padding: 0;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #f8fafc;
    color: #111827;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.group-info-sidebar-close:hover,
.group-info-sidebar-close:focus {
    background: #eef2ff;
    border-color: #c7d2fe;
    color: #1d4ed8;
    outline: none;
}

.group-info-sidebar-close i {
    font-size: 1.1rem;
    line-height: 1;
}

.group-info-sidebar-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}

@media (max-width: 768px) {
    .group-info-sidebar {
        width: 100vw;
        max-width: 100vw;
        left: 0;
        right: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .group-info-sidebar-header {
        padding: 12px 14px;
        padding-top: calc(12px + env(safe-area-inset-top, 0px));
        min-height: 56px;
    }

    .group-info-sidebar-close {
        width: 44px;
        height: 44px;
        min-width: 44px;
        border-radius: 12px;
        background: #111827;
        border-color: #111827;
        color: #fff;
    }

    .group-info-sidebar-close:hover,
    .group-info-sidebar-close:focus {
        background: #1f2937;
        border-color: #1f2937;
        color: #fff;
    }

    body.group-info-sidebar-open {
        overflow: hidden;
    }
}
