/* ================================================================
   CRITICA — AI Hologram Assistant
   style.css — Full UI stylesheet for 2-panel LED event layout
================================================================ */

/* ── Variables ───────────────────────────────────────────────── */
:root {
  --cyan:         #00eaff;
  --cyan-dim:     rgba(0, 234, 255, 0.10);
  --cyan-mid:     rgba(0, 234, 255, 0.22);
  --cyan-glow:    rgba(0, 234, 255, 0.45);
  --blue:         #0047ff;
  --blue-dim:     rgba(0, 71, 255, 0.14);
  --green:        #00ff99;
  --orange:       #ffa500;
  --red:          #ff3f3f;
  --bg:           #000913;
  --bg-panel:     rgba(0, 12, 38, 0.80);
  --surface:      rgba(0, 20, 55, 0.70);
  --border:       rgba(0, 234, 255, 0.16);
  --border-mid:   rgba(0, 234, 255, 0.30);
  --text:         rgba(255, 255, 255, 0.92);
  --text-muted:   rgba(255, 255, 255, 0.38);
  --panel-w:      420px;
  --radius:       10px;
  --radius-sm:    6px;
  --ff:           'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ── Reset ───────────────────────────────────────────────────── */
*, *::before, *::after {
  margin: 0; padding: 0; box-sizing: border-box;
}

html, body {
  width: 100%; height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--ff);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* ── Scrollbar (panel) ──────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-mid); border-radius: 2px; }

/* ── Background ─────────────────────────────────────────────── */
.bg-grid {
  position: fixed; inset: 0; z-index: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 55px 55px;
  pointer-events: none;
}

.bg-glow {
  position: fixed; inset: 0; z-index: 0;
  background:
    radial-gradient(ellipse 70% 70% at 35% 50%,
      rgba(0, 55, 160, .20) 0%, transparent 68%),
    radial-gradient(ellipse 45% 60% at 85% 50%,
      rgba(0, 20, 80, .16) 0%, transparent 70%);
  pointer-events: none;
}

/* ── Root layout ─────────────────────────────────────────────── */
.app {
  position: relative; z-index: 1;
  width: 100vw; height: 100vh;
  display: flex;
  flex-direction: row;
  overflow: hidden;
}

/* ================================================================
   LEFT / CENTER — Avatar column
================================================================ */
.avatar-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px 24px;
  position: relative;
}

/* ── Brand header ────────────────────────────────────────────── */
.brand-header {
  text-align: center;
  flex-shrink: 0;
}

.brand-name {
  font-size: clamp(2rem, 5vw, 3.6rem);
  font-weight: 100;
  letter-spacing: 18px;
  text-transform: uppercase;
  color: var(--cyan);
  text-shadow:
    0 0 14px var(--cyan-glow),
    0 0 45px rgba(0, 234, 255, .14);
  line-height: 1;
}

.brand-sub {
  font-size: clamp(0.55rem, 1.2vw, 0.72rem);
  letter-spacing: 5px;
  color: rgba(0, 234, 255, .40);
  text-transform: uppercase;
  margin-top: 5px;
}

/* ── Avatar section ──────────────────────────────────────────── */
.avatar-section {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  width: 100%;
}

.avatar-outer {
  position: relative;
  /* Portrait: fill vertically, capped by width */
  height: min(78vh, calc((100vw - var(--panel-w)) * 1.44));
  max-height: 820px;
  aspect-ratio: 9 / 13;
}

/* Glowing animated border */
.avatar-border {
  position: absolute; inset: -2px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--cyan), var(--blue), var(--cyan));
  background-size: 200% 200%;
  animation: borderFlow 4s ease infinite;
  z-index: 0;
}
@keyframes borderFlow {
  0%   { background-position: 0% 50%;   opacity: .60; }
  50%  { background-position: 100% 50%; opacity: 1;   }
  100% { background-position: 0% 50%;   opacity: .60; }
}

