/* Base Styles */
/* * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f5f5f5;
    padding: 20px;
    min-height: 100vh;
} */

/* other popup css */
.k-overlay { z-index: 10002 !important;}
.k-widget.k-window { z-index: 10003 !important;}

/* Chat Container */
.chat-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: row-reverse;
    align-items: flex-end;
    gap: 15px;
    z-index: 10008;
}

/* Chat Box */
.chat-box {
    width: 450px;
    height: 600px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    resize: both;
    overflow: hidden;
    /* min-width: 250px; */
    /* min-height: 300px; */
    position: absolute;
    right: 0;
    bottom: 0;
    transition: all 0.3s ease;
}

.chat-box.minimized {
    height: 40px !important;
}

.chat-box-header {
    background-color: #98ca4a;
    color: white;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    position: relative;
    flex-shrink: 0;
    user-select: none;
}

.chat-box-title {
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-box-badge {
    background-color: #2C343F;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.chat-box-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.chat-box-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 20px;
    opacity: 0.8;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-box-btn:hover {
    opacity: 1;
}

.senders-icon {
    cursor: pointer;
    font-size: 16px;
    opacity: 0.8;
    transition: all 0.2s;
    color: white;
}

.senders-icon:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Chat Content */
.chat-content {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Message Styles */
.message {
    max-width: 80%;
    padding: 10px 12px;
    border-radius: 12px;
    position: relative;
    word-wrap: break-word;
    width: 80%;
}

.message-sender {
    align-self: flex-end;
    background-color: #e3f2fd;
    /* background-color: #0084FF; */
    /* color: white; */
    border-bottom-right-radius: 0;
}

.message-receiver {
    align-self: flex-start;
    background-color: #f1f1f1;
    /* background-color: #E4E6EB; */
    border-bottom-left-radius: 0;
}

.message-receiver-highlited {
    align-self: flex-start;
    background-color: #f1f1f1;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
    background-color: #E4E6EB;
    border-bottom-left-radius: 0;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
    justify-content: space-between;
    /* Add this line */
}

.message-user-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: #98ca4a;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.message-user-name {
    font-weight: bold;
    font-size: 13px;
    width: 150px;
    max-width: 200px;
}

.message-time {
    font-size: 11px;
    color: #666;
    /* color: #65676B; */
    width: 110px;
    max-width: 110px;
    text-align: right;
    margin-left: auto;
    /* Push to the end */
}

.message-text {
    font-size: 14px;
    line-height: 1.4;
}

.message-image {
    max-width: 100%;
    max-height: 150px;
    border-radius: 8px;
    margin-top: 5px;
    cursor: pointer;
}

/* Chat Input */
.chat-input-area {
    padding: 10px;
    border-top: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    /* gap: 10px; */
    flex-shrink: 0;
}

.chat-dropdown {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    margin-right: 9px;
    height: min-content;
}

.dropdown-content {
    display: none;
    padding: 10px;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-top: 5px;
    max-height: 200px;
    overflow-y: auto;
}

.dropdown-content.show {
    display: block;
}

.dropdown-item {
    padding: 5px;
    cursor: pointer;
}

.dropdown-item:hover {
    background-color: #f5f5f5;
}

.uploaded-images {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.uploaded-image {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    object-fit: cover;
    cursor: pointer;
    border: 1px solid #ddd;
}

/* Image Viewer */
.image-viewer {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 10005;
    justify-content: center;
    align-items: center;
}

.image-viewer.active {
    display: flex;
}

.image-viewer-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
}

.viewed-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
}

.image-viewer-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 10px;
}

.image-viewer-btn {
    background-color: rgba(255, 255, 255, 0.8);
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
}

.image-viewer-btn:hover {
    background-color: white;
    color: black;
}

.image-viewer-close {
    background-color: #ff4757;
    color: white;
}

.chat-input-container {
    display: flex;
    gap: 8px;
}

.chat-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    resize: both;
    max-height: 100px;
}

.chat-input:focus {
    outline: none;
    border-color: #4267B2;
}

.file-upload-btn {
    background: none;
    border: none;
    color: #4267B2;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: start;
    margin-top: 3px;
    width: 20px;
    padding: 0;
    justify-content: end;
}

