/**
 * Colloq — Voice Room / Huddle Feature
 * =====================================
 * Voice channel bar, participant avatars, controls, screen share preview.
 * Uses design tokens from design-tokens.css throughout.
 */

/* ===================
   ANIMATIONS
   =================== */

@keyframes colloq-slide-down {
  from {
    opacity: 0;
    max-height: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    max-height: 80px;
    transform: translateY(0);
  }
}

@keyframes colloq-slide-up {
  from {
    opacity: 1;
    max-height: 80px;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    max-height: 0;
    transform: translateY(-8px);
  }
}

@keyframes colloq-speaking-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(90, 122, 106, 0.45);
  }
  70% {
    box-shadow: 0 0 0 5px rgba(90, 122, 106, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(90, 122, 106, 0);
  }
}

@keyframes colloq-active-dot {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

@keyframes colloq-join-pop {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  70% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes colloq-leave-shrink {
  from {
    transform: scale(1);
    opacity: 1;
  }
  to {
    transform: scale(0);
    opacity: 0;
  }
}


/* ===================
   COLLOQ BAR
   Top banner above the message area
   =================== */

.colloq-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-md);
  padding: var(--spacing-sm) var(--spacing-md);
  min-height: 48px;
  max-height: 56px;
  background: var(--color-bg-secondary);
  border-bottom: 1px solid var(--color-border-primary);
  position: relative;
  z-index: var(--z-sticky);
  flex-shrink: 0;

  /* Entrance animation */
  animation: colloq-slide-down 0.25s var(--transition-normal) forwards;
  overflow: hidden;
}

.colloq-bar.leaving {
  animation: colloq-slide-up 0.2s ease forwards;
  pointer-events: none;
}

.colloq-bar-left {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  min-width: 0;
  flex: 1;
}

.colloq-bar-right {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  flex-shrink: 0;
}

/* Status label: small "Colloq" text or live indicator */
.colloq-bar-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-secondary);
  white-space: nowrap;
  user-select: none;
}

.colloq-bar-label .colloq-live-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--color-accent);
  animation: colloq-active-dot 1.5s ease-in-out infinite;
  flex-shrink: 0;
}


/* ===================
   COLLOQ START BUTTON
   Icon button in the channel header toolbar
   =================== */

.colloq-start-btn {
  position: relative;
  width: 32px;
  height: 32px;
  background: none;
  border: 1px solid var(--color-border-primary);
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background-color var(--transition-fast),
    color var(--transition-fast),
    border-color var(--transition-fast);
  padding: 0;
}

.colloq-start-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.colloq-start-btn:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
  border-color: var(--color-border-strong);
}

.colloq-start-btn:active {
  background: var(--color-bg-active);
}

.colloq-start-btn:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

/* Active-colloq indicator: green dot on the button */
.colloq-start-btn .colloq-active-indicator {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--color-accent);
  border: 2px solid var(--color-bg-primary);
  animation: colloq-active-dot 1.5s ease-in-out infinite;
}

/* When colloq is active, subtly tint the button */
.colloq-start-btn.active {
  color: var(--color-accent);
  border-color: var(--color-accent-subtle);
  background: var(--color-accent-subtle);
}

.colloq-start-btn.active:hover {
  background: var(--color-accent-subtle);
  border-color: var(--color-accent);
}


/* ===================
   PARTICIPANT AVATARS
   Overlapping row of small circles
   =================== */

.colloq-participants {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.colloq-participant {
  position: relative;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-full);
  border: 2px solid var(--color-bg-secondary);
  overflow: visible;
  flex-shrink: 0;
  transition: transform var(--transition-fast);

  /* Entrance */
  animation: colloq-join-pop 0.25s ease forwards;
}

/* Overlap: every avatar after the first shifts left */
.colloq-participant + .colloq-participant {
  margin-left: -8px;
}

.colloq-participant:hover {
  z-index: 2;
  transform: translateY(-1px);
}

.colloq-participant img {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-full);
  object-fit: cover;
  display: block;
}