/* Corner brackets */
.bracket {
  position: absolute; width: 22px; height: 22px; z-index: 10;
}
.bracket.tl { top:8px;    left:8px;  border-top:2px solid var(--cyan); border-left:2px solid var(--cyan); }
.bracket.tr { top:8px;    right:8px; border-top:2px solid var(--cyan); border-right:2px solid var(--cyan); }
.bracket.bl { bottom:8px; left:8px;  border-bottom:2px solid var(--cyan); border-left:2px solid var(--cyan); }
.bracket.br { bottom:8px; right:8px; border-bottom:2px solid var(--cyan); border-right:2px solid var(--cyan); }

/* Video frame */
.avatar-frame {
  position: relative;
  width: 100%; height: 100%;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
  z-index: 1;
}

/* Videos */
video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  transition: opacity 0.35s ease;
}
#idleVideo    { opacity: 1; z-index: 1; }
#talkingVideo { opacity: 0; z-index: 2; }

.avatar-frame.speaking #idleVideo    { opacity: 0; }
.avatar-frame.speaking #talkingVideo { opacity: 1; }

/* Scan line */
.scan-line {
  position: absolute; left: 0; right: 0; height: 3px;
  background: linear-gradient(
    90deg,
    transparent, rgba(0,234,255,.5) 25%,
    rgba(0,234,255,.9) 50%,
    rgba(0,234,255,.5) 75%, transparent
  );
  animation: scanDown 4.5s linear infinite;
  z-index: 10; pointer-events: none;
}
@keyframes scanDown {
  0%   { top: -3px; opacity: 0; }
  4%   { opacity: 1; }
  96%  { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

/* Holographic tint */
.holo-tint {
  position: absolute; inset: 0;
  background: linear-gradient(
    180deg,
    rgba(0,234,255,.07) 0%, transparent 38%,
    transparent 60%, rgba(0,80,255,.07) 100%
  );
  pointer-events: none; z-index: 5;
}

/* CRT lines */
.crt {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(
    0deg, transparent, transparent 2px,
    rgba(0,0,0,.08) 2px, rgba(0,0,0,.08) 4px
  );
  pointer-events: none; z-index: 6;
}

/* Status dot */
.status-dot {
  position: absolute; top: 13px; right: 13px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: dotIdle 2s ease infinite;
  z-index: 20;
}
@keyframes dotIdle { 0%,100%{opacity:1} 50%{opacity:.30} }

.status-dot.listening  { background:var(--red);    box-shadow:0 0 8px var(--red);    animation:dotBlink .50s linear infinite; }
.status-dot.processing { background:var(--orange); box-shadow:0 0 8px var(--orange); animation:dotBlink .35s linear infinite; }
.status-dot.speaking   { background:var(--cyan);   box-shadow:0 0 8px var(--cyan);   animation:dotBlink .45s linear infinite; }
@keyframes dotBlink { 0%,100%{opacity:1} 50%{opacity:.12} }

/* ── Waveform (below avatar) ─────────────────────────────────── */
.waveform {
  display: flex; align-items: center; gap: 3.5px;
  height: 26px; flex-shrink: 0;
  opacity: 0; transition: opacity .3s ease;
  margin-bottom: 2px;
}
.waveform.active { opacity: 1; }

.wave-bar {
  width: 3px; border-radius: 2px;
  background: var(--cyan); height: 3px;
}
.waveform.active .wave-bar { animation: waveAnim var(--d,.9s) ease-in-out infinite; }
.wave-bar:nth-child(1)  { --d:.80s; animation-delay:.00s; }
.wave-bar:nth-child(2)  { --d:.95s; animation-delay:.08s; }
.wave-bar:nth-child(3)  { --d:.70s; animation-delay:.16s; }
.wave-bar:nth-child(4)  { --d:1.05s; animation-delay:.04s; }
.wave-bar:nth-child(5)  { --d:.85s; animation-delay:.12s; }
.wave-bar:nth-child(6)  { --d:1.10s; animation-delay:.20s; }
.wave-bar:nth-child(7)  { --d:.90s; animation-delay:.06s; }
.wave-bar:nth-child(8)  { --d:.75s; animation-delay:.14s; }
.wave-bar:nth-child(9)  { --d:1.00s; animation-delay:.02s; }
.wave-bar:nth-child(10) { --d:.88s; animation-delay:.10s; }
.wave-bar:nth-child(11) { --d:.78s; animation-delay:.18s; }
@keyframes waveAnim { 0%,100%{height:3px} 50%{height:20px} }

/* ── Vertical separator ──────────────────────────────────────── */
.avatar-col::after {
  content: '';
  position: absolute; right: 0; top: 5%; bottom: 5%;
  width: 1px;
  background: linear-gradient(
    180deg,
    transparent, var(--border-mid) 20%,
    var(--border-mid) 80%, transparent
  );
}

/* ================================================================
   RIGHT — Operator console panel
================================================================ */
.right-panel {
  width: var(--panel-w);
  flex-shrink: 0;
  background: var(--bg-panel);
  backdrop-filter: blur(18px);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
  padding: 0 0 16px;
}

/* ── Panel title bar ─────────────────────────────────────────── */
.panel-title {
  display: flex; align-items: center; gap: 9px;
  padding: 16px 22px 14px;
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--cyan);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.panel-title-icon {
  font-size: 1rem;
  opacity: .7;
}

/* ── Section ─────────────────────────────────────────────────── */
.panel-section {
  padding: 16px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.panel-divider {
  height: 1px;
  background: var(--border);
  flex-shrink: 0;
  margin: 0 22px;
}

/* ── Section label ───────────────────────────────────────────── */
.section-label {
  font-size: .60rem;
  font-weight: 700;
  letter-spacing: 3.5px;
  text-transform: uppercase;
  color: rgba(0, 234, 255, .45);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Mic row ─────────────────────────────────────────────────── */
.mic-row {
  display: flex;
  align-items: center;
  gap: 18px;
}

.mic-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

/* ── Mic button ──────────────────────────────────────────────── */
.mic-btn {
  width: 68px; height: 68px;
  border-radius: 50%;
  border: 2px solid var(--cyan);
  background: transparent;
  color: var(--cyan);
  font-size: 1.5rem;
  cursor: pointer; outline: none;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background .2s, box-shadow .2s, transform .15s;
  position: relative;
  touch-action: manipulation;
}
.mic-btn:hover {
  background: var(--cyan-dim);
  box-shadow: 0 0 26px var(--cyan-glow);
  transform: scale(1.06);
}
.mic-btn:active  { transform: scale(.94); }
.mic-btn:disabled { opacity: .30; cursor: not-allowed; transform: none; }

.mic-btn.listening {
  border-color: var(--red); color: var(--red);
  background: rgba(255,63,63,.14);
  animation: micPulse 1.1s ease infinite;
}
@keyframes micPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(255,63,63,.55); }
  50%      { box-shadow: 0 0 0 22px rgba(255,63,63,0); }
}

.mic-btn.processing {
  border-color: var(--orange); color: var(--orange);
  background: rgba(255,165,0,.12);
}
.mic-btn.processing::after {
  content: '';
  position: absolute; inset: -10px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--orange);
  animation: spin .75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.mic-btn.speaking {
  border-color: var(--cyan); color: var(--cyan);
  background: var(--cyan-dim);
  box-shadow: 0 0 20px var(--cyan-glow);
}

/* ── Status label ────────────────────────────────────────────── */
.status-label {
  font-size: .75rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(0, 234, 255, .65);
  min-height: 18px;
  font-weight: 500;
}

.hint {
  font-size: .58rem;
  letter-spacing: 1px;
  color: rgba(255,255,255,.18);
}

/* ── Context badge ───────────────────────────────────────────── */
.ctx-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 3px;
  font-size: .55rem;
  font-weight: 700;
  letter-spacing: 2px;
  border: 1px solid var(--red);
  color: var(--red);
  background: rgba(255,63,63,.10);
  transition: border-color .25s, color .25s, background .25s;
}
.ctx-badge.set {
  border-color: var(--green);
  color: var(--green);
  background: rgba(0,255,153,.10);
}

/* ── HUD textarea ────────────────────────────────────────────── */
.hud-textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--ff);
  font-size: .82rem;
  line-height: 1.55;
  padding: 10px 13px;
  resize: vertical;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  min-height: 70px;
}
.hud-textarea::placeholder {
  color: var(--text-muted);
  font-style: italic;
}
.hud-textarea:focus {
  border-color: var(--border-mid);
  box-shadow: 0 0 0 2px rgba(0, 234, 255, .08), inset 0 0 12px rgba(0,234,255,.04);
}

