:root {
    --chat-bubble-own: #e8f5e9;
    --chat-bubble-other: #f1f8ff;
    --chat-text-own: #2e7d32;
    --chat-text-other: #000000;
}

.chat-container {
    display: flex;
    height: calc(100vh - 120px);
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
}

.chat-sidebar {
    width: 300px;
    border-right: 1px solid #eee;
    display: flex;
    flex-direction: column;
    background: #f9f9f9;
}

.chat-sidebar-header {
    padding: 15px;
    border-bottom: 1px solid #eee;
    font-weight: bold;
    background: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

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

.chat-item:hover {
    background: #f0f0f0;
}

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

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

.favorite-star {
    font-size: 0.8rem;
    color: #ccc;
    margin-left: 5px;
    vertical-align: middle;
}

.favorite-star.active {
    color: #ffc107;
}

.chat-item-name {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-item-last {
    font-size: 0.85rem;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
    position: relative;
}

.chat-header {
    padding: 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: #f5f7f9;
}

.message {
    max-width: 80%;
    display: flex;
    flex-direction: column;
}

.message.own {
    align-self: flex-start !important;
    margin-left: 0 !important;
}

.message.other {
    align-self: flex-start !important;
    margin-left: 30px !important;
}

.message.system {
    align-self: center !important;
    max-width: 100%;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
}

.message-time {
    font-size: 0.7rem;
    color: #999;
}

.message-sender {
    font-size: 0.75rem;
    font-weight: bold;
    color: #555;
}

.message-bubble {
    padding: 10px 15px;
    border-radius: 18px;
    position: relative;
    font-size: 0.95rem;
    line-height: 1.4;
    word-break: break-word;
}

.message.own .message-bubble {
    background: var(--chat-bubble-own) !important;
    color: var(--chat-text-own) !important;
    border-bottom-left-radius: 4px;
}

.message.other .message-bubble {
    background: var(--chat-bubble-other) !important;
    color: var(--chat-text-other) !important;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.message.system .message-bubble {
    background: transparent;
    color: #888;
    font-size: 0.8rem;
    text-align: center;
}

.chat-input-area {
    padding: 15px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    align-items: center;
}

.chat-input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
    font-size: 0.95rem;
}

.chat-input:focus {
    border-color: #2196f3;
}

.send-btn {
    background: #2196f3;
    color: #fff;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.send-btn:hover {
    background: #1976d2;
}

.chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #ddd;
    object-fit: cover;
}

/* Dashboard Widget Styles */
.dashboard-chat-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 250px;
    overflow-y: auto;
}

.dashboard-chat-item {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.dashboard-chat-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.dashboard-chat-last {
    font-size: 0.75rem;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    width: 100%;
}

.dashboard-chat-time {
    font-size: 0.7rem;
    color: #999;
    flex-shrink: 0;
    margin-left: 5px;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .chat-sidebar {
        width: 100%;
        position: absolute;
        z-index: 10;
        height: 100%;
        transition: transform 0.3s;
    }

    .chat-sidebar.hidden-mobile {
        transform: translateX(-100%);
    }

    .chat-main {
        width: 100%;
    }

    .back-to-list {
        display: block !important;
    }
}

.back-to-list {
    display: none;
    cursor: pointer;
    padding: 5px;
}

.no-chat-selected {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    flex-direction: column;
    gap: 10px;
}

.no-chat-selected i {
    font-size: 3rem;
}

.chat-context-menu {
    position: fixed;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
    width: 180px;
}

.context-menu-item {
    padding: 10px 15px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.context-menu-item:hover {
    background: #f5f5f5;
}

.context-menu-item.danger {
    color: #d32f2f;
}

.favorite-star {
    font-size: 0.8rem;
    color: #ccc;
    margin-left: 5px;
}

.favorite-star.active {
    color: #fbc02d;
}

.chat-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.chat-modal {
    background: #fff;
    border-radius: 12px;
    width: 95%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    overflow: hidden;
}

.chat-modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid #eee;
    font-weight: 700;
    font-size: 1.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fcfcfc;
}

.chat-modal-body {
    padding: 25px;
    overflow-y: auto;
    flex: 1;
}

.modal-section-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #888;
    margin-bottom: 15px;
    letter-spacing: 0.5px;
}

.new-chat-settings {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 20px;
    margin-bottom: 30px;
    padding-bottom: 25px;
    border-bottom: 1px solid #f0f0f0;
}

.avatar-upload-wrapper {
    position: relative;
    width: 80px;
    height: 80px;
}

.avatar-preview-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed #ccc;
    cursor: pointer;
    overflow: hidden;
    color: #999;
}

.avatar-preview-circle:hover {
    border-color: #2196f3;
    color: #2196f3;
}

.avatar-preview-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#new-chat-avatar {
    display: none;
}