/* Fallback when no avatar image */
.colloq-participant .colloq-avatar-fallback {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: var(--color-white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  line-height: 1;
}

/* Speaking state: green ring with pulse */
.colloq-participant.speaking {
  border-color: var(--color-accent);
  animation: colloq-speaking-pulse 1.4s ease-in-out infinite;
}

/* Muted overlay: small icon badge in bottom-right */
.colloq-participant .colloq-muted-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 14px;
  height: 14px;
  border-radius: var(--radius-full);
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
}

.colloq-participant .colloq-muted-badge svg {
  width: 8px;
  height: 8px;
  color: var(--color-danger);
}

/* Leaving animation */
.colloq-participant.leaving {
  animation: colloq-leave-shrink 0.2s ease forwards;
}

/* Overflow count: "+3" pill */
.colloq-participant-overflow {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-full);
  background: var(--color-bg-tertiary);
  border: 2px solid var(--color-bg-secondary);
  margin-left: -8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-secondary);
  cursor: default;
  flex-shrink: 0;
  user-select: none;
}

/* Names / count text next to avatars */
.colloq-participant-names {
  margin-left: var(--spacing-sm);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}


/* ===================
   CONTROLS
   Mute, Screen Share, Leave
   =================== */

.colloq-controls {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

.colloq-control-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-primary);
  background: var(--color-bg-tertiary);
  color: var(--color-text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition:
    background-color var(--transition-fast),
    color var(--transition-fast),
    border-color var(--transition-fast),
    box-shadow var(--transition-fast);
}

.colloq-control-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.colloq-control-btn:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
  border-color: var(--color-border-strong);
}

.colloq-control-btn:active {
  background: var(--color-bg-active);
}

.colloq-control-btn:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

/* Mute button — default (unmuted) */
.colloq-btn-mute {
  /* inherits base .colloq-control-btn styles */
}

/* Mute button — muted state */
.colloq-btn-mute.muted {
  background: var(--color-danger-subtle);
  border-color: var(--color-danger);
  color: var(--color-danger);
}

.colloq-btn-mute.muted:hover {
  background: var(--color-danger);
  color: var(--color-white);
}

/* Screen share button */
.colloq-btn-screenshare {
  /* inherits base .colloq-control-btn styles */
}

/* Screen share — active state */
.colloq-btn-screenshare.sharing {
  background: var(--color-accent-subtle);
  border-color: var(--color-accent);
  color: var(--color-accent-dark);
}

.colloq-btn-screenshare.sharing:hover {
  background: var(--color-accent);
  color: var(--color-white);
}

/* Leave / hang-up button — solid red (matching Paper design) */
.colloq-btn-leave {
  background: #dc2626;
  border-color: transparent;
  color: var(--color-white);
}

.colloq-btn-leave:hover {
  background: #b91c1c;
  color: var(--color-white);
  border-color: transparent;
}

.colloq-btn-leave:active {
  filter: brightness(0.9);
}

/* Join button — shown instead of leave when not in the colloq */
.colloq-btn-join {
  height: 32px;
  padding: 0 var(--spacing-sm);
  border-radius: var(--radius-full);
  border: none;
  background: var(--color-accent);
  color: var(--color-white);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  font-family: var(--font-sans);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition:
    background-color var(--transition-fast),
    box-shadow var(--transition-fast);
}

.colloq-btn-join svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.colloq-btn-join:hover {
  background: var(--color-accent-dark);
}

.colloq-btn-join:active {
  filter: brightness(0.9);
}

.colloq-btn-join:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(90, 122, 106, 0.35);
}


/* ===================
   SCREEN SHARE PREVIEW
   =================== */

.colloq-screen-share {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  background: var(--color-bg-secondary);
  border-bottom: 1px solid var(--color-border-primary);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.colloq-screen-share:hover {
  background: var(--color-bg-tertiary);
}

.colloq-screen-share-icon {
  width: 16px;
  height: 16px;
  color: var(--color-accent);
  flex-shrink: 0;
}

.colloq-screen-share-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.colloq-screen-share-label strong {
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
}

/* Thumbnail preview of the shared screen */
.colloq-screen-share-preview {
  width: 200px;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-primary);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--color-black);
  position: relative;
}