/* ── Buttons ─────────────────────────────────────────────────── */
.hud-btn {
  display: flex; align-items: center; justify-content: center;
  gap: 8px;
  width: 100%; height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-mid);
  background: var(--cyan-dim);
  color: var(--cyan);
  font-family: var(--ff);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  cursor: pointer; outline: none;
  transition: background .2s, box-shadow .2s, border-color .2s, transform .12s;
}
.hud-btn:hover {
  background: var(--cyan-mid);
  border-color: var(--cyan);
  box-shadow: 0 0 18px rgba(0,234,255,.22);
}
.hud-btn:active  { transform: scale(.97); }
.hud-btn:disabled { opacity: .30; cursor: not-allowed; }

.btn-set {
  border-color: rgba(0,234,255,.28);
  color: rgba(0,234,255,.75);
}

.btn-send {
  border-color: var(--cyan);
  color: var(--cyan);
  background: rgba(0,234,255,.12);
  box-shadow: 0 0 14px rgba(0,234,255,.10);
}
.btn-send:hover {
  background: rgba(0,234,255,.22);
  box-shadow: 0 0 24px rgba(0,234,255,.30);
}

/* ── Context preview ─────────────────────────────────────────── */
.ctx-preview {
  font-size: .70rem;
  color: rgba(0,234,255,.45);
  font-style: italic;
  line-height: 1.4;
  min-height: 0;
  word-break: break-word;
}

