/* Voice-call panel (panels/voice-call-panel.php) — Meridian re-skin of the
 * legacy softphone window. Structure/class names are shared with
 * healtharea/assets/voice-call.js (do not rename them), only presentation
 * differs: glass surfaces + this theme's own tokens instead of the legacy
 * dashboard's flat dark palette.
 *
 * z-index above the panel rail/drawers (--lx-z-panel) — an active call must
 * never be covered by a drawer the coordinator opened behind it.
 */

.vc-window {
  position: fixed;
  right: var(--lx-s-5);
  bottom: var(--lx-s-5);
  width: 320px;
  z-index: calc(var(--lx-z-panel) + 5);
  display: none;
  flex-direction: column;
  background: var(--lx-panel-surface);
  backdrop-filter: var(--lx-glass-blur);
  border: 1px solid var(--lx-glass-border);
  border-radius: var(--lx-r-lg);
  box-shadow: var(--lx-shadow-overlay);
  color: var(--lx-t1);
  font-family: var(--lx-f-ui);
  font-size: var(--lx-fs-sm);
  overflow: hidden;
  user-select: none;
}
.vc-window.open { display: flex; }
.vc-window.dragging { transition: none; cursor: grabbing; }

/* ── Header: drag handle + identity ─────────────────────────────────────── */
.vc-head {
  display: flex;
  align-items: center;
  gap: var(--lx-s-2);
  padding: var(--lx-s-3) var(--lx-s-4);
  cursor: grab;
  background: var(--lx-glass-subtle);
  border-bottom: 1px solid var(--lx-glass-border);
}
.vc-window.dragging .vc-head { cursor: grabbing; }

.vc-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--lx-t4);
  flex-shrink: 0;
}
.vc-state-ringing     .vc-dot { background: var(--lx-warning); animation: vc-pulse 1s infinite; }
.vc-state-connecting  .vc-dot { background: var(--lx-warning); animation: vc-pulse 1s infinite; }
.vc-state-in_progress .vc-dot { background: var(--lx-success); }
.vc-state-on_hold     .vc-dot { background: var(--lx-warning); }
.vc-state-ended       .vc-dot { background: var(--lx-t4); }
.vc-state-failed      .vc-dot { background: var(--lx-danger); }
.vc-state-incoming    .vc-dot { background: var(--lx-accent); animation: vc-pulse .7s infinite; }

@keyframes vc-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

.vc-who { flex: 1; min-width: 0; }
.vc-name {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vc-sub {
  font-size: var(--lx-fs-xs);
  color: var(--lx-t3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vc-timer {
  font-variant-numeric: tabular-nums;
  font-size: var(--lx-fs-xs);
  color: var(--lx-t3);
  flex-shrink: 0;
}
.vc-min {
  background: none;
  border: 0;
  color: var(--lx-t3);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 var(--lx-s-1);
  border-radius: var(--lx-r-sm);
}
.vc-min:hover { color: var(--lx-t1); background: var(--lx-fill); }

/* ── Body ───────────────────────────────────────────────────────────────── */
.vc-body { padding: var(--lx-s-3) var(--lx-s-4); }
.vc-window.min .vc-body,
.vc-window.min .vc-actions { display: none; }

.vc-status {
  font-size: var(--lx-fs-xs);
  color: var(--lx-t3);
  margin-bottom: var(--lx-s-3);
  min-height: 1.05em;
}
.vc-status.vc-err { color: var(--lx-danger); }

.vc-rec {
  display: none;
  align-items: center;
  gap: var(--lx-s-1);
  font-size: var(--lx-fs-xs);
  color: var(--lx-danger);
  margin-bottom: var(--lx-s-2);
}
.vc-rec.on { display: flex; }
.vc-rec-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--lx-danger);
  animation: vc-pulse 1.2s infinite;
}

/* ── Controls ───────────────────────────────────────────────────────────── */
.vc-controls {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--lx-s-2);
}
.vc-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--lx-s-2) 2px;
  border-radius: var(--lx-r-sm);
  border: 1px solid var(--lx-glass-border);
  background: var(--lx-fill);
  color: var(--lx-t1);
  font-size: var(--lx-fs-micro);
  cursor: pointer;
  transition: background var(--lx-t-fast) var(--lx-ease), border-color var(--lx-t-fast) var(--lx-ease);
}
.vc-btn:hover:not(:disabled) { background: var(--lx-fill-hover); }
.vc-btn:disabled { opacity: .35; cursor: not-allowed; }
.vc-btn .vc-ico { display: flex; }
.vc-btn .vc-ico .lx-icon { color: var(--lx-t2); }
.vc-btn.active { border-color: var(--lx-accent); background: var(--lx-accent-soft); }
.vc-btn.rec.active { border-color: var(--lx-danger); background: var(--lx-danger-soft); }

.vc-actions {
  display: flex;
  gap: var(--lx-s-2);
  padding: 0 var(--lx-s-4) var(--lx-s-4);
}
.vc-end, .vc-answer {
  flex: 1;
  padding: var(--lx-s-2);
  border-radius: var(--lx-r-sm);
  border: 0;
  font-weight: 700;
  font-size: var(--lx-fs-xs);
  cursor: pointer;
  color: #fff;
  transition: filter var(--lx-t-fast) var(--lx-ease);
}
.vc-end    { background: var(--lx-danger); }
.vc-end:hover { filter: brightness(1.1); }
.vc-answer { background: var(--lx-success); }
.vc-answer:hover { filter: brightness(1.1); }

/* ── Keypad ─────────────────────────────────────────────────────────────── */
.vc-keypad {
  display: none;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--lx-s-2);
  margin-top: var(--lx-s-3);
}
.vc-keypad.open { display: grid; }
.vc-key {
  padding: var(--lx-s-2);
  border-radius: var(--lx-r-sm);
  border: 1px solid var(--lx-glass-border);
  background: var(--lx-fill);
  color: var(--lx-t1);
  font-size: var(--lx-fs-base);
  cursor: pointer;
}
.vc-key:hover { background: var(--lx-fill-hover); }

/* ── Outcome strip ──────────────────────────────────────────────────────── */
.vc-outcome { display: none; }
.vc-outcome.open { display: block; }
.vc-outcome-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--lx-s-1);
  margin-bottom: var(--lx-s-2);
}
.vc-chip {
  padding: var(--lx-s-1) var(--lx-s-2);
  border-radius: var(--lx-r-full);
  border: 1px solid var(--lx-glass-border);
  background: var(--lx-fill);
  color: var(--lx-t1);
  font-size: var(--lx-fs-micro);
  cursor: pointer;
}
.vc-chip.sel { border-color: var(--lx-accent); background: var(--lx-accent-soft); }
.vc-note {
  width: 100%;
  box-sizing: border-box;
  padding: var(--lx-s-2);
  border-radius: var(--lx-r-sm);
  border: 1px solid var(--lx-glass-border);
  background: var(--lx-fill);
  color: var(--lx-t1);
  font: inherit;
  font-size: var(--lx-fs-xs);
  resize: vertical;
  min-height: 46px;
}

/* Mobile: a floating window would cover the page, so pin it to the bottom. */
@media (max-width: 560px) {
  .vc-window {
    left: var(--lx-s-2);
    right: var(--lx-s-2);
    bottom: var(--lx-s-2);
    width: auto;
    max-width: none;
  }
  .vc-head { cursor: default; }
}