.colloq-screen-share-preview img,
.colloq-screen-share-preview video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Expand hint on hover */
.colloq-screen-share-preview::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  transition: background var(--transition-fast);
}

.colloq-screen-share-preview:hover::after {
  background: rgba(0, 0, 0, 0.25);
}

/* Expanded / larger view */
.colloq-screen-share-expanded {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: var(--color-bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-xl);
}

.colloq-screen-share-expanded-inner {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-black);
  box-shadow: var(--shadow-xl);
}

.colloq-screen-share-expanded-inner img,
.colloq-screen-share-expanded-inner video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.colloq-screen-share-expanded-close {
  position: absolute;
  top: var(--spacing-md);
  right: var(--spacing-md);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.6);
  border: none;
  color: var(--color-white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
}

.colloq-screen-share-expanded-close:hover {
  background: rgba(0, 0, 0, 0.85);
}

.colloq-screen-share-expanded-close svg {
  width: 18px;
  height: 18px;
}


/* ===================
   UTILITY / STATE MODIFIERS
   =================== */

/* Hidden state (for JS toggling) */
.colloq-bar[hidden],
.colloq-screen-share[hidden] {
  display: none;
}

/* Reduced-motion: disable all animations */
@media (prefers-reduced-motion: reduce) {
  .colloq-bar,
  .colloq-bar.leaving,
  .colloq-participant,
  .colloq-participant.speaking,
  .colloq-participant.leaving,
  .colloq-start-btn .colloq-active-indicator,
  .colloq-bar-label .colloq-live-dot {
    animation: none;
  }

  .colloq-participant.speaking {
    box-shadow: 0 0 0 2px var(--color-accent);
  }
}


/* ===================
   RESPONSIVE
   =================== */

@media (max-width: 640px) {
  .colloq-bar {
    padding: var(--spacing-xs) var(--spacing-sm);
    gap: var(--spacing-sm);
    min-height: 44px;
  }

  /* Hide the text names on small screens, keep avatars */
  .colloq-participant-names {
    display: none;
  }

  .colloq-bar-label span:not(.colloq-live-dot) {
    display: none;
  }

  .colloq-participant {
    width: 26px;
    height: 26px;
  }

  .colloq-participant + .colloq-participant {
    margin-left: -6px;
  }

  .colloq-participant-overflow {
    width: 26px;
    height: 26px;
    font-size: 10px;
  }

  .colloq-control-btn {
    width: 28px;
    height: 28px;
  }

  .colloq-control-btn svg {
    width: 14px;
    height: 14px;
  }

  .colloq-btn-join {
    height: 28px;
    padding: 0 var(--spacing-xs);
    font-size: var(--font-size-xs);
  }

  .colloq-screen-share-preview {
    width: 140px;
  }
}


/* ===================
   DURATION TIMER
   Shown next to the Colloq label
   =================== */

.colloq-timer {
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  user-select: none;
}


/* ===================
   DIVIDER
   Vertical separator in the bar
   =================== */

.colloq-bar-divider {
  width: 1px;
  height: 20px;
  background: var(--color-border-primary);
  flex-shrink: 0;
}


/* ===================
   SIDEBAR INDICATOR
   Green dot + count next to channels with active Colloqs
   =================== */

.colloq-sidebar-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  flex-shrink: 0;
}

.colloq-sidebar-indicator .colloq-sidebar-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: #22c55e;
  animation: colloq-active-dot 1.5s ease-in-out infinite;
}

.colloq-sidebar-indicator .colloq-sidebar-count {
  font-size: 10px;
  font-weight: 500;
  color: #22c55e;
  line-height: 1;
}


/* ===================
   CHAT NOTICE
   "X started a Colloq" inline in message stream
   =================== */

.colloq-chat-notice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 0;
}

.colloq-chat-notice-line {
  flex: 1;
  height: 1px;
  background: #d4edda;
}

