/* =============================================
   Topbar — сквозная шапка над колонками
   ============================================= */
.topbar {
    display: none;
    height: var(--topbar-height);
    background: #131526;
    flex-shrink: 0;
    position: relative;
    z-index: 100;
}

.topbar--visible { display: flex; }

body.topbar-visible .app-layout {
    height: calc(100vh - var(--topbar-height));
}

/* Кнопка-иконка ссылки на канал (mobile only) */
.btn--topbar-nav {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,.1);
    border: none;
    color: #a0aec0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background var(--transition), color var(--transition);
}
.btn--topbar-nav:hover { background: rgba(255,255,255,.2); color: #fff; }
.btn--topbar-nav svg   { width: 18px; height: 18px; }

/* На мобильном колонки должны занимать высоту layout, а не весь экран */
@media (max-width: 768px) {
    body.topbar-visible .app-layout {
        height: calc(100dvh - var(--topbar-height));
    }
    body.topbar-visible .col {
        height: calc(100dvh - var(--topbar-height));
        top: 0;
    }
}

/* topbar — единый блок, контент через topbar-voice */
/* =============================================
     Topbar — голосовой индикатор
     ============================================= */
.topbar-voice {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0 12px;
    gap: 12px;
}

.topbar-voice__chat {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #a0aec0;
    font-size: 18px;
    font-weight: 500;
    cursor: pointer;
    min-width: 0;
    flex: 1;
    background: none;
    border: none;
}
.topbar-voice__chat:hover { color: #fff; }

.topbar-voice__chat-icon svg {
    width: 14px;
    height: 14px;
    color: var(--color-green);
    flex-shrink: 0;
}

.topbar-voice__chat-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-voice__status {
    font-size: 11px;
    color: var(--color-green);
    white-space: nowrap;
    flex-shrink: 0;
}

.topbar-voice__controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.btn--topbar-leave {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--color-red);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background var(--transition);
}
.btn--topbar-leave:hover { background: color-mix(in srgb, var(--color-red) 85%, black); }
.btn--topbar-leave svg   { width: 24px; height: 24px; }

.btn--topbar-mic {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,.1);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background var(--transition);
}
.btn--topbar-mic:hover       { background: rgba(255,255,255,.2); }
.btn--topbar-mic.muted       { background: rgba(220,38,38,.25); color: #fca5a5; }
.btn--topbar-mic.muted:hover { background: rgba(220,38,38,.4); }
.btn--topbar-mic svg         { width: 18px; height: 18px; }


/* =============================================
     Chat header — voice badge + voice btn
     ============================================= */
.chat-header__members-wrap {
    display: flex;
    align-items: center;
    gap: 0;
    position: relative;
}

.voice-badge {
    font-size: 11px;
    font-weight: 700;
    color: var(--color-green);
    white-space: nowrap;
    padding-left: 2px;
    line-height: 1;
}

.btn--voice-active {
    color: #dc2626;
}
.btn--voice-active:hover { background: rgba(220,38,38,.08); }

/* =============================================
     Incoming call modal
     ============================================= */
.call-modal-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,.45);
    z-index: 9000;
    backdrop-filter: blur(2px);
}

.call-modal {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 32px 28px 24px;
    width: 280px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-md);
    animation: call-modal-in 200ms ease;
}

@keyframes call-modal-in {
    from { opacity: 0; transform: scale(.9); }
    to   { opacity: 1; transform: scale(1); }
}

.call-modal__avatar-circle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--color-border);
    animation: call-ring-pulse 1.2s ease-in-out infinite;
}

@keyframes call-ring-pulse {
    0%,100% { box-shadow: 0 0 0 0 rgba(22,163,74,.4); }
    50%      { box-shadow: 0 0 0 12px rgba(22,163,74,0); }
}

.call-modal__info {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.call-modal__caller {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-text);
}

.call-modal__chat {
    font-size: 13px;
    color: var(--color-text-muted);
}

.call-modal__label {
    font-size: 12px;
    color: var(--color-green);
    font-weight: 600;
}

.call-modal__actions {
    display: flex;
    gap: 24px;
    margin-top: 8px;
}

.call-modal__btn {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--transition), transform var(--transition);
}
.call-modal__btn:active { transform: scale(.93); }
.call-modal__btn svg    { width: 22px; height: 22px; }