.search-container-large {
    background: #f5f7f9;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.search-input-wrapper {
    display: flex;
    gap: 10px;
    background: #fff;
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.search-input-wrapper select {
    border: none;
    background: #f0f2f5;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    outline: none;
}

.search-input-wrapper input {
    flex: 1;
    border: none;
    padding: 10px;
    font-size: 1rem;
    outline: none;
}

.search-results-large {
    margin-top: 15px;
    max-height: 250px;
    overflow-y: auto;
}

.search-result-item {
    padding: 12px 15px;
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.2s;
    margin-bottom: 5px;
}

.search-result-item:hover {
    background: #e3f2fd;
    transform: translateX(5px);
}

.participant-tag {
    background: #2196f3;
    color: #fff;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(33, 150, 243, 0.3);
}

.participant-tag i {
    cursor: pointer;
    font-size: 0.75rem;
    opacity: 0.8;
}

.participant-tag i:hover {
    opacity: 1;
}

.selected-participants {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
    min-height: 35px;
}

.chat-modal-footer {
    padding: 20px 25px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    background: #fcfcfc;
}

.participant-tag i {
    cursor: pointer;
}

.chat-header-actions {
    margin-left: auto;
    display: flex;
    gap: 15px;
}

.action-icon {
    cursor: pointer;
    color: #666;
    transition: color 0.2s;
}

.action-icon:hover {
    color: #2196f3;
}

/* Enhanced Modal Styles */
.chat-modal-large {
    max-width: 800px !important;
    width: 90% !important;
}

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

.new-chat-settings-row {
    display: flex;
    gap: 20px;
    align-items: center;
}

.form-control-large {
    width: 100%;
    padding: 12px 15px;
    font-size: 1.1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    outline: none;
}

.selected-participants-container {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #eee;
}

.selected-participants {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.participant-tag {
    background: #e3f2fd;
    color: #1976d2;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #bbdefb;
}

.participant-tag i.fa-times-circle {
    cursor: pointer;
    opacity: 0.7;
}

.participant-tag i.fa-times-circle:hover {
    opacity: 1;
}

.search-section-large {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.search-controls {
    display: flex;
    gap: 15px;
}

.search-scope-select {
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #ddd;
    background: #fff;
    min-width: 180px;
}

.search-input-wrapper-large {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon-inside {
    position: absolute;
    left: 15px;
    color: #888;
}

.search-input-large {
    width: 100%;
    padding: 12px 15px 12px 40px;
    font-size: 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    outline: none;
}

.search-results-expanded {
    max-height: 300px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.search-result-item-large {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    gap: 15px;
    cursor: pointer;
    border-bottom: 1px solid #f5f5f5;
    transition: background 0.2s;
}

.search-result-item-large:hover {
    background: #f0f7ff;
}

.result-avatar {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.result-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.group-icon-circle {
    width: 40px;
    height: 40px;
    background: #eceff1;
    color: #607d8b;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.result-info {
    flex: 1;
}

.result-name {
    font-weight: 600;
    color: #333;
}

.result-sub {
    font-size: 0.8rem;
    color: #777;
}

.result-type-tag {
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 700;
}

.result-type-tag.user {
    background: #e1f5fe;
    color: #0288d1;
}

.result-type-tag.group {
    background: #f1f8e9;
    color: #558b2f;
}

.add-icon {
    color: #2196f3;
    font-size: 1.2rem;
    opacity: 0.5;
}

.search-result-item-large:hover .add-icon {
    opacity: 1;
}

.btn-large {
    padding: 12px 30px;
    font-size: 1rem;
    font-weight: 600;
}

.airy-modal {
    padding: 30px !important;
}

.chat-item-time {
    font-size: 0.7rem;
    color: #999;
    white-space: nowrap;
}

.margin-top-1 { margin-top: 10px; }
.margin-top-2 { margin-top: 20px; }
.margin-right-05 { margin-right: 5px; }
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.context-divider {
    border: 0;
    border-top: 1px solid #eee;
    margin: 4px 0;
}

.context-menu-item.danger {
    color: #d32f2f;
}

.favorite-star {
    font-size: 0.8rem;
    color: #ccc;
    margin-left: 5px;
}

.favorite-star.active {
    color: #fbc02d;
}

.context-menu-item.danger:hover {
    background: #ffebee;
}

.attach-btn {
    background: transparent;
    border: none;
    color: #666;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.attach-btn:hover {
    color: #2196f3;
}

.message-attachment {
    margin-top: 8px;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(0,0,0,0.05);
    display: inline-block;
    max-width: 100%;
}

.attachment-image {
    max-width: 100%;
    max-height: 300px;
    display: block;
    cursor: pointer;
}

.attachment-file {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    color: inherit;
    text-decoration: none;
}

.attachment-file i {
    font-size: 1.5rem;
    color: #2196f3;
}

.attachment-info {
    display: flex;
    flex-direction: column;
}

.attachment-name {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.attachment-size {
    font-size: 0.75rem;
    opacity: 0.7;
}

.result-sub {
    font-size: 0.75rem;
    color: #666;
    margin-top: 2px;
}

.search-results-expanded::-webkit-scrollbar {
    width: 6px;
}
.dashboard-chat-list .flex-between {
    min-width: 0;
    width: 100%;
    overflow: hidden;
}

.dashboard-chat-list .flex-between > div {
    min-width: 0;
}

.dashboard-chat-list .text-truncate {
    display: block;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
