.comm-container {
    display: flex;
    height: calc(100vh - 200px);
    gap: 1px;
    background: var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.comm-sidebar {
    width: 300px;
    background: var(--bg-card);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
}

.comm-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-primary);
}

.comm-header h2 {
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 600;
}

.comm-search {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 13px;
}

.comm-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.comm-item {
    padding: 12px;
    margin-bottom: 8px;
    background: var(--bg-secondary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.comm-item:hover {
    background: var(--bg-tertiary);
}

.comm-item.active {
    background: var(--accent-primary);
    color: white;
}

.comm-item-name {
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 14px;
}

.comm-item-preview {
    font-size: 12px;
    opacity: 0.7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.comm-item-time {
    font-size: 11px;
    opacity: 0.6;
    margin-top: 4px;
}

.comm-unread {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

.comm-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
}

.comm-empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
}

.comm-chat-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-card);
}

.comm-chat-title {
    font-weight: 600;
    font-size: 16px;
}

.comm-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.comm-message {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.comm-message.sent {
    justify-content: flex-end;
}

.comm-message-bubble {
    max-width: 60%;
    padding: 12px 16px;
    border-radius: 12px;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.4;
}

.comm-message.sent .comm-message-bubble {
    background: var(--accent-color, var(--accent-primary));
    color: white;
    border-bottom-right-radius: 4px;
}

.comm-message.received .comm-message-bubble {
    background: var(--bg-secondary, #2d2d35);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.comm-message-time {
    font-size: 11px;
    color: var(--text-muted);
    padding: 0 4px;
    align-self: flex-end;
}

.comm-message-status {
    font-size: 11px;
    padding: 0 4px;
    align-self: flex-end;
}

.comm-input-area {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-card);
}

.comm-template-selector {
    margin-bottom: 12px;
}

.comm-template-selector select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 13px;
}

.comm-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.comm-textarea {
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 60px;
}

.comm-textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
}

.comm-char-count {
    font-size: 12px;
    color: var(--text-muted);
    text-align: right;
    display: flex;
    justify-content: flex-end;
    gap: 4px;
    align-items: center;
}

.comm-char-count.warning {
    color: #f59e0b;
}

.comm-char-count.error {
    color: #ef4444;
}

.comm-channel-selector {
    display: flex;
    gap: 8px;
    padding: 8px 0;
}

.comm-channel-btn {
    flex: 1;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
}

.comm-channel-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.comm-channel-btn.active {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.form-control {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 13px;
}

@media (max-width: 768px) {
    .comm-container {
        height: 100%;
        flex-direction: column;
    }

    .comm-sidebar {
        width: 100%;
        max-height: 200px;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .comm-main {
        flex: 1;
    }

    .comm-message-bubble {
        max-width: 80%;
    }
}
