/* Modern UI improvements */
.tms-container {
    max-width: 1000px;
    margin: 0 auto;
    font-family: 'Segoe UI', Roboto, -apple-system, BlinkMacSystemFont, sans-serif;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border-radius: 12px;
    overflow: hidden;
}

.tms-layout {
    display: flex;
    border: none;
    border-radius: 0;
    overflow: hidden;
    min-height: 600px;
    background-color: #fff;
}

.tms-sidebar {
    width: 30%;
    background-color: #f8f9fa;
    border-right: 1px solid #eaeaea;
    overflow-y: auto;
}

.tms-sidebar h3 {
    padding: 20px;
    margin: 0;
    background-color: #4a89dc;
    color: white;
    font-weight: 500;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.tms-user-list {
    padding: 10px;
}

.tms-user-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 8px;
    margin: 5px 8px;
}

.tms-user-item:hover {
    background-color: #f0f4f8;
    transform: translateY(-2px);
}

.tms-user-item.active {
    background-color: #e8f0fe;
    border-left: 3px solid #4a89dc;
}

.tms-user-item img {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    margin-right: 12px;
    object-fit: cover;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.tms-user-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4a89dc, #5ca9fb);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    margin-right: 12px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.tms-user-info h4 {
    margin: 0 0 5px 0;
    font-size: 16px;
}

.tms-user-info p {
    margin: 0;
    font-size: 12px;
    color: #666;
}

.tms-chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.tms-chat-header-user {
    display: flex;
    align-items: center;
}

.tms-chat-header-user img,
.tms-chat-header-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    margin-right: 10px;
}

.tms-chat-header-avatar {
    background-color: #3498db;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
}

.tms-chat-header {
    padding: 15px 20px;
    background-color: #fff;
    border-bottom: 1px solid #eaeaea;
    box-shadow: 0 2px 4px rgba(0,0,0,0.03);
    position: relative;
}

.tms-chat-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 500;
    color: #333;
}

.tms-messages-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background-color: #f8f9fa;
    background-image: linear-gradient(rgba(255,255,255,0.7) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(255,255,255,0.7) 1px, transparent 1px);
    background-size: 20px 20px;
    scroll-behavior: smooth;
    max-height: 450px;
}

.tms-no-messages {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
    flex-direction: column;
}

.tms-no-messages p {
    margin-top: 10px;
    font-size: 15px;
}