.colloq-chat-notice-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: #f0faf0;
  border-radius: 12px;
  border: 1px solid #d4edda;
  white-space: nowrap;
}

.colloq-chat-notice-pill svg {
  width: 12px;
  height: 12px;
  color: #22c55e;
  flex-shrink: 0;
}

.colloq-chat-notice-pill .colloq-notice-text {
  font-size: 12px;
  font-weight: 500;
  color: #16a34a;
}

.colloq-chat-notice-pill .colloq-notice-time {
  font-size: 11px;
  color: #86efac;
}

/* Dark mode adjustments for chat notice */
:root[data-theme="dark"] .colloq-chat-notice-line {
  background: rgba(34, 197, 94, 0.15);
}

:root[data-theme="dark"] .colloq-chat-notice-pill {
  background: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.2);
}

:root[data-theme="dark"] .colloq-chat-notice-pill .colloq-notice-text {
  color: #4ade80;
}

:root[data-theme="dark"] .colloq-chat-notice-pill .colloq-notice-time {
  color: rgba(74, 222, 128, 0.5);
}


/* ===================
   FLOATING PIP (Picture-in-Picture)
   Persistent mini card that survives page navigation
   =================== */

@keyframes colloq-pip-enter {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes colloq-pip-exit {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(12px) scale(0.95);
  }
}

.colloq-pip {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  width: 280px;
  background: #1c1c1e;
  border-radius: 14px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.35),
    0 2px 8px rgba(0, 0, 0, 0.2);
  color: #fff;
  overflow: hidden;
  animation: colloq-pip-enter 0.25s ease forwards;
  user-select: none;
  font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
}

.colloq-pip.leaving {
  animation: colloq-pip-exit 0.2s ease forwards;
  pointer-events: none;
}

.colloq-pip[hidden] {
  display: none;
}

/* -- Pip Header: channel name + live dot + timer -- */
.colloq-pip-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px 8px;
  cursor: grab;
}

.colloq-pip-header:active {
  cursor: grabbing;
}

.colloq-pip-live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  flex-shrink: 0;
  animation: colloq-active-dot 1.5s ease-in-out infinite;
}

.colloq-pip-channel {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.colloq-pip-timer {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}

/* -- Pip Participants Row -- */
.colloq-pip-participants {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 4px 14px 10px;
}

.colloq-pip-participant {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid #1c1c1e;
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
}

.colloq-pip-participant + .colloq-pip-participant {
  margin-left: -6px;
}

.colloq-pip-participant img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
}

.colloq-pip-participant .colloq-pip-avatar-fallback {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  line-height: 1;
}

.colloq-pip-participant.speaking {
  border-color: #22c55e;
  animation: colloq-speaking-pulse 1.4s ease-in-out infinite;
}

.colloq-pip-participant-count {
  margin-left: 8px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  white-space: nowrap;
}

/* -- Pip Controls Row -- */
.colloq-pip-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px 12px;
}

.colloq-pip-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.colloq-pip-btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.colloq-pip-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.colloq-pip-btn:active {
  background: rgba(255, 255, 255, 0.08);
}

/* Muted state */
.colloq-pip-btn.muted {
  background: rgba(220, 38, 38, 0.25);
  color: #f87171;
}

.colloq-pip-btn.muted:hover {
  background: rgba(220, 38, 38, 0.4);
  color: #fca5a5;
}

/* Expand button — pushes to right */
.colloq-pip-btn-expand {
  margin-left: auto;
}

/* Leave button — red */
.colloq-pip-btn-leave {
  background: #dc2626;
  color: #fff;
}

.colloq-pip-btn-leave:hover {
  background: #b91c1c;
  color: #fff;
}

.colloq-pip-btn-leave:active {
  background: #991b1b;
}

/* -- Pip Responsive -- */
@media (max-width: 640px) {
  .colloq-pip {
    bottom: 12px;
    right: 12px;
    left: 12px;
    width: auto;
  }
}

/* Reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .colloq-pip,
  .colloq-pip.leaving,
  .colloq-pip-live-dot,
  .colloq-pip-participant.speaking {
    animation: none;
  }
  .colloq-pip-participant.speaking {
    box-shadow: 0 0 0 2px #22c55e;
  }
}


/* ===================
   SETTINGS OVERLAY + PANEL
   Fixed overlay modal for audio device & volume controls
   =================== */

.colloq-settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: colloq-settings-backdrop-enter 0.15s ease;
}

.colloq-settings-overlay.closing {
  animation: colloq-settings-backdrop-exit 0.15s ease forwards;
  pointer-events: none;
}

@keyframes colloq-settings-backdrop-enter {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes colloq-settings-backdrop-exit {
  from { opacity: 1; }
  to { opacity: 0; }
}

.colloq-settings-panel {
  width: 320px;
  max-width: calc(100vw - 32px);
  background: var(--color-bg-primary, #fff);
  border: 1px solid var(--color-border-primary, #e0e0e0);
  border-radius: 14px;
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.18),
    0 4px 12px rgba(0, 0, 0, 0.1);
  padding: 20px;
  font-size: 13px;
  color: var(--color-text-primary, #111);
  animation: colloq-settings-enter 0.2s ease;
}

/* Dark variant when triggered from pip mode */
.colloq-settings-overlay.pip-mode .colloq-settings-panel {
  background: #2c2c2e;
  border-color: rgba(255, 255, 255, 0.1);
  color: #fff;
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.45),
    0 4px 12px rgba(0, 0, 0, 0.25);
}

@keyframes colloq-settings-enter {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.colloq-settings-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.colloq-settings-close {
  width: 22px;
  height: 22px;
  border: none;
  background: none;
  color: inherit;
  opacity: 0.5;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-size: 16px;
  line-height: 1;
  padding: 0;
}

.colloq-settings-close:hover {
  opacity: 1;
  background: rgba(128, 128, 128, 0.15);
}

.colloq-settings-group {
  margin-bottom: 14px;
}

.colloq-settings-group:last-child {
  margin-bottom: 0;
}

.colloq-settings-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.6;
  margin-bottom: 6px;
  display: block;
}

.colloq-settings-select {
  width: 100%;
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid var(--color-border-primary);
  background: var(--color-bg-secondary);
  color: inherit;
  font-size: 12px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 28px;
}

.colloq-settings-overlay.pip-mode .colloq-settings-select {
  border-color: rgba(255, 255, 255, 0.12);
  background-color: rgba(255, 255, 255, 0.08);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23aaa' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

.colloq-settings-select:focus {
  border-color: var(--color-accent, #5a7a6a);
}

.colloq-settings-select option {
  background: var(--color-bg-primary);
  color: var(--color-text-primary);
}

.colloq-settings-overlay.pip-mode .colloq-settings-select option {
  background: #2c2c2e;
  color: #fff;
}

/* Volume slider */
.colloq-settings-slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.colloq-settings-slider-row svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.5;
}

.colloq-settings-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: rgba(128, 128, 128, 0.25);
  outline: none;
  cursor: pointer;
}

.colloq-settings-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-accent, #5a7a6a);
  border: none;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.colloq-settings-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.colloq-settings-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-accent, #5a7a6a);
  border: none;
  cursor: pointer;
}

.colloq-settings-overlay.pip-mode .colloq-settings-slider::-webkit-slider-thumb {
  background: #22c55e;
}

.colloq-settings-overlay.pip-mode .colloq-settings-slider::-moz-range-thumb {
  background: #22c55e;
}

.colloq-settings-slider-value {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  opacity: 0.6;
  min-width: 28px;
  text-align: right;
}

/* Separator line */
.colloq-settings-separator {
  height: 1px;
  background: rgba(128, 128, 128, 0.2);
  margin: 12px 0;
}

/* Settings button active state */
.colloq-btn-settings.active {
  background: var(--color-accent-subtle);
  border-color: var(--color-accent);
  color: var(--color-accent-dark);
}

.colloq-pip-btn-settings.active {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
}