.send-btn {
    background: none;
    border: none;
    color: #98ca4a;
    cursor: pointer;
    font-size: 32px;
    display: flex;
    align-items: center;
}

/* Senders Popover */
.senders-popover {
    position: absolute;
    top: calc(100% + 0px);
    right: 0;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 10;
    display: none;
    width: 200px;
}

.senders-popover.show {
    display: block;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.sender-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.sender-item:last-child {
    border-bottom: none;
}

.sender-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: #98ca4a;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.sender-name {
    font-size: 14px;
    flex-grow: 1;
    color: black;
    text-align: left;
    line-height: normal;
}

.sender-link { display: contents;}

.sender-count {
    /* padding: 2px 6px; */
    /* border-radius: 10px; */
    background-color: #2C343F;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

/* Add Chat Button */
#add-chat-btn {
    /* position: fixed; */
    /* bottom: 20px; */
    /* right: 20px; */
    padding: 10px 15px;
    background-color: #98ca4a;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    z-index: 1001;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    margin-bottom: 15px;
}

#add-chat-btn:hover {
    background-color: #2C343F;
}

.image-viewer.active, .image-viewer.collapsible:hover {
    background-color: #555555ad;
}

.chat-input-container.form-container {
    gap: 0;
    margin-bottom: 10px;
}

.form_tag_input {
    width: 164px;
    height: 29px;
}

.bootstrap-tagsinput .tag {
    margin-bottom: 2px;
    display: inline-block;
}

/* Tags Input Suggestions */
.tt-menu {
    width: 100%;
    background: white;
    border: 1px solid #ddd;
    max-height: 150px;
    overflow-y: auto;
}

.tt-suggestion {
    padding: 8px 15px;
    cursor: pointer;
}

.tt-suggestion:hover {
    background-color: #f5f5f5;
}

.typeahead.dropdown-menu li {
    padding: 5px 10px;
    cursor: pointer;
}

.twitter-typeahead {
    width: 100%;
}

.tt-menu {
    width: 100%;
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    max-height: 200px;
    overflow-y: auto;
}

.tt-suggestion {
    padding: 8px 12px;
    cursor: pointer;
}

.tt-suggestion:hover {
    background-color: #f5f5f5;
}

.tag.label-info {
    display: inline-block;
    margin: 2px;
    padding: 5px 8px;
}

.chat-tagsinput {
    display: flex;
}

.tags-add-btn {
    padding: 10px 15px;
    background-color: #2C343F;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    z-index: 1001;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    margin-left: -1px;
    height: min-content;
    z-index: 0;
}

/* Remove any inset properties from .chat-box */
.chat-box {
    position: absolute;
    min-width: 450px;
    /* min-height: 600px; */
    transition: transform 0.05s ease, width 0.05s ease, height 0.05s ease;
    will-change: transform, width, height;
}