/* ── Warning message ─────────────────────────────────────────── */
.warn-msg {
  font-size: .70rem;
  color: var(--orange);
  min-height: 0;
  opacity: 0;
  transition: opacity .25s;
  line-height: 1.4;
}
.warn-msg.visible { opacity: 1; }

/* ── Response section ────────────────────────────────────────── */
.response-section {
  flex: 1;
  min-height: 0;
}

.response-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  flex: 1;
  min-height: 90px;
  position: relative;
  overflow: hidden;
}

/* Subtle inner glow on the response box */
.response-box::before {
  content: '';
  position: absolute; inset: 0;
  border-radius: var(--radius);
  box-shadow: inset 0 0 24px rgba(0,234,255,.04);
  pointer-events: none;
}

.resp-question {
  font-size: .70rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  line-height: 1.4;
  min-height: 14px;
  word-break: break-word;
}

.resp-answer {
  font-size: .88rem;
  color: rgba(0, 234, 255, .85);
  line-height: 1.7;
  word-break: break-word;
}

/* ── Auto-listen toggle button ──────────────────────────────── */
.auto-listen-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%; height: 38px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--ff);
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  cursor: pointer; outline: none;
  transition: border-color .25s, color .25s, background .25s, box-shadow .25s;
}
.auto-listen-btn:hover {
  border-color: var(--border-mid);
  color: var(--text);
}
.auto-listen-btn.active {
  border-color: var(--green);
  color: var(--green);
  background: rgba(0, 255, 153, .07);
  box-shadow: 0 0 14px rgba(0,255,153,.14);
}

.al-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
  transition: background .25s, box-shadow .25s;
}
.auto-listen-btn.active .al-dot {
  background: var(--green);
  box-shadow: 0 0 7px var(--green);
  animation: dotBlink .9s ease infinite;
}

/* Hidden audio */
audio { display: none; }
