/* 음성회의 상태 모니터 + 공통 다크 UI 스타일 (2026-03-14) */

.co-overlay {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 380px;
  max-height: 520px;
  background: #1a1a2e;
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.45);
  z-index: 10010;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #e0e0e0;
  transition: width 0.25s ease, max-height 0.25s ease;
}

.co-overlay.co-minimized {
  max-height: 44px;
  overflow: hidden;
}
.co-overlay.co-minimized .co-tabs,
.co-overlay.co-minimized .co-body,
.co-overlay.co-minimized .co-input-bar,
.co-overlay.co-minimized .co-upload-preview {
  display: none;
}

.co-overlay.co-with-sidebar {
  width: 680px;
}

/* 모니터 모드 (채팅 입력 바 없음, 더 컴팩트) */
.co-overlay.co-monitor {
  width: 340px;
  max-height: 480px;
  z-index: 10020;
}

.co-overlay.co-embedded {
  position: relative;
  left: auto;
  right: auto;
  top: auto;
  bottom: auto;
  width: 100%;
  max-height: 320px;
  margin: 8px 0;
  border-radius: 10px;
  z-index: 11;
}

.co-overlay.co-embedded .co-header {
  cursor: default;
}

/* ── 헤더 (드래그 핸들) ─────────────────────────────── */
.co-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #16213e;
  cursor: move;
  user-select: none;
  flex-shrink: 0;
  border-bottom: 1px solid #0f3460;
}

.co-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}

.co-header-left .co-status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 6px #22c55e;
}
.co-header-left .co-status-dot.co-offline {
  background: #6b7280;
  box-shadow: none;
}
.co-header-left .co-live-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 6px #ef4444;
  animation: co-pulse 1.5s infinite;
  display: none;
}
.co-header-left .co-live-dot.co-live-active {
  display: inline-block;
}
@keyframes co-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.co-header-actions {
  display: flex;
  gap: 4px;
}

.co-header-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  width: 28px; height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
}
.co-header-btn:hover {
  background: #334155;
  color: #fff;
}

/* 참여자 수 뱃지 */
.co-member-badge {
  font-size: 11px;
  color: #94a3b8;
  background: #0f172a;
  padding: 2px 7px;
  border-radius: 10px;
}

/* ── 탭 바 ──────────────────────────────────────────── */
.co-tabs {
  display: flex;
  background: #111827;
  flex-shrink: 0;
}

