/* ═══════════════════════════════════════════════
   HOLO CLAUDINHA — Holographic Interface
   ═══════════════════════════════════════════════ */

:root {
  --cyan:    #00d4ff;
  --purple:  #7b2fff;
  --pink:    #ff2d78;
  --gold:    #ffd700;
  --green:   #00ff88;
  --bg:      #000000;
  --bg2:     #050a0f;
  --text:    #c8f0ff;

  --glow-cyan:   0 0 10px #00d4ff, 0 0 30px #00d4ff55, 0 0 60px #00d4ff22;
  --glow-purple: 0 0 10px #7b2fff, 0 0 30px #7b2fff55;
  --glow-pink:   0 0 10px #ff2d78, 0 0 30px #ff2d7855;

  /* Emotion colors */
  --e-carinhosa:  #ff6bb5;
  --e-animada:    #00d4ff;
  --e-pensativa:  #7b2fff;
  --e-seria:      #4a9eff;
  --e-feliz:      #ffd700;
  --e-apaixonada: #ff2d78;
  --e-curiosa:    #00ff88;
  --e-orgulhosa:  #ff8c42;

  --emotion-color: var(--cyan);
}

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

html, body {
  width: 100%; height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Courier New', monospace;
  overflow: hidden;
}

/* ── CANVAS PARTICLES ── */
#particles { position: fixed; inset: 0; z-index: 0; pointer-events: none; }

/* ── SCANLINES ── */
#scanlines {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,212,255,0.015) 2px,
    rgba(0,212,255,0.015) 4px
  );
}

/* ── LAYOUT ── */
#app {
  position: relative; z-index: 2;
  display: grid;
  grid-template-columns: 1fr 380px;
  grid-template-rows: 1fr auto;
  height: 100vh;
  gap: 0;
}

/* ── HOLO STAGE (left) ── */
#stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 20px;
}

/* ── FACE CONTAINER ── */
#face-wrap {
  position: relative;
  width: 360px;
  height: 480px;
}

/* Outer rotating ring */
#face-wrap::before {
  content: '';
  position: absolute;
  inset: -24px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--emotion-color);
  border-right-color: var(--emotion-color);
  animation: ring-spin 3s linear infinite;
  box-shadow: 0 0 20px var(--emotion-color);
  z-index: 10;
  pointer-events: none;
}

/* Inner pulsing ring */
#face-wrap::after {
  content: '';
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  border: 1px solid var(--emotion-color);
  opacity: 0.4;
  animation: ring-pulse 2s ease-in-out infinite;
  z-index: 10;
  pointer-events: none;
}

@keyframes ring-spin { to { transform: rotate(360deg); } }
@keyframes ring-pulse {
  0%, 100% { transform: scale(1); opacity: 0.4; }
  50% { transform: scale(1.04); opacity: 0.8; }
}

/* ── AVATAR 3D (TalkingHead canvas) ── */
#avatar {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: radial-gradient(ellipse at center bottom, #0a1a2e 0%, #000510 100%);
  box-shadow: var(--glow-cyan);
}
/* Canvas interno gerado pelo TalkingHead */
#avatar canvas {
  width: 100% !important;
  height: 100% !important;
  border-radius: 12px;
}

/* ── PORTRAIT FALLBACK (se avatar 3D falhar) ── */
#portrait {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  border-radius: 12px;
  filter: saturate(1.1) contrast(1.05);
  box-shadow: var(--glow-cyan);
  animation: idle-breathe 4s ease-in-out infinite;
}
@keyframes idle-breathe {
  0%, 100% { transform: scale(1) translateY(0); }
  50% { transform: scale(1.008) translateY(-3px); }
}

/* Holographic overlay */
#portrait-overlay {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  background: linear-gradient(
    180deg,
    transparent 40%,
    rgba(0,212,255,0.06) 70%,
    rgba(0,212,255,0.18) 100%
  );
  pointer-events: none;
  z-index: 5;
}

/* ── AVATAR LOADING ── */
#avatar-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 20;
}
#loading-ring {
  width: 48px; height: 48px;
  border-radius: 50%;
  border: 3px solid rgba(0,212,255,0.15);
  border-top-color: var(--cyan);
  animation: ring-spin 0.8s linear infinite;
}
#loading-text {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--cyan);
  opacity: 0.6;
}

