/*
 * LVChat — Discord-style web chat (PHP + SQLite)
 *
 * Copyright (C) LVChat contributors
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, version 3 of the License.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * SPDX-License-Identifier: AGPL-3.0-only
 */

/* LVChat Messenger — voice UI styles (shared with messenger-web). */

#lvcvoice-btn.lvcvoice-in-voice {
  color: var(--green, #22c55e);
  border-color: rgba(34, 197, 94, 0.5);
  background: rgba(34, 197, 94, 0.12);
}
#lvcvoice-btn.lvcvoice-in-call {
  color: var(--red, #ef4444);
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.12);
}

/* Call pill in the header actions row. */
.lvcvoice-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--muted, #9ca3af);
}
.lvcvoice-pill .lvcvoice-pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green, #22c55e);
}
.lvcvoice-pill.ringing .lvcvoice-pill-dot {
  background: var(--amber, #f59e0b);
  animation: lvcvoice-pulse 1s infinite;
}
@keyframes lvcvoice-pulse { 50% { opacity: 0.3; } }

/* Voice pane pinned to the bottom-right of the chat. */
.lvcvoice-pane {
  position: fixed;
  right: 16px;
  bottom: 64px;
  width: 300px;
  max-width: calc(100vw - 32px);
  z-index: 200;
  background: var(--surface-1, #232428);
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
  color: var(--text, #e5e7eb);
  font-size: 13px;
  overflow: hidden;
}
.lvcvoice-pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border, rgba(255,255,255,0.08));
  background: var(--surface-2, #2b2d31);
  font-weight: 600;
}
.lvcvoice-pane-body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.lvcvoice-pane-row { display: flex; align-items: center; gap: 8px; }
.lvcvoice-pane-meta { color: var(--muted, #9ca3af); font-size: 12px; }

/* Video grid + controls inside the voice pane. */
.lvcvoice-videos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 6px;
}
.lvcvoice-tile {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border, rgba(255,255,255,0.08));
}
.lvcvoice-tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.lvcvoice-tile.muted { opacity: 0.5; }
.lvcvoice-tile::after {
  content: attr(data-label);
  position: absolute;
  left: 4px;
  bottom: 4px;
  font-size: 10px;
  color: #fff;
  background: rgba(0,0,0,0.55);
  border-radius: 4px;
  padding: 1px 6px;
}
.lvcvoice-tile.self { border-color: rgba(88,101,242,0.6); }
.lvcvoice-controls { display: flex; gap: 6px; flex-wrap: wrap; }

/* Incoming call overlay (top center). */
.lvcvoice-ring {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  background: var(--surface-1, #232428);
  border: 1px solid var(--border, rgba(255,255,255,0.1));
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.6);
  padding: 14px 18px;
  min-width: 260px;
  text-align: center;
  color: var(--text, #e5e7eb);
}
.lvcvoice-ring-title { font-weight: 700; margin-bottom: 2px; }
.lvcvoice-ring-peer { color: var(--muted, #9ca3af); font-size: 12px; margin-bottom: 12px; }
.lvcvoice-ring-actions { display: flex; justify-content: center; gap: 10px; }

/* Toast for voice errors / info. */
.lvcvoice-toast {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 400;
  background: var(--surface-1, #232428);
  border: 1px solid var(--border, rgba(255,255,255,0.12));
  color: var(--text, #e5e7eb);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.5);
}

/* ── Voice & video settings modal ─────────────────────────────────────── */
.lvcvoice-pane-head-actions { display: flex; align-items: center; gap: 6px; }
.lvcvoice-settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 320;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
}
.lvcvoice-settings-overlay[hidden] { display: none !important; }
.lvcvoice-settings-card {
  width: 460px;
  max-width: calc(100vw - 32px);
  background: var(--surface-1, #232428);
  border: 1px solid var(--border, rgba(255,255,255,0.1));
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.6);
  color: var(--text, #e5e7eb);
  font-size: 13px;
  overflow: hidden;
}
.lvcvoice-settings-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: calc(80vh - 60px);
  overflow-y: auto;
}
.st-section { display: flex; flex-direction: column; gap: 8px; }
.st-label { color: var(--muted, #9ca3af); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; }
.st-field { display: flex; flex-direction: column; gap: 4px; color: var(--text, #e5e7eb); font-size: 12px; }
.st-select {
  background: var(--surface-2, #2b2d31);
  border: 1px solid var(--border, rgba(255,255,255,0.1));
  color: var(--text, #e5e7eb);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 12px;
  width: 100%;
}
.st-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.st-actions { justify-content: flex-end; margin-top: 2px; }
.st-camvideo {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border, rgba(255,255,255,0.08));
}
.st-meter-wrap { display: inline-flex; align-items: center; gap: 6px; margin-left: 6px; }
.st-meter-wrap meter { width: 120px; height: 14px; }
.st-meter-val { color: var(--amber, #f59e0b); font-size: 11px; min-width: 32px; }
.st-bg { flex: 1; }
.st-bg.on { background: var(--blurple, #5865f2); border-color: var(--blurple, #5865f2); color: #fff; }
.st-imgprev {
  width: 100%;
  max-height: 160px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border, rgba(255,255,255,0.1));
  margin-top: 4px;
}
.st-hint { color: var(--muted, #9ca3af); font-size: 11px; line-height: 1.5; }
#lvcvoice-settings input[type="file"] { font-size: 12px; color: var(--muted, #9ca3af); }
#lvcvoice-settings input[type="range"] { width: 100%; }
