/* Comm Panel - right overlay */
.sfp-comm-panel {
    position: fixed;
    top: 0;
    right: -340px;
    width: 320px;
    height: 100vh;
    background: #fff;
    box-shadow: -2px 0 8px rgba(0,0,0,.15);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
    font-size: 14px;
}

.sfp-comm-panel.open {
    right: 0;
}

/* Header */
.sfp-comm-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #e5e5e5;
    background: #3B4B6B;
    color: #fff;
    flex-shrink: 0;
}

.sfp-comm-panel__title {
    font-weight: 600;
    font-size: 15px;
}

.sfp-comm-panel__close {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    font-size: 18px;
    opacity: .8;
}

.sfp-comm-panel__close:hover { opacity: 1; }

/* Tabs */
.sfp-comm-panel__tabs {
    display: flex;
    border-bottom: 1px solid #e5e5e5;
    flex-shrink: 0;
}

.sfp-comm-panel__tab {
    flex: 1;
    padding: 10px;
    border: none;
    background: none;
    cursor: pointer;
    color: #666;
    font-size: 13px;
    border-bottom: 2px solid transparent;
}

.sfp-comm-panel__tab.active {
    color: #3B4B6B;
    border-bottom-color: #3B4B6B;
    font-weight: 600;
}

/* Tab content */
.sfp-comm-panel__tab-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    position: relative;
}

/* Search */
.sfp-comm-search {
    padding: 6px 0 4px;
}

.sfp-comm-search .form-control {
    font-size: 13px;
    border-radius: 20px;
    padding-left: 12px;
}

/* User list */
.sfp-comm-user-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sfp-comm-user-item {
    display: flex;
    align-items: center;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    gap: 8px;
}

.sfp-comm-user-item:hover {
    background: #f5f5f5;
}

.sfp-comm-user-item__avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #3B4B6B;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.sfp-comm-user-item__info {
    flex: 1;
    min-width: 0;
}

.sfp-comm-user-item__name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sfp-comm-user-item__status {
    font-size: 11px;
    color: #999;
}

.sfp-comm-presence-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.sfp-comm-presence-dot.online { background: #28a745; }
.sfp-comm-presence-dot.offline { background: #ccc; }

/* Unread badge u uživatele */
.sfp-comm-user-unread {
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    background: #dc3545;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    flex-shrink: 0;
}

.sfp-comm-user-item__actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity .15s;
}

.sfp-comm-user-item:hover .sfp-comm-user-item__actions {
    opacity: 1;
}

.sfp-comm-user-item__actions .btn {
    padding: 3px 6px;
    font-size: 13px;
    line-height: 1;
}

/* Room list */
.sfp-comm-room-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.js-room-item {
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}

.js-room-item:hover {
    background: #f5f5f5;
}

/* Chat view */
.sfp-comm-chat {
    display: flex;
    flex-direction: column;
    position: absolute;
    inset: 0;
    background: #fff;
    padding: 8px;
    z-index: 1;
}

.sfp-comm-chat__header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.sfp-comm-chat__back {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #333;
    font-size: 16px;
}

.sfp-comm-chat__name {
    flex: 1;
    font-weight: 600;
    font-size: 14px;
}

.sfp-comm-chat__actions {
    display: flex;
    gap: 4px;
}

.sfp-comm-chat__messages {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 4px 0;
}

.chat-message {
    padding: 6px 10px;
    border-radius: 8px;
    max-width: 90%;
    min-width: 140px;
    word-break: break-word;
}

.chat-message--other {
    background: #f0f0f0;
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

.chat-message--mine {
    background: #3B4B6B;
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

.chat-message.deleted {
    opacity: .5;
    font-style: italic;
}

.chat-message__header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 2px;
}

.chat-sender {
    font-weight: 600;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.chat-time {
    font-size: 11px;
    color: #999;
    white-space: nowrap;
    flex-shrink: 0;
}

.chat-message--mine .chat-time {
    color: rgba(255,255,255,.65);
}

.chat-message--mine .chat-sender {
    color: rgba(255,255,255,.85);
}

.chat-content {
    margin: 0;
    word-break: break-word;
    font-size: 13px;
}

.sfp-comm-chat__typing {
    font-size: 11px;
    color: #999;
    padding: 2px 0;
    min-height: 16px;
    flex-shrink: 0;
}

.sfp-comm-chat__input {
    display: flex;
    gap: 6px;
    padding-top: 8px;
    border-top: 1px solid #eee;
    flex-shrink: 0;
}

.sfp-comm-chat__input .form-control {
    flex: 1;
    font-size: 13px;
}

/* Navbar toggle button */
.sfp-comm-toggle-btn {
    position: relative;
}

.sfp-comm-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #dc3545;
    color: #fff;
    font-size: 10px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    display: none;
}

.sfp-comm-badge.visible {
    display: flex;
}

/* Group modal member list */
.sfp-comm-group-member-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 6px;
}

.sfp-comm-group-member-item {
    padding: 6px 10px;
    border-bottom: 1px solid #f0f0f0;
}

.sfp-comm-group-member-item:last-child {
    border-bottom: none;
}

.sfp-comm-group-member-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    margin: 0;
    width: 100%;
    font-weight: normal;
}