/* ── EMOTION STATES ── */
body.emotion-carinhosa { --emotion-color: var(--e-carinhosa); }
body.emotion-animada   { --emotion-color: var(--e-animada); }
body.emotion-pensativa { --emotion-color: var(--e-pensativa); }
body.emotion-seria     { --emotion-color: var(--e-seria); }
body.emotion-feliz     { --emotion-color: var(--e-feliz); }
body.emotion-apaixonada{ --emotion-color: var(--e-apaixonada); }
body.emotion-curiosa   { --emotion-color: var(--e-curiosa); }
body.emotion-orgulhosa { --emotion-color: var(--e-orgulhosa); }

body.is-listening #face-wrap::before {
  animation: ring-spin 0.8s linear infinite;
  border-color: var(--green);
  border-top-color: var(--green);
  border-right-color: var(--green);
  box-shadow: 0 0 30px var(--green);
}
body.is-thinking #face-wrap::before {
  animation: ring-spin 1.5s linear infinite;
  border-top-color: var(--purple);
  border-right-color: var(--purple);
  box-shadow: 0 0 25px var(--purple);
}
body.is-speaking #face-wrap::before {
  animation: ring-spin 0.6s linear infinite;
  border-top-color: var(--emotion-color);
  box-shadow: 0 0 35px var(--emotion-color), 0 0 70px var(--emotion-color);
}

/* ── MATRIX RAIN (thinking) ── */
#matrix-canvas {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  z-index: 6;
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events: none;
}
body.is-thinking #matrix-canvas { opacity: 0.55; }

/* ── WAVEFORM BARS (speaking) ── */
#waveform {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 64px;
  z-index: 7;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  border-radius: 0 0 12px 12px;
}
body.is-speaking #waveform { opacity: 1; }

/* ── LISTEN RINGS (ouvindo) ── */
#listen-rings {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  border-radius: 12px;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.3s;
}
body.is-listening #listen-rings { opacity: 1; }
.listen-ring {
  position: absolute;
  inset: 15%;
  border-radius: 50%;
  border: 2px solid var(--green);
  opacity: 0;
  animation: listen-expand 2s ease-out infinite;
}
.listen-ring:nth-child(2) { animation-delay: 0.66s; }
.listen-ring:nth-child(3) { animation-delay: 1.33s; }
@keyframes listen-expand {
  0%   { transform: scale(0.5); opacity: 0.8; }
  100% { transform: scale(2.4); opacity: 0; }
}

/* ── STATUS LINE ── */
#status-line {
  margin-top: 24px;
  font-size: 12px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--emotion-color);
  text-shadow: 0 0 8px var(--emotion-color);
  opacity: 0.9;
  animation: status-flicker 3s ease-in-out infinite;
}
@keyframes status-flicker {
  0%, 95%, 100% { opacity: 0.9; }
  96% { opacity: 0.5; }
  97% { opacity: 0.9; }
}

/* ── NAME PLATE ── */
#nameplate {
  margin-top: 12px;
  text-align: center;
}
#nameplate h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 8px;
  color: var(--cyan);
  text-shadow: var(--glow-cyan);
  text-transform: uppercase;
}
#nameplate p {
  font-size: 10px;
  letter-spacing: 4px;
  color: var(--text);
  opacity: 0.5;
  text-transform: uppercase;
  margin-top: 4px;
}

/* ── SIDE PANEL (right) ── */
#panel {
  background: rgba(0,15,30,0.85);
  border-left: 1px solid rgba(0,212,255,0.2);
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 20px 16px;
  gap: 16px;
}

/* Header panel */
#panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(0,212,255,0.15);
}
#panel-header .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: dot-blink 2s ease-in-out infinite;
}
@keyframes dot-blink { 50% { opacity: 0.3; } }
#panel-header span {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--cyan);
  opacity: 0.8;
}

/* Messages */
#messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-right: 4px;
}
#messages::-webkit-scrollbar { width: 3px; }
#messages::-webkit-scrollbar-track { background: transparent; }
#messages::-webkit-scrollbar-thumb { background: rgba(0,212,255,0.3); border-radius: 2px; }

