/*!
 * © 2025 diaspora.ro — Toate drepturile rezervate.
 * PROTECTIE COPYRIGHT — COD PROPRIETAR CONFIDENTIAL
 * Utilizarea, copierea sau distributia fara acord scris este INTERZISA.
 * NO-AI-TRAINING: Not licensed for AI training datasets.
 * NO-AI-SCRAPING: Automated collection strictly prohibited.
 */
/* ================================================================
   webrtc.css — STEP 12 — Apeluri Audio + Video
   diaspora.ro — Mai 2026
   Full-screen call UI, dark theme, mobile-first
   ================================================================ */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --vc-bg:      #1a1a2e;
  --vc-surface: #16213e;
  --vc-panel:   #0f3460;
  --vc-brand:   #1a73e8;
  --vc-green:   #34a853;
  --vc-red:     #ea4335;
  --vc-muted:   rgba(255,255,255,.5);
  --vc-border:  rgba(255,255,255,.12);
  --vc-r:       16px;
  --vc-ctrl-h:  80px;
}

body {
  background: var(--vc-bg);
  color: #fff;
  font-family: system-ui, -apple-system, sans-serif;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── HEADER ───────────────────────────────────────────────────── */
.vc-header {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  gap: 12px;
  z-index: 10;
  flex-shrink: 0;
}
.vc-back {
  background: rgba(255,255,255,.1);
  border: none; border-radius: 50%;
  width: 36px; height: 36px;
  color: #fff; font-size: 18px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.vc-title { flex: 1; }
.vc-title-name { font-size: 16px; font-weight: 600; }
.vc-title-status { font-size: 12px; color: var(--vc-muted); }
#timer { font-size: 12px; color: var(--vc-green); font-weight: 600; display: none; }

/* ── VIDEO GRID ───────────────────────────────────────────────── */
.vc-grid {
  flex: 1;
  display: grid;
  gap: 4px;
  padding: 4px;
  min-height: 0;
  position: relative;
}

/* Layout dinamic bazat pe numarul de participanti */
.vc-grid[data-peers="1"] { grid-template-columns: 1fr; }
.vc-grid[data-peers="2"] { grid-template-columns: 1fr 1fr; }
.vc-grid[data-peers="3"] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.vc-grid[data-peers="4"] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.vc-grid[data-peers="5"],
.vc-grid[data-peers="6"] { grid-template-columns: 1fr 1fr 1fr; }
.vc-grid[data-peers="7"],
.vc-grid[data-peers="8"] { grid-template-columns: 1fr 1fr 1fr 1fr; }

@media (max-width: 768px) {
  .vc-grid[data-peers="3"],
  .vc-grid[data-peers="4"] { grid-template-columns: 1fr 1fr; }
  .vc-grid[data-peers="5"],
  .vc-grid[data-peers="6"],
  .vc-grid[data-peers="7"],
  .vc-grid[data-peers="8"] { grid-template-columns: 1fr 1fr; }
}

/* ── VIDEO TILE ───────────────────────────────────────────────── */
.vc-tile {
  position: relative;
  background: var(--vc-surface);
  border-radius: var(--vc-r);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
}

.vc-tile video {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}

/* Audio-only: avatar centrat */
.vc-tile.audio-only video { display: none; }

.vc-avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--vc-brand), #43a047);
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; font-weight: 700;
  position: absolute;
}
.vc-tile:not(.audio-only) .vc-avatar { display: none; }

/* Overlay info pe tile */
.vc-tile-label {
  position: absolute;
  bottom: 8px; left: 8px;
  background: rgba(0,0,0,.6);
  border-radius: 8px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 500;
  display: flex; align-items: center; gap: 4px;
}
.vc-tile-muted::after { content: '🔇'; font-size: 11px; }

/* Speaking indicator */
.vc-tile.speaking { outline: 2px solid var(--vc-green); }

/* LOCAL preview (pip) */
.vc-pip {
  position: absolute;
  bottom: 90px; right: 12px;
  width: 120px; height: 90px;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,.3);
  z-index: 20;
  background: var(--vc-surface);
  cursor: move;
}
.vc-pip video { width: 100%; height: 100%; object-fit: cover; }
.vc-pip.audio-only video { display: none; }
.vc-pip .vc-avatar { width: 40px; height: 40px; font-size: 16px; }

/* ── AVATAR ANIMAT (AUDIO) ────────────────────────────────────── */
.vc-ring {
  position: absolute;
  border-radius: 50%;
  border: 3px solid var(--vc-green);
  animation: vcRing 1.5s ease-out infinite;
  opacity: 0;
}
@keyframes vcRing {
  0%   { width: 80px; height: 80px; opacity: 0.8; }
  100% { width: 140px; height: 140px; opacity: 0; }
}