.tms-message {
    margin-bottom: 18px;
    max-width: 75%;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.tms-message-sent {
    margin-left: auto;
    background: linear-gradient(135deg, #4a89dc, #5ca9fb);
    color: white;
    border-radius: 18px 4px 18px 18px;
    padding: 12px 15px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.tms-message-received {
    margin-right: auto;
    background-color: white;
    border-radius: 4px 18px 18px 18px;
    padding: 12px 15px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.tms-message-time {
    font-size: 11px;
    color: rgba(255,255,255,0.8);
    text-align: right;
    margin-top: 5px;
}

.tms-message-received .tms-message-time {
    color: #999;
}

.tms-message-form {
    padding: 15px 20px;
    border-top: 1px solid #eaeaea;
    background-color: #fff;
}

.tms-message-form form {
    display: flex;
    align-items: center;
}

.tms-message-form textarea {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    resize: none;
    height: 45px;
    margin-right: 10px;
    font-family: inherit;
    font-size: 14px;
    transition: border 0.3s ease, box-shadow 0.3s ease;
}

.tms-message-form textarea:focus {
    outline: none;
    border-color: #4a89dc;
    box-shadow: 0 0 0 3px rgba(74, 137, 220, 0.1);
}

.tms-message-form button {
    padding: 0 25px;
    height: 45px;
    background-color: #4a89dc;
    color: white;
    border: none;
    border-radius: 24px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s ease;
}

.tms-message-form button:hover {
    background-color: #3a79cc;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.tms-user-category {
    padding: 12px 15px;
    margin: 10px 0 5px 0;
    font-size: 13px;
    color: #666;
    border-bottom: 1px solid #eee;
    background-color: #f8f9fa;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Add these new styles for the scrollable user sections */
.tms-user-section {
    margin-bottom: 15px;
}

.tms-user-section-content {
    max-height: 300px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.tms-user-section-content::-webkit-scrollbar {
    width: 6px;
}

.tms-user-section-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.tms-user-section-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.tms-user-section-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Mobile adjustments for scrollable sections */
@media (max-width: 768px) {
    .tms-user-section-content {
        max-height: 250px;
    }
}

.tms-search-container {
    padding: 15px;
    position: relative;
    border-bottom: 1px solid #eaeaea;
    background-color: #f8f9fa;
    box-sizing: border-box;
    width: 100%;
}

.tms-search-input {
    width: 100%;
    padding: 12px 40px 12px 15px;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
    box-sizing: border-box;
    background-color: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.tms-search-icon {
    position: absolute;
    right: 25px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    cursor: pointer;
    transition: color 0.3s ease;
}

.tms-search-icon:hover {
    color: #4a89dc;
}

/* Mobile Styles */
@media (max-width: 768px) {
    .tms-layout {
        flex-direction: column;
    }
    
    .tms-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #ddd;
    }
    
    .tms-sidebar.hidden,
    .tms-chat-area.hidden {
        display: none;
    }
    
    .tms-back-button {
        display: inline-block;
        margin-right: 15px;
        cursor: pointer;
        font-weight: 500;
        color: #4a89dc;
        transition: all 0.2s ease;
    }

    .tms-back-button:hover {
        color: #3a79cc;
        transform: translateX(-3px);
    }

    /* Mobile styles improvements */
    @media (max-width: 768px) {
        .tms-container {
            border-radius: 0;
            box-shadow: none;
        }
        
        /* Mobile send button styles - fixed positioning */
        .tms-mobile-send-btn {
            width: 45px !important;
            height: 45px !important;
            border-radius: 50% !important;
            padding: 0 !important;
            display: flex !important;
            align-items: center !important;
            justify-content: center !important;
            box-shadow: 0 3px 8px rgba(0,0,0,0.15) !important;
            position: relative;
        }
        
        .tms-mobile-send-btn i {
            font-size: 18px;
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
        }
        
        /* Fallback for when Font Awesome isn't loaded */
        .tms-mobile-send-btn:after {
            content: "→";
            font-size: 20px;
            display: block;
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
        }
        
        .tms-mobile-send-btn i.fa {
            /* Hide the fallback arrow when Font Awesome is loaded */
            content: "";
        }
        
        .tms-message-form textarea {
            border-radius: 24px;
            padding: 12px 15px;
        }
    }
}

.tms-user-category {
    padding: 10px;
    margin: 10px 0 5px 0;
    font-size: 14px;
    color: #666;
    border-bottom: 1px solid #eee;
    background-color: #f9f9f9;
}

/* Add these new styles for the scrollable user sections */
.tms-user-section {
    margin-bottom: 15px;
}

.tms-user-section-content {
    max-height: 300px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.tms-user-section-content::-webkit-scrollbar {
    width: 6px;
}

.tms-user-section-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.tms-user-section-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.tms-user-section-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Mobile adjustments for scrollable sections */
@media (max-width: 768px) {
    .tms-user-section-content {
        max-height: 250px;
    }
}

.tms-search-container {
    padding: 10px;
    position: relative;
    border-bottom: 1px solid #ddd;
    background-color: #f9f9f9;
    box-sizing: border-box;
    width: 100%;
}

.tms-search-input {
    width: 100%;
    padding: 8px 30px 8px 10px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.tms-search-icon {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    cursor: pointer;
}

/* Mobile Styles */
@media (max-width: 768px) {
    .tms-search-container {
        padding: 8px;
    }
    
    .tms-search-input {
        padding: 6px 30px 6px 10px;
    }
}

/* Add this to ensure proper box sizing for all elements */
.tms-container * {
    box-sizing: border-box;
}

.tms-search-input:focus {
    border-color: #3498db;
}

.tms-user-item.hidden-by-search {
    display: none;
}

.tms-no-search-results {
    padding: 15px;
    text-align: center;
    color: #999;
    font-style: italic;
}

/* Add these new styles at the end of your CSS file */

/* Emoji picker */
.tms-emoji-button {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 0 10px;
    margin-right: 5px;
    transition: transform 0.2s ease;
}

.tms-emoji-button:hover {
    transform: scale(1.2);
}

.tms-emoji-picker {
    position: absolute;
    bottom: 70px;
    right: 70px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    padding: 10px;
    display: flex;
    flex-wrap: wrap;
    width: 200px;
    z-index: 100;
}

.tms-emoji-item {
    font-size: 24px;
    padding: 5px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.tms-emoji-item:hover {
    transform: scale(1.2);
}

/* Message grouping */
.tms-message-grouped {
    margin-top: -10px;
}

.tms-date-separator {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

.tms-date-separator:before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: #e0e0e0;
    z-index: 1;
}

.tms-date-separator span {
    background: #f8f9fa;
    padding: 0 10px;
    font-size: 12px;
    color: #999;
    position: relative;
    z-index: 2;
    border-radius: 10px;
}

/* Typing indicator */
.tms-typing-indicator {
    padding: 10px;
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.tms-typing-indicator span {
    height: 8px;
    width: 8px;
    float: left;
    margin: 0 1px;
    background-color: #9E9EA1;
    display: block;
    border-radius: 50%;
    opacity: 0.4;
}

.tms-typing-indicator span:nth-of-type(1) {
    animation: 1s blink infinite 0.3333s;
}

.tms-typing-indicator span:nth-of-type(2) {
    animation: 1s blink infinite 0.6666s;
}

.tms-typing-indicator span:nth-of-type(3) {
    animation: 1s blink infinite 0.9999s;
}

@keyframes blink {
    50% {
        opacity: 1;
    }
}

/* Empty state icon */
.tms-empty-icon {
    font-size: 40px;
    margin-bottom: 10px;
    opacity: 0.5;
}

/* Message sending state */
.tms-message-sending {
    opacity: 0.7;
}

.tms-message-error {
    opacity: 0.7;
    background: linear-gradient(135deg, #ff6b6b, #ff8e8e) !important;
}

/* Animation for search results */
.tms-user-item {
    transition: all 0.3s ease;
}

.tms-user-item.search-visible {
    animation: fadeInSearch 0.3s ease forwards;
}

@keyframes fadeInSearch {
    from { opacity: 0.5; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Improve scrollbar appearance */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Add these new styles for the last message preview and timestamp */
.tms-user-info .tms-last-message {
    font-size: 12px;
    color: #777;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
    margin-top: 2px;
}

.tms-user-info .tms-message-time {
    font-size: 11px;
    color: #999;
    position: absolute;
    right: 15px;
    top: 15px;
}

.tms-user-item {
    position: relative;
    /* Keep existing styles */
}

/* Add animation for reordering users */
@keyframes highlightNew {
    0% { background-color: rgba(74, 137, 220, 0.2); }
    100% { background-color: transparent; }
}

.tms-user-item.tms-new-message {
    animation: highlightNew 2s ease-out;
}

/* Message grouping */
.tms-message-grouped {
    margin-top: -10px;
}

.tms-date-separator {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

.tms-date-separator:before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: #e0e0e0;
    z-index: 1;
}

.tms-date-separator span {
    background: #f8f9fa;
    padding: 0 10px;
    font-size: 12px;
    color: #999;
    position: relative;
    z-index: 2;
    border-radius: 10px;
}

/* Typing indicator */
.tms-typing-indicator {
    padding: 10px;
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.tms-typing-indicator span {
    height: 8px;
    width: 8px;
    float: left;
    margin: 0 1px;
    background-color: #9E9EA1;
    display: block;
    border-radius: 50%;
    opacity: 0.4;
}

.tms-typing-indicator span:nth-of-type(1) {
    animation: 1s blink infinite 0.3333s;
}

.tms-typing-indicator span:nth-of-type(2) {
    animation: 1s blink infinite 0.6666s;
}

.tms-typing-indicator span:nth-of-type(3) {
    animation: 1s blink infinite 0.9999s;
}

@keyframes blink {
    50% {
        opacity: 1;
    }
}

/* Empty state icon */
.tms-empty-icon {
    font-size: 40px;
    margin-bottom: 10px;
    opacity: 0.5;
}

/* Message sending state */
.tms-message-sending {
    opacity: 0.7;
}

.tms-message-error {
    opacity: 0.7;
    background: linear-gradient(135deg, #ff6b6b, #ff8e8e) !important;
}

/* Animation for search results */
.tms-user-item {
    transition: all 0.3s ease;
}

.tms-user-item.search-visible {
    animation: fadeInSearch 0.3s ease forwards;
}

@keyframes fadeInSearch {
    from { opacity: 0.5; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Improve scrollbar appearance */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Add these new styles for the last message preview and timestamp */
.tms-user-info .tms-last-message {
    font-size: 12px;
    color: #777;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
    margin-top: 2px;
}

.tms-user-info .tms-message-time {
    font-size: 11px;
    color: #999;
    position: absolute;
    right: 15px;
    top: 15px;
}

.tms-user-item {
    position: relative;
    /* Keep existing styles */
}

/* Add animation for reordering users */
@keyframes highlightNew {
    0% { background-color: rgba(74, 137, 220, 0.2); }
    100% { background-color: transparent; }
}

.tms-user-item.tms-new-message {
    animation: highlightNew 2s ease-out;
}

/* Message grouping */
.tms-message-grouped {
    margin-top: -10px;
}

.tms-date-separator {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

.tms-date-separator:before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: #e0e0e0;
    z-index: 1;
}

.tms-date-separator span {
    background: #f8f9fa;
    padding: 0 10px;
    font-size: 12px;
    color: #999;
    position: relative;
    z-index: 2;
    border-radius: 10px;
}

/* Typing indicator */
.tms-typing-indicator {
    padding: 10px;
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.tms-typing-indicator span {
    height: 8px;
    width: 8px;
    float: left;
    margin: 0 1px;
    background-color: #9E9EA1;
    display: block;
    border-radius: 50%;
    opacity: 0.4;
}

.tms-typing-indicator span:nth-of-type(1) {
    animation: 1s blink infinite 0.3333s;
}

.tms-typing-indicator span:nth-of-type(2) {
    animation: 1s blink infinite 0.6666s;
}

.tms-typing-indicator span:nth-of-type(3) {
    animation: 1s blink infinite 0.9999s;
}

@keyframes blink {
    50% {
        opacity: 1;
    }
}

/* Empty state icon */
.tms-empty-icon {
    font-size: 40px;
    margin-bottom: 10px;
    opacity: 0.5;
}

/* Message sending state */
.tms-message-sending {
    opacity: 0.7;
}

.tms-message-error {
    opacity: 0.7;
    background: linear-gradient(135deg, #ff6b6b, #ff8e8e) !important;
}

/* Animation for search results */
.tms-user-item {
    transition: all 0.3s ease;
}

.tms-user-item.search-visible {
    animation: fadeInSearch 0.3s ease forwards;
}

@keyframes fadeInSearch {
    from { opacity: 0.5; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Improve scrollbar appearance */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Add these new styles for the last message preview and timestamp */
.tms-user-info .tms-last-message {
    font-size: 12px;
    color: #777;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
    margin-top: 2px;
}

.tms-user-info .tms-message-time {
    font-size: 11px;
    color: #999;
    position: absolute;
    right: 15px;
    top: 15px;
}

.tms-user-item {
    position: relative;
    /* Keep existing styles */
}

/* Add animation for reordering users */
@keyframes highlightNew {
    0% { background-color: rgba(74, 137, 220, 0.2); }
    100% { background-color: transparent; }
}

.tms-user-item.tms-new-message {
    animation: highlightNew 2s ease-out;
}

/* Message grouping */
.tms-message-grouped {
    margin-top: -10px;
}

.tms-date-separator {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

.tms-date-separator:before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: #e0e0e0;
    z-index: 1;
}

.tms-date-separator span {
    background: #f8f9fa;
    padding: 0 10px;
    font-size: 12px;
    color: #999;
    position: relative;
    z-index: 2;
    border-radius: 10px;
}

/* Typing indicator */
.tms-typing-indicator {
    padding: 10px;
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.tms-typing-indicator span {
    height: 8px;
    width: 8px;
    float: left;
    margin: 0 1px;
    background-color: #9E9EA1;
    display: block;
    border-radius: 50%;
    opacity: 0.4;
}

.tms-typing-indicator span:nth-of-type(1) {
    animation: 1s blink infinite 0.3333s;
}

.tms-typing-indicator span:nth-of-type(2) {
    animation: 1s blink infinite 0.6666s;
}

.tms-typing-indicator span:nth-of-type(3) {
    animation: 1s blink infinite 0.9999s;
}

@keyframes blink {
    50% {
        opacity: 1;
    }
}

/* Empty state icon */
.tms-empty-icon {
    font-size: 40px;
    margin-bottom: 10px;
    opacity: 0.5;
}

/* Message sending state */
.tms-message-sending {
    opacity: 0.7;
}

.tms-message-error {
    opacity: 0.7;
    background: linear-gradient(135deg, #ff6b6b, #ff8e8e) !important;
}

/* Animation for search results */
.tms-user-item {
    transition: all 0.3s ease;
}

.tms-user-item.search-visible {
    animation: fadeInSearch 0.3s ease forwards;
}

@keyframes fadeInSearch {
    from { opacity: 0.5; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Improve scrollbar appearance */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Add these new styles for the last message preview and timestamp */
.tms-user-info .tms-last-message {
    font-size: 12px;
    color: #777;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
    margin-top: 2px;
}

.tms-user-info .tms-message-time {
    font-size: 11px;
    color: #999;
    position: absolute;
    right: 15px;
    top: 15px;
}

.tms-user-item {
    position: relative;
    /* Keep existing styles */
}

/* Add animation for reordering users */
@keyframes highlightNew {
    0% { background-color: rgba(74, 137, 220, 0.2); }
    100% { background-color: transparent; }
}

.tms-user-item.tms-new-message {
    animation: highlightNew 2s ease-out;
}

/* Message grouping */
.tms-message-grouped {
    margin-top: -10px;
}

.tms-date-separator {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

.tms-date-separator:before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: #e0e0e0;
    z-index: 1;
}

.tms-date-separator span {
    background: #f8f9fa;
    padding: 0 10px;
    font-size: 12px;
    color: #999;
    position: relative;
    z-index: 2;
    border-radius: 10px;
}

/* Typing indicator */
.tms-typing-indicator {
    padding: 10px;
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.tms-typing-indicator span {
    height: 8px;
    width: 8px;
    float: left;
    margin: 0 1px;
    background-color: #9E9EA1;
    display: block;
    border-radius: 50%;
    opacity: 0.4;
}

.tms-typing-indicator span:nth-of-type(1) {
    animation: 1s blink infinite 0.3333s;
}

.tms-typing-indicator span:nth-of-type(2) {
    animation: 1s blink infinite 0.6666s;
}

.tms-typing-indicator span:nth-of-type(3) {
    animation: 1s blink infinite 0.9999s;
}

@keyframes blink {
    50% {
        opacity: 1;
    }
}

/* Empty state icon */
.tms-empty-icon {
    font-size: 40px;
    margin-bottom: 10px;
    opacity: 0.5;
}

/* Message sending state */
.tms-message-sending {
    opacity: 0.7;
}

.tms-message-error {
    opacity: 0.7;
    background: linear-gradient(135deg, #ff6b6b, #ff8e8e) !important;
}

/* Animation for search results */
.tms-user-item {
    transition: all 0.3s ease;
}

.tms-user-item.search-visible {
    animation: fadeInSearch 0.3s ease forwards;
}

@keyframes fadeInSearch {
    from { opacity: 0.5; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Improve scrollbar appearance */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Add these new styles for the last message preview and timestamp */
.tms-user-info .tms-last-message {
    font-size: 12px;
    color: #777;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
    margin-top: 2px;
}

.tms-user-info .tms-message-time {
    font-size: 11px;
    color: #999;
    position: absolute;
    right: 15px;
    top: 15px;
}

.tms-user-item {
    position: relative;
    /* Keep existing styles */
}

/* Add animation for reordering users */
@keyframes highlightNew {
    0% { background-color: rgba(74, 137, 220, 0.2); }
    100% { background-color: transparent; }
}

.tms-user-item.tms-new-message {
    animation: highlightNew 2s ease-out;
}

/* Message grouping */
.tms-message-grouped {
    margin-top: -10px;
}

.tms-date-separator {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

.tms-date-separator:before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: #e0e0e0;
    z-index: 1;
}

.tms-date-separator span {
    background: #f8f9fa;
    padding: 0 10px;
    font-size: 12px;
    color: #999;
    position: relative;
    z-index: 2;
    border-radius: 10px;
}

/* Typing indicator */
.tms-typing-indicator {
    padding: 10px;
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.tms-typing-indicator span {
    height: 8px;
    width: 8px;
    float: left;
    margin: 0 1px;
    background-color: #9E9EA1;
    display: block;
    border-radius: 50%;
    opacity: 0.4;
}

.tms-typing-indicator span:nth-of-type(1) {
    animation: 1s blink infinite 0.3333s;
}

.tms-typing-indicator span:nth-of-type(2) {
    animation: 1s blink infinite 0.6666s;
}

.tms-typing-indicator span:nth-of-type(3) {
    animation: 1s blink infinite 0.9999s;
}

@keyframes blink {
    50% {
        opacity: 1;
    }
}

/* Empty state icon */
.tms-empty-icon {
    font-size: 40px;
    margin-bottom: 10px;
    opacity: 0.5;
}

/* Message sending state */
.tms-message-sending {
    opacity: 0.7;
}

.tms-message-error {
    opacity: 0.7;
    background: linear-gradient(135deg, #ff6b6b, #ff8e8e) !important;
}

/* Animation for search results */
.tms-user-item {
    transition: all 0.3s ease;
}

.tms-user-item.search-visible {
    animation: fadeInSearch 0.3s ease forwards;
}

@keyframes fadeInSearch {
    from { opacity: 0.5; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Improve scrollbar appearance */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Add these new styles for the last message preview and timestamp */
.tms-user-info .tms-last-message {
    font-size: 12px;
    color: #777;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
    margin-top: 2px;
}

.tms-user-info .tms-message-time {
    font-size: 11px;
    color: #999;
    position: absolute;
    right: 15px;
    top: 15px;
}

.tms-user-item {
    position: relative;
    /* Keep existing styles */
}

/* Add animation for reordering users */
@keyframes highlightNew {
    0% { background-color: rgba(74, 137, 220, 0.2); }
    100% { background-color: transparent; }
}

.tms-user-item.tms-new-message {
    animation: highlightNew 2s ease-out;
}

/* Message grouping */
.tms-message-grouped {
    margin-top: -10px;
}

.tms-date-separator {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

.tms-date-separator:before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: #e0e0e0;
    z-index: 1;
}

.tms-date-separator span {
    background: #f8f9fa;
    padding: 0 10px;
    font-size: 12px;
    color: #999;
    position: relative;
    z-index: 2;
    border-radius: 10px;
}

/* Typing indicator */
.tms-typing-indicator {
    padding: 10px;
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.tms-typing-indicator span {
    height: 8px;
    width: 8px;
    float: left;
    margin: 0 1px;
    background-color: #9E9EA1;
    display: block;
    border-radius: 50%;
    opacity: 0.4;
}

.tms-typing-indicator span:nth-of-type(1) {
    animation: 1s blink infinite 0.3333s;
}

.tms-typing-indicator span:nth-of-type(2) {
    animation: 1s blink infinite 0.6666s;
}

.tms-typing-indicator span:nth-of-type(3) {
    animation: 1s blink infinite 0.9999s;
}

@keyframes blink {
    50% {
        opacity: 1;
    }
}

/* Empty state icon */
.tms-empty-icon {
    font-size: 40px;
    margin-bottom: 10px;
    opacity: 0.5;
}

/* Message sending state */
.tms-message-sending {
    opacity: 0.7;
}

.tms-message-error {
    opacity: 0.7;
    background: linear-gradient(135deg, #ff6b6b, #ff8e8e) !important;
}

/* Animation for search results */
.tms-user-item {
    transition: all 0.3s ease;
}

.tms-user-item.search-visible {
    animation: fadeInSearch 0.3s ease forwards;
}

@keyframes fadeInSearch {
    from { opacity: 0.5; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Improve scrollbar appearance */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Add these new styles for the last message preview and timestamp */
.tms-user-info .tms-last-message {
    font-size: 12px;
    color: #777;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
    margin-top: 2px;
}

.tms-user-info .tms-message-time {
    font-size: 11px;
    color: #999;
    position: absolute;
    right: 15px;
    top: 15px;
}

.tms-user-item {
    position: relative;
    /* Keep existing styles */
}

/* Add animation for reordering users */
@keyframes highlightNew {
    0% { background-color: rgba(74, 137, 220, 0.2); }
    100% { background-color: transparent; }
}

.tms-user-item.tms-new-message {
    animation: highlightNew 2s ease-out;
}

/* Message grouping */
.tms-message-grouped {
    margin-top: -10px;
}

.tms-date-separator {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

.tms-date-separator:before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: #e0e0e0;
    z-index: 1;
}

.tms-date-separator span {
    background: #f8f9fa;
    padding: 0 10px;
    font-size: 12px;
    color: #999;
    position: relative;
    z-index: 2;
    border-radius: 10px;
}

/* Typing indicator */
.tms-typing-indicator {
    padding: 10px;
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.tms-typing-indicator span {
    height: 8px;
    width: 8px;
    float: left;
    margin: 0 1px;
    background-color: #9E9EA1;
    display: block;
    border-radius: 50%;
    opacity: 0.4;
}

.tms-typing-indicator span:nth-of-type(1) {
    animation: 1s blink infinite 0.3333s;
}

.tms-typing-indicator span:nth-of-type(2) {
    animation: 1s blink infinite 0.6666s;
}

.tms-typing-indicator span:nth-of-type(3) {
    animation: 1s blink infinite 0.9999s;
}

@keyframes blink {
    50% {
        opacity: 1;
    }
}

/* Empty state icon */
.tms-empty-icon {
    font-size: 40px;
    margin-bottom: 10px;
    opacity: 0.5;
}

/* Message sending state */
.tms-message-sending {
    opacity: 0.7;
}

.tms-message-error {
    opacity: 0.7;
    background: linear-gradient(135deg, #ff6b6b, #ff8e8e) !important;
}

/* Animation for search results */
.tms-user-item {
    transition: all 0.3s ease;
}

.tms-user-item.search-visible {
    animation: fadeInSearch 0.3s ease forwards;
}

@keyframes fadeInSearch {
    from { opacity: 0.5; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Improve scrollbar appearance */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Add these new styles for the last message preview and timestamp */
.tms-user-info .tms-last-message {
    font-size: 12px;
    color: #777;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
    margin-top: 2px;
}

.tms-user-info .tms-message-time {
    font-size: 11px;
    color: #999;
    position: absolute;
    right: 15px;
    top: 15px;
}

.tms-user-item {
    position: relative;
    /* Keep existing styles */
}

/* Add animation for reordering users */
@keyframes highlightNew {
    0% { background-color: rgba(74, 137, 220, 0.2); }
    100% { background-color: transparent; }
}

.tms-user-item.tms-new-message {
    animation: highlightNew 2s ease-out;
}

/* Message grouping */
.tms-message-grouped {
    margin-top: -10px;
}

.tms-date-separator {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

.tms-date-separator:before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: #e0e0e0;
    z-index: 1;
}

.tms-date-separator span {
    background: #f8f9fa;
    padding: 0 10px;
    font-size: 12px;
    color: #999;
    position: relative;
    z-index: 2;
    border-radius: 10px;
}

/* Typing indicator */
.tms-typing-indicator {
    padding: 10px;
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.tms-typing-indicator span {
    height: 8px;
    width: 8px;
    float: left;
    margin: 0 1px;
    background-color: #9E9EA1;
    display: block;
    border-radius: 50%;
    opacity: 0.4;
}

.tms-typing-indicator span:nth-of-type(1) {
    animation: 1s blink infinite 0.3333s;
}

.tms-typing-indicator span:nth-of-type(2) {
    animation: 1s blink infinite 0.6666s;
}

.tms-typing-indicator span:nth-of-type(3) {
    animation: 1s blink infinite 0.9999s;
}

@keyframes blink {
    50% {
        opacity: 1;
    }
}

/* Empty state icon */
.tms-empty-icon {
    font-size: 40px;
    margin-bottom: 10px;
    opacity: 0.5;
}

/* Message sending state */
.tms-message-sending {
    opacity: 0.7;
}

.tms-message-error {
    opacity: 0.7;
    background: linear-gradient(135deg, #ff6b6b, #ff8e8e) !important;
}

/* Animation for search results */
.tms-user-item {
    transition: all 0.3s ease;
}

.tms-user-item.search-visible {
    animation: fadeInSearch 0.3s ease forwards;
}

@keyframes fadeInSearch {
    from { opacity: 0.5; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Improve scrollbar appearance */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Add these new styles for the last message preview and timestamp */
.tms-user-info .tms-last-message {
    font-size: 12px;
    color: #777;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
    margin-top: 2px;
}

.tms-user-info .tms-message-time {
    font-size: 11px;
    color: #999;
    position: absolute;
    right: 15px;
    top: 15px;
}

.tms-user-item {
    position: relative;
    /* Keep existing styles */
}

/* Add animation for reordering users */
@keyframes highlightNew {
    0% { background-color: rgba(74, 137, 220, 0.2); }
    100% { background-color: transparent; }
}

.tms-user-item.tms-new-message {
    animation: highlightNew 2s ease-out;
}

/* Message grouping */
.tms-message-grouped {
    margin-top: -10px;
}

.tms-date-separator {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

.tms-date-separator:before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: #e0e0e0;
    z-index: 1;
}

.tms-date-separator span {
    background: #f8f9fa;
    padding: 0 10px;
    font-size: 12px;
    color: #999;
    position: relative;
    z-index: 2;
    border-radius: 10px;
}

/* Typing indicator */
.tms-typing-indicator {
    padding: 10px;
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.tms-typing-indicator span {
    height: 8px;
    width: 8px;
    float: left;
    margin: 0 1px;
    background-color: #9E9EA1;
    display: block;
    border-radius: 50%;
    opacity: 0.4;
}

.tms-typing-indicator span:nth-of-type(1) {
    animation: 1s blink infinite 0.3333s;
}

.tms-typing-indicator span:nth-of-type(2) {
    animation: 1s blink infinite 0.6666s;
}

.tms-typing-indicator span:nth-of-type(3) {
    animation: 1s blink infinite 0.9999s;
}

@keyframes blink {
    50% {
        opacity: 1;
    }
}

/* Empty state icon */
.tms-empty-icon {
    font-size: 40px;
    margin-bottom: 10px;
    opacity: 0.5;
}

/* Message sending state */
.tms-message-sending {
    opacity: 0.7;
}

.tms-message-error {
    opacity: 0.7;
    background: linear-gradient(135deg, #ff6b6b, #ff8e8e) !important;
}

/* Animation for search results */
.tms-user-item {
    transition: all 0.3s ease;
}

.tms-user-item.search-visible {
    animation: fadeInSearch 0.3s ease forwards;
}

@keyframes fadeInSearch {
    from { opacity: 0.5; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Improve scrollbar appearance */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Add these new styles for the last message preview and timestamp */
.tms-user-info .tms-last-message {
    font-size: 12px;
    color: #777;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
    margin-top: 2px;
}

.tms-user-info .tms-message-time {
    font-size: 11px;
    color: #999;
    position: absolute;
    right: 15px;
    top: 15px;
}

.tms-user-item {
    position: relative;
    /* Keep existing styles */
}

/* Add animation for reordering users */
@keyframes highlightNew {
    0% { background-color: rgba(74, 137, 220, 0.2); }
    100% { background-color: transparent; }
}

.tms-user-item.tms-new-message {
    animation: highlightNew 2s ease-out;
}

/* Message grouping */
.tms-message-grouped {
    margin-top: -10px;
}

.tms-date-separator {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

.tms-date-separator:before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: #e0e0e0;
    z-index: 1;
}

.tms-date-separator span {
    background: #f8f9fa;
    padding: 0 10px;
    font-size: 12px;
    color: #999;
    position: relative;
    z-index: 2;
    border-radius: 10px;
}

/* Typing indicator */
.tms-typing-indicator {
    padding: 10px;
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.tms-typing-indicator span {
    height: 8px;
    width: 8px;
    float: left;
    margin: 0 1px;
    background-color: #9E9EA1;
    display: block;
    border-radius: 50%;
    opacity: 0.4;
}

.tms-typing-indicator span:nth-of-type(1) {
    animation: 1s blink infinite 0.3333s;
}

.tms-typing-indicator span:nth-of-type(2) {
    animation: 1s blink infinite 0.6666s;
}

.tms-typing-indicator span:nth-of-type(3) {
    animation: 1s blink infinite 0.9999s;
}

@keyframes blink {
    50% {
        opacity: 1;
    }
}

/* Empty state icon */
.tms-empty-icon {
    font-size: 40px;
    margin-bottom: 10px;
    opacity: 0.5;
}

/* Message sending state */
.tms-message-sending {
    opacity: 0.7;
}

.tms-message-error {
    opacity: 0.7;
    background: linear-gradient(135deg, #ff6b6b, #ff8e8e) !important;
}

/* Animation for search results */
.tms-user-item {
    transition: all 0.3s ease;
}

.tms-user-item.search-visible {
    animation: fadeInSearch 0.3s ease forwards;
}

@keyframes fadeInSearch {
    from { opacity: 0.5; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Improve scrollbar appearance */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Add these new styles for the last message preview and timestamp */
.tms-user-info .tms-last-message {
    font-size: 12px;
    color: #777;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
    margin-top: 2px;
}

.tms-user-info .tms-message-time {
    font-size: 11px;
    color: #999;
    position: absolute;
    right: 15px;
    top: 15px;
}

.tms-user-item {
    position: relative;
    /* Keep existing styles */
}

/* Add animation for reordering users */
@keyframes highlightNew {
    0% { background-color: rgba(74, 137, 220, 0.2); }
    100% { background-color: transparent; }
}

.tms-user-item.tms-new-message {
    animation: highlightNew 2s ease-out;
}

/* Add these new styles for the unread message indicator */
.tms-unread-indicator {
    width: 10px;
    height: 10px;
    background-color: #2ecc71;
    border-radius: 50%;
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    box-shadow: 0 0 0 2px #fff;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.4);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(46, 204, 113, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(46, 204, 113, 0);
    }
}
/* Login Required Message Styling */
.tms-login-required {
    max-width: 500px;
    margin: 40px auto;
    padding: 30px;
    text-align: center;
    background-color: #f8f9fa;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border: 1px solid #eaeaea;
    font-family: 'Segoe UI', Roboto, -apple-system, BlinkMacSystemFont, sans-serif;
}

.tms-login-icon {
    font-size: 48px;
    color: #4a89dc;
    margin-bottom: 20px;
}

.tms-login-required h3 {
    margin: 0 0 15px 0;
    color: #333;
    font-weight: 500;
    font-size: 24px;
}

.tms-login-required p {
    margin: 0;
    color: #666;
    font-size: 16px;
    line-height: 1.5;
}

.tms-login-button {
    display: inline-block;
    margin-top: 20px;
    padding: 10px 30px;
    background-color: #4a89dc;
    color: white !important;
    text-decoration: none;
    border-radius: 24px;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.tms-login-button:hover {
    background-color: #3a79cc;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    text-decoration: none;
}