/* Uploaded images container */
.uploaded-images {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.uploaded-image-container {
    position: relative;
    display: inline-block;
    margin: 5px;
}

.uploaded-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.remove-image-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ff4757;
    color: white;
    border: none;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

.remove-image-btn:hover {
    background: #ff0000;
    transform: scale(1.1);
}

/* Add these styles to ensure proper resizing behavior */
.chat-box {
    position: absolute;
    min-width: 450px;
    /* min-height: 600px; */
    transition: transform 0.05s ease, width 0.05s ease, height 0.05s ease;
    will-change: transform, width, height;
    overflow: hidden;
    /* Prevent content from overflowing during resize */
}

.resize-handle {
    position: absolute;
    background: transparent;
    z-index: 10;
    touch-action: none;
    /* Improve touch device support */
}

/* Left resize handle */
.resize-handle[data-direction="left"] {
    width: 8px;
    height: 100%;
    left: -4px;
    top: 0;
    cursor: w-resize;
}

/* Right resize handle */
.resize-handle[data-direction="right"] {
    width: 8px;
    height: 100%;
    right: -4px;
    top: 0;
    cursor: e-resize;
}

/* Top resize handle */
.resize-handle[data-direction="top"] {
    width: 100%;
    height: 8px;
    top: -4px;
    left: 0;
    cursor: n-resize;
}

/* Bottom resize handle */
.resize-handle[data-direction="bottom"] {
    width: 100%;
    height: 8px;
    bottom: -4px;
    left: 0;
    cursor: s-resize;
}

/* Top-left resize handle */
.resize-handle[data-direction="top-left"] {
    width: 16px;
    height: 16px;
    top: -8px;
    left: -8px;
    cursor: nw-resize;
}

/* Top-right resize handle */
.resize-handle[data-direction="top-right"] {
    width: 16px;
    height: 16px;
    top: -8px;
    right: -8px;
    cursor: ne-resize;
}

/* Bottom-left resize handle */
.resize-handle[data-direction="bottom-left"] {
    width: 16px;
    height: 16px;
    bottom: -8px;
    left: -8px;
    cursor: sw-resize;
}

/* Bottom-right resize handle */
.resize-handle[data-direction="bottom-right"] {
    width: 16px;
    height: 16px;
    bottom: -8px;
    right: -8px;
    cursor: se-resize;
}

/* Smooth dragging and resizing */
.chat-box {
    transition: transform 0.05s ease, width 0.05s ease, height 0.05s ease;
    will-change: transform, width, height;
    position: absolute;
    min-width: 450px;
    /* min-height: 600px; */
}

.chat-box-header {
    cursor: move;
    user-select: none;
}

/* Textarea improvements */
.chat-input {
    line-height: 1.5;
    min-height: 40px;
    padding: 8px 12px;
    overflow-y: auto;
    resize: both;
}

/* Add these styles for multiple image display */
.uploaded-images {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.uploaded-image-container {
    position: relative;
    width: 80px;
    height: 80px;
}

.uploaded-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.remove-image-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ff4757;
    color: white;
    border: none;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

.remove-image-btn:hover {
    background: #ff0000;
    transform: scale(1.1);
}

.message-images {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.message-image {
    max-width: 150px;
    max-height: 150px;
    border-radius: 8px;
    cursor: pointer;
    object-fit: cover;
}

/* Image Viewer Fixes */
.image-viewer {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    /* Darker background */
    z-index: 10005;
    justify-content: center;
    align-items: center;
}

.image-viewer-content {
    position: relative;
    width: 90%;
    height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.viewed-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.image-viewer-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(255, 255, 255, 0.5);
    border: none;
    color: #2C343F;
    font-size: 2rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10007;
    transition: all 0.2s ease;
    opacity: 0.8;
}

.image-viewer-nav-btn:hover {
    background-color: rgba(255, 255, 255, 0.8);
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
}

.image-viewer-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    /* transform: translateX(-50%); */
    display: flex;
    gap: 10px;
    background: transparent;
    /* Removed the dark background */
    padding: 5px;
    z-index: 10006;
}

.image-viewer-btn {
    background-color: rgba(255, 255, 255, 0.7);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s ease;
}

.image-viewer-btn:hover {
    background-color: white;
    transform: scale(1.1);
}

button#prev-btn {
    left: 30%;
}

button#next-btn {
    right: 30%;
}

/* Message Status Icons */
.message-status {
    /* margin-left: 8px; */
    font-size: 14px;
    display: inline-flex;
    align-items: center;
}

.message-status.pending {
    color: #FFA500;
    /* Orange */
}

.message-status.sent {
    color: #98ca4a;
    /* Green */
}

.message-status.failed {
    color: #ff4757;
    /* Red */
}

.message-status i {
    margin-right: 3px;
}

.fa-spin {
    animation: fa-spin 2s infinite linear;
}

@keyframes fa-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(359deg); }
}


/* Minimized Chat Box */
.chat-box.minimized {
    height: 40px !important;
    overflow: hidden;
}

.chat-box.minimized .chat-content,
.chat-box.minimized .chat-input-area {
    display: none;
}

.chat-box-header {
    cursor: pointer;
    user-select: none;
    position: relative;
}

/* Make sure header is clickable even when minimized */
.chat-box.minimized .chat-box-header {
    cursor: pointer;
}

/* Keep popover visible when mouse is over it */
.senders-popover:hover {
    display: block !important;
}

/* Add these styles to ensure proper constraints */
.chat-box {
    position: fixed;
    max-width: 100vw;
    max-height: 100vh;
    overflow: hidden;
}