.msg {
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: msg-appear 0.3s ease;
}
@keyframes msg-appear {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.msg-label {
  font-size: 9px;
  letter-spacing: 2px;
  text-transform: uppercase;
  opacity: 0.4;
}
.msg-user .msg-label { color: var(--cyan); text-align: right; }
.msg-bot  .msg-label { color: var(--emotion-color); }

.msg-bubble {
  font-size: 13px;
  line-height: 1.6;
  padding: 10px 13px;
  border-radius: 8px;
  max-width: 100%;
  word-break: break-word;
}
.msg-user .msg-bubble {
  background: rgba(0,212,255,0.1);
  border: 1px solid rgba(0,212,255,0.25);
  text-align: right;
  align-self: flex-end;
  color: var(--cyan);
}
.msg-bot .msg-bubble {
  background: rgba(123,47,255,0.08);
  border: 1px solid rgba(123,47,255,0.2);
  color: var(--text);
}

/* Command results */
.cmd-block {
  margin-top: 6px;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(0,212,255,0.15);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 11px;
  color: rgba(0,212,255,0.7);
  font-family: monospace;
  white-space: pre-wrap;
  word-break: break-all;
}
.cmd-block .cmd-line { color: var(--green); margin-bottom: 4px; }

/* ── INPUT AREA ── */
#input-area {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1px solid rgba(0,212,255,0.15);
  padding-top: 14px;
}

#text-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

#msg-input {
  flex: 1;
  background: rgba(0,20,40,0.8);
  border: 1px solid rgba(0,212,255,0.25);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  padding: 10px 12px;
  resize: none;
  height: 44px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
#msg-input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 12px rgba(0,212,255,0.2);
}
#msg-input::placeholder { opacity: 0.3; }

#send-btn {
  background: rgba(0,212,255,0.12);
  border: 1px solid rgba(0,212,255,0.4);
  border-radius: 8px;
  color: var(--cyan);
  width: 44px; height: 44px;
  cursor: pointer;
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
#send-btn:hover { background: rgba(0,212,255,0.25); box-shadow: var(--glow-cyan); }

/* Voice button */
#voice-btn {
  width: 100%;
  height: 52px;
  background: rgba(0,212,255,0.06);
  border: 1px solid rgba(0,212,255,0.3);
  border-radius: 10px;
  color: var(--cyan);
  font-family: inherit;
  font-size: 12px;
  letter-spacing: 3px;
  text-transform: uppercase;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}
#voice-btn:hover { border-color: var(--cyan); box-shadow: var(--glow-cyan); }
#voice-btn.active {
  background: rgba(0,255,136,0.12);
  border-color: var(--green);
  box-shadow: 0 0 20px rgba(0,255,136,0.3);
  color: var(--green);
  animation: voice-pulse 0.8s ease-in-out infinite;
}
@keyframes voice-pulse {
  0%, 100% { box-shadow: 0 0 20px rgba(0,255,136,0.3); }
  50%       { box-shadow: 0 0 40px rgba(0,255,136,0.6); }
}

.mic-icon { font-size: 20px; }

/* Pepper mode button */
#pepper-btn {
  background: transparent;
  border: 1px solid rgba(123,47,255,0.3);
  border-radius: 6px;
  color: rgba(123,47,255,0.7);
  font-family: inherit;
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  padding: 6px;
  transition: all 0.2s;
}
#pepper-btn:hover { border-color: var(--purple); color: var(--purple); box-shadow: var(--glow-purple); }

/* ── THINKING INDICATOR ── */
#thinking {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 8px 13px;
  background: rgba(123,47,255,0.08);
  border: 1px solid rgba(123,47,255,0.2);
  border-radius: 8px;
  font-size: 12px;
  color: var(--purple);
}
#thinking.visible { display: flex; }
#thinking .dots span {
  animation: dot-bounce 1.2s ease-in-out infinite;
  display: inline-block;
}
#thinking .dots span:nth-child(2) { animation-delay: 0.2s; }
#thinking .dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dot-bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-5px); }
}

/* ── BOTTOM BAR (mobile-ish info) ── */
#bottom-bar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 20px;
  border-top: 1px solid rgba(0,212,255,0.1);
  font-size: 9px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(0,212,255,0.3);
}

/* ── RESPONSIVE ── */
@media (max-width: 700px) {
  #app { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; }
  #stage { padding: 16px; }
  #face-wrap { width: 220px; height: 280px; }
  #panel { height: auto; border-left: none; border-top: 1px solid rgba(0,212,255,0.2); }
  #nameplate h1 { font-size: 20px; letter-spacing: 5px; }
}
