html,
body {
    height: 100%;
}

.chat-layout {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    background: #f8f9fa;
}

.chat-sidebar {
    width: 320px;
    flex: 0 0 320px;
    border-right: 1px solid #dee2e6;
    display: flex;
    flex-direction: column;
    background: #fff;
}

.sidebar-header {
    padding: 12px 16px;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.sidebar-header .user-info {
    min-width: 0;
}

.sidebar-header .user-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-search {
    padding: 8px 12px;
    border-bottom: 1px solid #dee2e6;
    position: relative;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #dee2e6;
    border-top: none;
    z-index: 20;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.search-result-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f1f3f5;
}

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

.search-result-item .name {
    font-weight: 600;
}

.search-result-item .email {
    font-size: 0.82rem;
    color: #6c757d;
}

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

.conversation-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f1f3f5;
}

.conversation-item:hover {
    background: #f1f3f5;
}

.conversation-item.active {
    background: #e7f1ff;
}

.conversation-body {
    flex: 1;
    min-width: 0;
}

.conversation-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-last {
    font-size: 0.85rem;
    color: #6c757d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.unread-badge {
    background: #FFFF00;
    color: #000;
    border-radius: 10px;
    padding: 2px 7px;
    font-size: 0.75rem;
    flex: 0 0 auto;
}

.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.chat-placeholder {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    padding: 20px;
    text-align: center;
}

.chat-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.chat-header {
    padding: 10px 16px;
    border-bottom: 1px solid #dee2e6;
    background: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-header .name {
    font-weight: 600;
}

.chat-header .typing {
    font-size: 0.8rem;
    color: #6c757d;
    min-height: 1.2em;
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.message-row {
    display: flex;
}

.message-row.own {
    justify-content: flex-end;
}

.message-bubble {
    max-width: 72%;
    padding: 8px 12px;
    border-radius: 16px;
    background: #fff;
    border: 1px solid #dee2e6;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.message-row.own .message-bubble {
    background: #FFFF00;
    color: #000;
    border: none;
}

.message-meta {
    font-size: 0.72rem;
    color: #6c757d;
    display: flex;
    gap: 4px;
    align-items: center;
    justify-content: flex-end;
    margin-top: 2px;
}

.message-row.own .message-meta {
    color: #333;
}

.tick.read {
    color: #000;
}

.message-row.own .tick.read {
    color: #000;
}

.chat-input {
    display: flex;
    gap: 8px;
    padding: 10px 16px;
    border-top: 1px solid #dee2e6;
    background: #fff;
}

@media (max-width: 767.98px) {
    .chat-sidebar {
        width: 100%;
        flex-basis: 100%;
    }

    .chat-layout.show-chat .chat-sidebar {
        display: none;
    }

    .chat-layout.show-chat .chat-area {
        display: flex;
    }

    .chat-layout:not(.show-chat) .chat-area {
        display: none;
    }
}

.online-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex: 0 0 auto;
    margin-left: 8px;
    display: inline-block;
}
.online-dot.on { background: #ffff00; border: 1px solid #ccc; }
.online-dot.off { background: #ccc; }

.call-media {
    flex: 1;
    position: relative;
    background: #111;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.remote-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #111;
}
.local-video {
    position: absolute;
    right: 12px;
    bottom: 12px;
    width: 160px;
    height: 110px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #fff;
    background: #000;
}
.call-status {
    position: absolute;
    top: 12px;
    left: 0;
    right: 0;
    text-align: center;
    color: #fff;
    background: rgba(0, 0, 0, 0.5);
    padding: 6px;
}
.call-controls {
    justify-content: center;
    gap: 16px;
}
.call-controls .btn { font-size: 1.4rem; line-height: 1; width: 56px; height: 56px; border-radius: 50%; }
.btn-danger { background: #dc3545; }