/* ── INCOMING CALL SCREEN ─────────────────────────────────────── */
#incoming-screen {
  display: none;
  position: fixed; inset: 0;
  background: linear-gradient(180deg, #1a1a2e 0%, #0f3460 100%);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  z-index: 100;
}
#incoming-screen.show { display: flex; }

.vc-incoming-avatar {
  width: 100px; height: 100px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--vc-brand), #43a047);
  display: flex; align-items: center; justify-content: center;
  font-size: 42px; font-weight: 700;
  position: relative;
}
.vc-incoming-name { font-size: 24px; font-weight: 700; }
.vc-incoming-type { font-size: 14px; color: var(--vc-muted); }

.vc-incoming-actions {
  display: flex;
  gap: 32px;
  margin-top: 20px;
}
.vc-accept-btn, .vc-reject-btn {
  width: 72px; height: 72px;
  border-radius: 50%;
  border: none;
  font-size: 28px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.15s, filter 0.15s;
  animation: vcPulse 1.5s infinite;
}
.vc-accept-btn { background: var(--vc-green); }
.vc-reject-btn { background: var(--vc-red); animation-delay: 0.5s; }
.vc-accept-btn:hover, .vc-reject-btn:hover { transform: scale(1.1); filter: brightness(1.15); }

@keyframes vcPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(52,168,83,.4); }
  50%       { box-shadow: 0 0 0 16px rgba(52,168,83,0); }
}
.vc-reject-btn { animation-name: vcPulseRed; }
@keyframes vcPulseRed {
  0%, 100% { box-shadow: 0 0 0 0 rgba(234,67,53,.4); }
  50%       { box-shadow: 0 0 0 16px rgba(234,67,53,0); }
}

/* ── CONTROALE ────────────────────────────────────────────────── */
.vc-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: var(--vc-ctrl-h);
  padding: 0 20px;
  background: rgba(0,0,0,.3);
  flex-shrink: 0;
  z-index: 10;
}

.vc-btn {
  width: 52px; height: 52px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,.15);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
  transition: background 0.15s, transform 0.1s;
  position: relative;
}
.vc-btn:hover { background: rgba(255,255,255,.25); }
.vc-btn:active { transform: scale(0.92); }
.vc-btn.active { background: var(--vc-brand); }
.vc-btn.danger { background: var(--vc-red); }
.vc-btn.danger:hover { background: #c62828; }
.vc-btn-label {
  font-size: 9px;
  position: absolute;
  bottom: -18px;
  white-space: nowrap;
  color: var(--vc-muted);
}

/* Buton end call — mai mare */
.vc-btn.end { width: 64px; height: 64px; font-size: 26px; }

/* ── BLUR CANVAS (background blur) ────────────────────────────── */
#blur-canvas { display: none; }

/* ── STATUS BAR ────────────────────────────────────────────────── */
.vc-status {
  text-align: center;
  font-size: 14px;
  color: var(--vc-muted);
  padding: 8px;
  min-height: 32px;
}

/* ── SCREEN SHARE BANNER ───────────────────────────────────────── */
.vc-screenshare-banner {
  display: none;
  background: var(--vc-panel);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 13px;
  color: #fff;
  align-items: center;
  gap: 8px;
  position: absolute;
  top: 12px; left: 50%; transform: translateX(-50%);
  z-index: 30;
}
.vc-screenshare-banner.show { display: flex; }
.vc-stop-share {
  background: var(--vc-red); border: none; border-radius: 6px;
  color: #fff; font-size: 12px; padding: 4px 10px; cursor: pointer;
}

/* ── AUDIO RINGS ANIMATION ─────────────────────────────────────── */
.vc-ring1, .vc-ring2 {
  position: absolute;
  border-radius: 50%;
  border: 2px solid rgba(52,168,83,.4);
}
.vc-ring1 { animation: vcRing 2s ease-out infinite; }
.vc-ring2 { animation: vcRing 2s ease-out 0.6s infinite; }

/* ── TOAST ────────────────────────────────────────────────────── */
.vc-toast {
  position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,.8); color: #fff;
  padding: 8px 18px; border-radius: 20px;
  font-size: 14px; z-index: 200;
  opacity: 0; transition: opacity 0.3s;
  pointer-events: none;
}
.vc-toast.show { opacity: 1; }

/* ── LOADING ──────────────────────────────────────────────────── */
.vc-loading {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 16px; padding: 40px;
  flex: 1;
}
.vc-spinner {
  width: 44px; height: 44px;
  border: 3px solid rgba(255,255,255,.2);
  border-top-color: var(--vc-brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