.call-modal__btn--accept  { background: var(--color-green); color: #fff; }
.call-modal__btn--accept:hover  { background: color-mix(in srgb, var(--color-green) 85%, black); }

.call-modal__btn--decline { background: var(--color-red); color: #fff; }
.call-modal__btn--decline:hover { background: color-mix(in srgb, var(--color-red) 85%, black); }

.member-row__call-btn {
    margin-left: auto;
    color: var(--color-green);
    flex-shrink: 0;
}
.member-row__call-btn:hover { background: rgba(22,163,74,.1); }

.member-row__name-wrap {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.member-row__voice-time {
    font-size: 11px;
    color: var(--color-green);
    font-weight: 500;
    line-height: 1.2;
}

/* =============================================
     Contacts — voice state
     ============================================= */
.contact-item__name-wrap {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.contact-voice-mic {
    display: flex;
    align-items: center;
    flex: 0 0 16px;
    color: var(--color-green);
}
.contact-voice-mic svg { width: 14px; height: 14px; }

.contact-voice-mic--muted { color: var(--color-red) !important; }

.contact-voice-time {
    font-size: 11px;
    color: var(--color-green);
    font-weight: 500;
    line-height: 1.2;
}

/* Toast */
.contacts-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: #1a1c22;
    color: #fff;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-size: 13px;
    z-index: 9999;
    pointer-events: none;
    animation: toast-in 200ms ease;
}
@keyframes toast-in {
    from { opacity: 0; transform: translateX(-50%) translateY(8px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
/* =============================================
   Voice bar (col3)
   ============================================= */
.voice-bar { padding: 8px 8px; margin-bottom: 5px; display: flex; flex-direction: column; gap: 6px; }

.btn--voice,
.btn--voice-leave {
  width: 100%;
  justify-content: center;
  gap: 6px;
  font-weight: 600;
  border: none;
}
.btn--voice svg,
.btn--voice-leave svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn--voice        { background: var(--color-green); color: #fff; }
.btn--voice:hover  { background: color-mix(in srgb, var(--color-green) 85%, black); }

.btn--voice-leave       { background: var(--color-red); color: #fff; }
.btn--voice-leave:hover { background: color-mix(in srgb, var(--color-red) 85%, black); }

.btn--voice-call-all       { background: none; color: var(--color-primary); width: 100%; justify-content: center; gap: 6px; margin: 10px 0; }
.btn--voice-call-all:hover { background: color-mix(in srgb, var(--color-primary) 10%, transparent); }
.btn--voice-call-all svg   { width: 16px; height: 16px; flex-shrink: 0; }

/* =============================================
   Member row — voice timer
   ============================================= */
.member-row__name-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.member-row__voice-time {
  font-size: 11px;
  color: var(--color-green);
  font-weight: 500;
  line-height: 1.2;
}

/* =============================================
   Contacts — voice state
   ============================================= */
.contact-item__name-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.contact-voice-mic     { display: flex; align-items: center; flex: 0 0 16px; color: var(--color-green); }
.contact-voice-mic svg { width: 14px; height: 14px; }

.contact-voice-time {
  font-size: 11px;
  color: var(--color-green);
  font-weight: 500;
  line-height: 1.2;
}

/* =============================================
   Toast
   ============================================= */
.contacts-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: #1a1c22;
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  z-index: 9999;
  pointer-events: none;
  animation: toast-in 200ms ease;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* =============================================
   Member row — mic muted
   ============================================= */

/* Lock button in topbar */
.btn--topbar-lock {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,.1);
  color: #a0aec0;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition);
}
.btn--topbar-lock:hover  { background: rgba(255,255,255,.2); color: #fff; }
.btn--topbar-lock.locked { background: rgba(251,191,36,.2); color: #fbbf24; }
.btn--topbar-lock.locked:hover { background: rgba(251,191,36,.35); }
.btn--topbar-lock svg    { width: 18px; height: 18px; }

/* Locked notice above join button */
.voice-locked-notice {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: #f59e0b;
  padding: 4px 8px;
  background: rgba(245,158,11,.1);
  border-radius: var(--radius-sm);
  justify-content: center;
}

.btn--topbar-spk-route {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,.1);
    border: none;
    color: #a0aec0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background var(--transition), color var(--transition);
}
.btn--topbar-spk-route:hover  { background: rgba(255,255,255,.2); color: #fff; }
.btn--topbar-spk-route.loud   { background: rgba(56,189,248,.2); color: #38bdf8; }
.btn--topbar-spk-route.loud:hover { background: rgba(56,189,248,.35); }
.btn--topbar-spk-route svg    { width: 18px; height: 18px; }

.btn--topbar-spk {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,.1);
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition);
}
.btn--topbar-spk:hover      { background: rgba(255,255,255,.2); }
.btn--topbar-spk.muted      { background: rgba(220,38,38,.25); color: #fca5a5; }
.btn--topbar-spk.muted:hover { background: rgba(220,38,38,.4); }
.btn--topbar-spk svg        { width: 19px; height: 19px; }