.chat-box-header {
    cursor: move;
    user-select: none;
    position: relative;
    z-index: 1;
    /* Ensure header stays above content */
}

/* Prevent header from being hidden */
.chat-box.minimized {
    height: 40px !important;
    min-height: 40px !important;
    overflow: visible !important;
}

.chat-box.minimized .chat-box-header {
    /* height: 40px; */
    position: relative;
    z-index: 10;
}


/* dropdown with search button css start */
#myInput {
    box-sizing: border-box;
    background-image: url('../images/icon_search.png');
    /* background-image: url('../images/searchicon.png'); */
    background-position: 14px 12px;
    background-repeat: no-repeat;
    font-size: 16px;
    padding: 14px 20px 12px 45px;
    border: none;
    border-bottom: 1px solid #ddd;
    margin-bottom: 3px;
    outline: unset !important;
    width: 100%;
}

#myInput:focus {outline: 3px solid #ddd;}

.dropdown.droprow {
    position: relative;
    display: inline-block;
}

.droprow .dropdown-content {
    display: none;
    position: absolute;
    left: -192px;
    /* left: -130px; */
    background-color: white;
    min-width: 335px;
    /* min-width: 230px; */
    max-height: 250px;
    overflow: auto;
    border: 1px solid #ddd;
    z-index: 1;
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.droprow .dropdown-content a {
    color: black;
    padding: 10px 15px;
    text-decoration: none;
    display: contents;
    margin-top: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
}

.dropdown.droprow .dropdown-content .sender-item:hover {
    background-color: #ddd !important;
}

.droprow .show {display: block;}

.chat-btn {
    padding: 10px 12px;
    background-color: #98ca4a;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    z-index: 1001;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.chat-btn:hover {
    /* background-color: #2C343F; */
}




/* For mobile responsiveness */
@media (max-width: 480px) {
    .message-image {
        max-width: 100px;
        max-height: 100px;
    }
}


.chat-content-wrapper {
    position: relative;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-loading-area {
    text-align: center;
    padding: 10px;
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
}

.load-previous-btn {
    background: #4a90e2;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
}

.load-previous-btn:hover {
    background: #3a7bc8;
}

.load-previous-btn:disabled {
    background: #cccccc;
    cursor: not-allowed;
}

.chat-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px;
}

.suggestion-container {
    position: relative;
    width: 100%;
    margin-top: 5px;
    display: none;
}

.suggestion-box {
    position: absolute;
    width: 100%;
    max-height: 200px;
    overflow-y: auto;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 10010;
}

.suggestion {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
}

.suggestion:hover {
    background-color: #f5f5f5;
}

.no-suggestions, .error-suggestions {
    padding: 8px 12px;
    color: #666;
    font-style: italic;
}

.error-suggestions {
    color: #d9534f;
}

.msg-load, .k-msg-load {
    display: none;
}

.table-responsive {
    overflow-x: auto;
}

/* typo start */
.spellcheckeditor {
    width: -webkit-fill-available;
    width: -moz-available;
}

.spellcheckeditor.textarea-type {
    height: 200px;
}

.spellcheckeditor.input-type {
    height: auto;
}

.text-container {
    position: relative;
    width: 100%;
}

.suggestion-dropdown {
    position: absolute;
    background: white;
    border: 1px solid #ccc;
    padding: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    display: none;
}

.suggestion-item {
    padding: 3px 10px;
    cursor: pointer;
}

.suggestion-item:hover,
.suggestion-item.highlighted {
    background-color: #f0f0f0;
}

.highlightLayer {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    color: transparent;
    z-index: 1;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 16px;
    font-family: Arial, sans-serif;
    line-height: 1.5;
    padding: 10px;
    width: calc(100% - 20px);
    overflow: hidden;
}

.misspelled {
    position: relative;
    display: inline;
    text-decoration: red wavy underline;
    cursor: pointer;
}

/* typo end */

/* .dropbtn {
    cursor: pointer;
    background-color: transparent;
    border: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

.dropbtn .dropdown-content {
    display: none;
    position: absolute;
    background-color: #fff;
    min-width: 250px;
    box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.2);
    z-index: 999;
}

.dropbtn .dropdown-content.show {
    display: block;
} */

.dropbtn img {
    pointer-events: none;
}