/* Lingvanex Voice section (voice.js). Everything is scoped under .vx. */

.vx { max-width: 920px; margin: 0 auto; }
.vx-head { text-align: center; margin: 8px 0 22px; }
.vx-head h1 { font-size: 30px; font-weight: 780; letter-spacing: -.3px; margin: 0 0 6px; }
.vx-head p { margin: 0; color: var(--text-2); font-size: 16.5px; }

/* ---------- stage: languages + microphone ---------- */
.vx-stage { position: relative; padding: 18px 22px 22px; overflow: hidden; }
.vx-langs {
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: end; gap: 10px;
  padding-bottom: 16px; border-bottom: 1px solid var(--border);
}
.vx-lang { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.vx-lang:last-child { align-items: flex-end; text-align: right; }
.vx-lang-label { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-2); padding: 0 10px; }
.vx-lang-ctl { position: relative; max-width: 100%; }
.vx-lang-btn {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: 42px; padding: 0 10px;
  border: 0; border-radius: 10px; background: none; cursor: pointer; color: var(--text);
  font-size: 17px; font-weight: 650;
}
.vx-lang-btn:hover:not(:disabled), .vx-lang-btn[aria-expanded="true"] { background: var(--surface-2); color: var(--accent); }
.vx-lang-btn:disabled { cursor: default; color: var(--text-2); }
.vx-lang-btn svg { width: 18px; height: 18px; flex: none; color: var(--text-2); }
.vx-lang-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vx-native { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 16px; }
.vx-native:disabled { cursor: default; }
.vx-swap { margin-bottom: 3px; }
.vx-swap:disabled { opacity: .4; cursor: default; }
.vx-swap:disabled:hover { background: transparent; color: var(--text-2); }

.vx-center { display: flex; flex-direction: column; align-items: center; padding: 30px 0 4px; }
.vx-mic-wrap { --lvl: 0; position: relative; width: 132px; height: 132px; display: flex; align-items: center; justify-content: center; }
.vx-mic {
  position: relative; z-index: 2; width: 104px; height: 104px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 18px rgba(53, 89, 240, .32), 0 2px 4px rgba(15, 27, 45, .12);
  transition: background .15s, transform .15s, box-shadow .15s;
}
.vx-mic svg { width: 44px; height: 44px; }
.vx-mic:hover:not(:disabled) { background: var(--accent-hover); transform: scale(1.03); }
.vx-mic:active:not(:disabled) { transform: scale(.97); }
.vx-mic:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 4px; }
.vx-mic:disabled { cursor: default; background: #8fa3f6; box-shadow: none; }
.vx-busy .vx-mic:disabled { background: var(--accent); opacity: .85; }
.vx-recording .vx-mic svg { width: 34px; height: 34px; fill: currentColor; }

/* Halo grows with the input level; rings pulse while recording. */
.vx-halo, .vx-ring { position: absolute; inset: 14px; border-radius: 50%; pointer-events: none; }
.vx-halo { background: var(--accent-soft); transform: scale(1); opacity: 0; transition: opacity .2s; }
.vx-recording .vx-halo { opacity: 1; transform: scale(calc(1.06 + var(--lvl) * .32)); transition: opacity .2s, transform .08s linear; }
.vx-ring { border: 2px solid var(--accent); opacity: 0; }
.vx-recording .vx-ring { animation: vx-pulse 1.8s ease-out infinite; }
.vx-recording .vx-ring2 { animation-delay: .9s; }
@keyframes vx-pulse {
  0% { transform: scale(1); opacity: .55; }
  100% { transform: scale(1.55); opacity: 0; }
}

.vx-meter { display: flex; align-items: center; gap: 4px; height: 24px; margin-top: 10px; visibility: hidden; }
.vx-recording .vx-meter { visibility: visible; }
.vx-meter i { display: block; width: 4px; height: 24px; border-radius: 2px; background: var(--accent); transform: scaleY(.12); transition: transform .06s linear; }
.vx-status { margin-top: 8px; min-height: 24px; font-weight: 600; color: var(--text); text-align: center; }
.vx-timer { min-height: 22px; font-variant-numeric: tabular-nums; color: var(--text-2); font-size: 14.5px; }
.vx-recording .vx-timer::before {
  content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--danger);
  margin-right: 7px; vertical-align: 1px; animation: vx-blink 1s steps(2, start) infinite;
}
@keyframes vx-blink { to { visibility: hidden; } }
.vx-spin {
  width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .35); border-top-color: #fff;
  animation: vx-rot .8s linear infinite;
}
@keyframes vx-rot { to { transform: rotate(360deg); } }