.co-tab {
  flex: 1;
  padding: 7px 0;
  text-align: center;
  font-size: 11px;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  border: none;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  background: none;
}
.co-tab:hover { color: #94a3b8; }
.co-tab.co-tab-active {
  color: #60a5fa;
  border-bottom-color: #3b82f6;
}

/* ── 본문 (탭 패널 래퍼) ────────────────────────────── */
.co-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.co-main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ── 탭 패널 공통 ───────────────────────────────────── */
.co-pane {
  flex: 1;
  overflow-y: auto;
  display: none;
}
.co-pane.co-pane-active {
  display: flex;
  flex-direction: column;
}

/* ── 채팅 패널 ──────────────────────────────────────── */
.co-messages {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.co-msg {
  max-width: 85%;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.co-msg-other { align-self: flex-start; }
.co-msg-mine  { align-self: flex-end; }

.co-msg-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #64748b;
}
.co-msg-mine .co-msg-header {
  justify-content: flex-end;
}

.co-msg-type-icon {
  font-size: 12px;
}

.co-msg-bubble {
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
}

.co-msg-other .co-msg-bubble {
  background: #0f172a;
  border-top-left-radius: 4px;
}
.co-msg-mine .co-msg-bubble {
  background: #1e3a5f;
  border-top-right-radius: 4px;
}

/* 음성 메시지 스타일 */
.co-msg-voice .co-msg-bubble {
  border-left: 2px solid #22c55e;
}

/* interim (실시간 인식중) */
.co-msg-interim {
  align-self: flex-start;
  max-width: 85%;
}
.co-msg-interim .co-msg-bubble {
  background: rgba(59, 130, 246, 0.08);
  border-left: 2px solid #3b82f6;
  opacity: 0.7;
  font-style: italic;
  color: #94a3b8;
}

/* 시스템 메시지 */
.co-msg-system {
  align-self: center;
  max-width: 90%;
  text-align: center;
  font-size: 11px;
  color: #64748b;
  padding: 4px 10px;
  background: #0f172a;
  border-radius: 8px;
}

/* 새 메시지 알림 바 */
.co-new-msg-bar {
  text-align: center;
  padding: 4px;
  background: #172554;
  color: #60a5fa;
  font-size: 11px;
  cursor: pointer;
  display: none;
  flex-shrink: 0;
}
.co-new-msg-bar:hover { background: #1e3a5f; }

/* ── 이미지/파일 메시지 ────────────────────────────── */
.co-msg-img {
  max-width: 220px;
  max-height: 180px;
  border-radius: 8px;
  cursor: pointer;
  display: block;
  margin-bottom: 4px;
}
.co-msg-file-link {
  display: inline-block;
  padding: 6px 10px;
  background: rgba(59,130,246,0.12);
  border-radius: 6px;
  color: #60a5fa;
  font-size: 12px;
  text-decoration: none;
  margin-bottom: 4px;
  word-break: break-all;
}
.co-msg-file-link:hover { background: rgba(59,130,246,0.22); }

/* ── 업로드 프리뷰 ────────────────────────────────── */
.co-upload-preview {
  padding: 6px 12px;
  background: #0f172a;
  border-top: 1px solid #0f3460;
  flex-shrink: 0;
}
.co-preview-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.co-preview-name {
  font-size: 12px;
  color: #94a3b8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.co-preview-cancel {
  background: transparent;
  border: none;
  color: #ef4444;
  cursor: pointer;
  font-size: 14px;
  flex-shrink: 0;
}
.co-upload-progress {
  margin-top: 4px;
  height: 3px;
  background: #1e293b;
  border-radius: 2px;
  overflow: hidden;
}
.co-progress-bar {
  height: 100%;
  background: #3b82f6;
  transition: width 0.2s;
}

/* ── 입력 바 ────────────────────────────────────────── */
.co-input-bar {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: #16213e;
  border-top: 1px solid #0f3460;
  flex-shrink: 0;
}

.co-attach-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}
.co-attach-btn:hover { color: #fff; background: #334155; }

.co-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #334155;
  border-radius: 20px;
  background: #0f172a;
  color: #e0e0e0;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}
.co-input:focus { border-color: #3b82f6; }
.co-input::placeholder { color: #64748b; }

.co-send-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: none;
  background: #3b82f6;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  transition: background 0.15s;
}
.co-send-btn:hover { background: #2563eb; }
.co-send-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── 오디오 레벨 패널 ──────────────────────────────── */
.co-levels {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
}

.co-level-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.co-level-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
  position: relative;
}

.co-level-avatar.co-speaking {
  box-shadow: 0 0 0 2px #22c55e, 0 0 10px rgba(34,197,94,0.4);
}

.co-level-avatar.co-muted::after {
  content: '';
  position: absolute;
  width: 3px; height: 18px;
  background: #ef4444;
  border-radius: 2px;
  transform: rotate(45deg);
}

.co-level-info {
  flex: 1;
  min-width: 0;
}

.co-level-name {
  font-size: 12px;
  font-weight: 500;
  color: #e0e0e0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.co-level-name .co-me-tag {
  font-size: 9px;
  color: #3b82f6;
  margin-left: 4px;
}

.co-level-bar-bg {
  height: 4px;
  background: #1e293b;
  border-radius: 2px;
  margin-top: 3px;
  overflow: hidden;
}

.co-level-bar {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #22c55e, #84cc16);
  width: 0%;
  transition: width 0.08s linear;
}

.co-level-bar.co-bar-high {
  background: linear-gradient(90deg, #f59e0b, #ef4444);
}

.co-level-db {
  font-size: 10px;
  color: #64748b;
  width: 32px;
  text-align: right;
  flex-shrink: 0;
}

.co-levels-empty,
.co-stt-empty {
  text-align: center;
  color: #64748b;
  font-size: 12px;
  padding: 30px 0;
}

/* ── STT 자막 패널 ─────────────────────────────────── */
.co-stt-lines {
  padding: 10px 12px;
}

.co-stt-line {
  display: flex;
  gap: 6px;
  padding: 4px 0;
  font-size: 12px;
  line-height: 1.5;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.co-stt-nick {
  font-weight: 600;
  flex-shrink: 0;
  white-space: nowrap;
}

.co-stt-text {
  flex: 1;
  word-break: break-word;
}

.co-stt-time {
  font-size: 10px;
  color: #475569;
  flex-shrink: 0;
  align-self: flex-end;
}

.co-stt-interim {
  opacity: 0.55;
  font-style: italic;
}

.co-stt-indicator {
  font-size: 10px;
  color: #3b82f6;
  margin-left: 4px;
}

/* ── 합의 사이드바 ──────────────────────────────────── */
.co-sidebar {
  width: 300px;
  border-left: 1px solid #0f3460;
  display: none;
  flex-direction: column;
  background: #111827;
}
.co-overlay.co-with-sidebar .co-sidebar {
  display: flex;
}

.co-sidebar-header {
  padding: 10px 14px;
  background: #16213e;
  border-bottom: 1px solid #0f3460;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.co-sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

.co-sidebar-empty {
  text-align: center;
  padding: 30px 10px;
  color: #64748b;
  font-size: 12px;
}

.co-agreement-item {
  padding: 8px 10px;
  margin-bottom: 4px;
  background: #0f172a;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s;
}
.co-agreement-item:hover { background: #1e293b; }
.co-agreement-item-title {
  font-weight: 500;
  color: #e0e0e0;
  margin-bottom: 2px;
}
.co-agreement-item-status {
  font-size: 10px;
  color: #64748b;
}

/* ── 반응형 ─────────────────────────────────────────── */
@media (max-width: 480px) {
  .co-overlay {
    width: calc(100vw - 16px);
    right: 8px;
    bottom: 8px;
    max-height: 70vh;
    border-radius: 12px;
  }
  .co-overlay.co-with-sidebar {
    width: calc(100vw - 16px);
  }
  .co-sidebar { width: 50%; }
}