/* Override Bootstrap's position:absolute on form-check-input inside our flex label */
.sfp-comm-group-member-label .form-check-input {
    position: static;
    margin-left: 0;
    flex-shrink: 0;
}

.sfp-comm-group-member-label:hover {
    color: #3B4B6B;
}

.sfp-comm-group-member-name {
    flex: 1;
    font-size: 14px;
}

.sfp-comm-group-selected-count {
    font-size: 12px;
    margin-top: 6px;
    min-height: 18px;
}

/* ============================================
   Call Overlay
   ============================================ */

.call-overlay {
    position: fixed;
    z-index: 2000;
    bottom: 80px;
    right: 20px;
    width: 340px;
    background: #1a1a2e;
    color: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,.4);
    overflow: hidden;
    font-size: 14px;
}

/* Příchozí / Odchozí hovor */
.call-overlay__incoming,
.call-overlay__outgoing {
    padding: 32px 24px;
    text-align: center;
}

.call-overlay__avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(255,255,255,.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin: 0 auto 16px;
}

.call-overlay__caller-name {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 8px;
}

.call-overlay__status {
    font-size: 13px;
    color: rgba(255,255,255,.55);
    margin-bottom: 24px;
}

.call-overlay__incoming-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* Aktivní hovor */
.call-overlay__videos {
    position: relative;
    height: 200px;
    background: #000;
    overflow: hidden;
}

.call-overlay__remote-videos {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #111;
}

.call-overlay__remote-videos video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.call-overlay__local-video {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 80px;
    height: 60px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid rgba(255,255,255,.3);
    z-index: 1;
    background: #333;
}

.call-overlay__controls {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    justify-content: center;
    align-items: center;
    background: #1a1a2e;
}

.call-overlay__ctrl-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,.12);
    color: #fff;
    border: none;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    transition: background .15s;
}

.call-overlay__ctrl-btn:hover {
    background: rgba(255,255,255,.22);
    color: #fff;
}

.call-overlay__ctrl-btn.active {
    background: rgba(220,53,69,.5);
}

.call-overlay__ctrl-btn--hangup {
    background: #dc3545;
    width: 52px;
    height: 52px;
}

.call-overlay__ctrl-btn--hangup:hover {
    background: #c82333;
}

/* Přepínač módu WebRTC / SignalR */
.call-overlay__mode-bar {
    display: flex;
    justify-content: flex-end;
    padding: 6px 10px 0;
}

.call-overlay__mode-toggle {
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.15);
    color: rgba(255,255,255,.7);
    border-radius: 20px;
    padding: 3px 10px;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: background .15s;
}

.call-overlay__mode-toggle:hover {
    background: rgba(255,255,255,.18);
    color: #fff;
}

.call-overlay__mode-toggle.active {
    background: rgba(59, 130, 246, .35);
    border-color: rgba(59, 130, 246, .5);
    color: #93c5fd;
}

.call-overlay__mode-toggle:disabled {
    opacity: .4;
    cursor: default;
    pointer-events: none;
}