.vx-alt { text-align: center; margin-top: 10px; color: var(--text-2); }
.vx-link {
  border: 0; background: none; padding: 0; color: var(--accent); font-weight: 600; cursor: pointer; text-decoration: underline;
  text-underline-offset: 2px; text-decoration-thickness: 1px;
}
.vx-link:hover { color: var(--accent-hover); }
.vx-link:disabled { color: var(--text-2); cursor: default; text-decoration: none; }
.vx-limit { text-align: center; margin: 6px 0 0; font-size: 13.5px; color: var(--text-2); }

.vx-note {
  max-width: 620px; margin: 16px auto 0; padding: 11px 16px; border-radius: var(--radius-sm); font-size: 14.5px;
  background: var(--accent-soft); color: var(--text); line-height: 1.5;
}
.vx-note-warn { background: var(--warn-soft); }
.vx-note-error { background: var(--danger-soft); color: var(--danger); }
.vx-note a, .vx-note .vx-link { font-weight: 600; }

.vx-drop {
  position: absolute; inset: 0; z-index: 5; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: rgba(234, 238, 254, .94); border: 2px dashed var(--accent); border-radius: var(--radius); color: var(--accent); font-weight: 650;
}
.vx-drop svg { width: 36px; height: 36px; }
.vx-dragging .vx-drop { display: flex; }

/* ---------- results ---------- */
.vx-results { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-top: 16px; }
.vx-panel { display: flex; flex-direction: column; min-width: 0; padding: 10px 6px 12px 18px; }
.vx-panel-out { background: var(--surface-2); }
.vx-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 38px; }
.vx-panel-title { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vx-panel-actions { display: flex; gap: 2px; flex: none; }
.vx-panel-actions .icon-btn.busy { opacity: .6; }
.vx-text {
  font-size: 19px; line-height: 1.5; color: var(--text); padding: 4px 12px 6px 0; min-height: 110px;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
textarea.vx-text { width: 100%; border: 0; outline: none; resize: none; background: transparent; font: inherit; font-size: 19px; }
textarea.vx-text:focus { box-shadow: inset 0 -2px 0 var(--accent-soft); }
.vx-translating .vx-out { opacity: .55; transition: opacity .2s .15s; }
.vx-pending { color: var(--text-2); font-style: italic; }
.vx-panel-foot { font-size: 13px; color: var(--text-2); padding-right: 12px; }
.vx-out-msg a { font-weight: 600; }
.vx-out-err { color: var(--danger); }

/* ---------- session history ---------- */
.vx-history { margin-top: 26px; }
.vx-history-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.vx-history-head h2 { font-size: 18px; margin: 0; }
.vx-history-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.vx-h-btn {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 4px 18px; width: 100%; text-align: left;
  padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
  cursor: pointer; color: var(--text); transition: border-color .15s, background .15s;
}
.vx-h-btn:hover { border-color: var(--border-strong); background: var(--surface-2); }
.vx-h.cur .vx-h-btn { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.vx-h-meta { grid-column: 1 / -1; font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.vx-h-meta time { color: var(--text); margin-right: 8px; font-variant-numeric: tabular-nums; }
.vx-h-src, .vx-h-tgt { font-size: 15px; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.vx-h-tgt { color: var(--text-2); }
.vx-h-tgt em { font-style: italic; }

/* ---------- phones ---------- */
@media (max-width: 760px) {
  .vx-head { margin: 4px 0 16px; }
  .vx-head h1 { font-size: 24px; }
  .vx-head p { font-size: 15px; }
  .vx-stage { padding: 14px 12px 18px; }
  .vx-langs { gap: 4px; }
  .vx-lang-label { padding: 0 6px; font-size: 11.5px; }
  .vx-lang-btn { font-size: 15.5px; padding: 0 6px; height: 40px; }
  .vx-center { padding-top: 22px; }
  .vx-results { grid-template-columns: 1fr; gap: 12px; }
  .vx-text, textarea.vx-text { font-size: 17px; min-height: 90px; }
  .vx-h-btn { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .vx-recording .vx-ring { animation: none; opacity: .4; }
  .vx-recording .vx-timer::before { animation: none; }
  .vx-mic, .vx-halo, .vx-meter i { transition: none; }
}
