/* ============================================
   ARIA — AI Assistant
   Aesthetic: Dark Futuristic / Acid Neon
   Palette: #0D0D0D, #1A1A2E, #CCFF00, #FF3CAC
   Fonts: Clash Display + Space Mono + Outfit
============================================ */

:root {
  --bg-deep:       #080810;
  --bg-dark:       #0D0D1A;
  --bg-card:       #111122;
  --bg-input:      #0F0F1E;
  --border:        rgba(204, 255, 0, 0.15);
  --border-bright: rgba(204, 255, 0, 0.4);
  --neon-green:    #CCFF00;
  --neon-pink:     #FF3CAC;
  --neon-blue:     #00D4FF;
  --text-primary:  #F0F0FF;
  --text-muted:    #6B6B8A;
  --text-dim:      #3A3A5C;
  --orb-glow:      rgba(204, 255, 0, 0.3);
  --pink-glow:     rgba(255, 60, 172, 0.3);
  --radius:        14px;
  --radius-sm:     8px;
  --font-display:  'Clash Display', sans-serif;
  --font-mono:     'Space Mono', monospace;
  --font-body:     'Outfit', sans-serif;
}

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

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
}

/* ── Background ── */
.bg-grid {
  position: fixed; inset: 0; z-index: 0;
  background-image:
    linear-gradient(rgba(204,255,0,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(204,255,0,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

.bg-glow {
  position: fixed; inset: 0; z-index: 0;
  background:
    radial-gradient(ellipse 60% 40% at 20% 10%, rgba(204,255,0,0.06) 0%, transparent 60%),
    radial-gradient(ellipse 50% 50% at 80% 90%, rgba(255,60,172,0.06) 0%, transparent 60%),
    radial-gradient(ellipse 40% 60% at 50% 50%, rgba(0,212,255,0.03) 0%, transparent 70%);
  pointer-events: none;
}

/* ── App Layout ── */
.app {
  position: relative; z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ── Header ── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--neon-green);
  box-shadow: 0 0 10px var(--neon-green), 0 0 20px var(--neon-green);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.8); }
}

.logo-text {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--neon-green);
  text-shadow: 0 0 20px rgba(204,255,0,0.5);
}

.logo-sub {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  display: none;
}

@media (min-width: 600px) { .logo-sub { display: block; } }

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(204,255,0,0.04);
}

.status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--neon-green);
  box-shadow: 0 0 6px var(--neon-green);
  animation: pulse-dot 2s ease-in-out infinite;
}

.status-badge.thinking .status-dot { background: var(--neon-pink); box-shadow: 0 0 6px var(--neon-pink); }
.status-badge.speaking .status-dot { background: var(--neon-blue); box-shadow: 0 0 6px var(--neon-blue); }
.status-badge.listening .status-dot { background: #FF6B2B; box-shadow: 0 0 6px #FF6B2B; }

.settings-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  padding: 6px 8px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex; align-items: center;
}
.settings-btn:hover { border-color: var(--border-bright); color: var(--neon-green); }

/* ── Settings Panel ── */
.settings-panel {
  position: absolute;
  top: 60px; right: 16px;
  width: 320px;
  background: var(--bg-card);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  z-index: 100;
  transform: translateY(-10px) scale(0.97);
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 30px rgba(204,255,0,0.05);
}

.settings-panel.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: all;
}

.settings-inner { padding: 20px; }

.settings-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--neon-green);
  margin-bottom: 16px;
}

.settings-field {
  margin-bottom: 14px;
}

.settings-field label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.settings-field input,
.settings-field select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 8px 12px;
  outline: none;
  transition: border-color 0.2s;
}

.settings-field input:focus,
.settings-field select:focus { border-color: var(--border-bright); }

.settings-field select option { background: var(--bg-card); }

.settings-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.btn-save {
  flex: 1;
  background: var(--neon-green);
  color: #000;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  padding: 9px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-save:hover { background: #d4ff1a; box-shadow: 0 0 20px rgba(204,255,0,0.4); }

.btn-clear {
  flex: 1;
  background: transparent;
  color: var(--neon-pink);
  border: 1px solid rgba(255,60,172,0.3);
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  padding: 9px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-clear:hover { background: rgba(255,60,172,0.1); border-color: var(--neon-pink); }

/* ── Orb Section ── */
.orb-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 0 10px;
  flex-shrink: 0;
}

.orb-container {
  position: relative;
  width: 120px; height: 120px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}

.orb-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid;
  animation: spin-ring linear infinite;
}

.orb-ring-1 {
  width: 100px; height: 100px;
  border-color: rgba(204,255,0,0.3);
  animation-duration: 8s;
}
.orb-ring-2 {
  width: 115px; height: 115px;
  border-color: rgba(255,60,172,0.15);
  animation-duration: 14s;
  animation-direction: reverse;
}
.orb-ring-3 {
  width: 130px; height: 130px;
  border-color: rgba(0,212,255,0.08);
  animation-duration: 20s;
}

@keyframes spin-ring {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.orb {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(204,255,0,0.3), rgba(0,212,255,0.1) 50%, rgba(255,60,172,0.15));
  border: 1px solid rgba(204,255,0,0.4);
  box-shadow:
    0 0 20px rgba(204,255,0,0.2),
    0 0 40px rgba(204,255,0,0.1),
    inset 0 0 20px rgba(204,255,0,0.05);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.3s ease;
  animation: orb-breathe 4s ease-in-out infinite;
}

@keyframes orb-breathe {
  0%, 100% { box-shadow: 0 0 20px rgba(204,255,0,0.2), 0 0 40px rgba(204,255,0,0.1), inset 0 0 20px rgba(204,255,0,0.05); }
  50% { box-shadow: 0 0 30px rgba(204,255,0,0.35), 0 0 60px rgba(204,255,0,0.15), inset 0 0 30px rgba(204,255,0,0.08); }
}

.orb:hover {
  transform: scale(1.05);
  box-shadow: 0 0 40px rgba(204,255,0,0.4), 0 0 80px rgba(204,255,0,0.2), inset 0 0 30px rgba(204,255,0,0.1);
}

.orb.listening {
  animation: orb-listen 0.5s ease-in-out infinite alternate;
  border-color: rgba(255,107,43,0.8);
  box-shadow: 0 0 30px rgba(255,107,43,0.4), 0 0 60px rgba(255,107,43,0.2);
}

@keyframes orb-listen {
  from { transform: scale(1); }
  to   { transform: scale(1.08); }
}

.orb.thinking {
  animation: orb-think 1s ease-in-out infinite;
  border-color: rgba(255,60,172,0.8);
}

@keyframes orb-think {
  0%, 100% { transform: scale(1) rotate(0deg); }
  25% { transform: scale(1.03) rotate(2deg); }
  75% { transform: scale(1.03) rotate(-2deg); }
}

.orb.speaking {
  animation: orb-speak 0.3s ease-in-out infinite alternate;
  border-color: rgba(0,212,255,0.8);
  box-shadow: 0 0 30px rgba(0,212,255,0.4), 0 0 60px rgba(0,212,255,0.2);
}

@keyframes orb-speak {
  from { transform: scale(1); }
  to   { transform: scale(1.06); }
}

.orb-inner {
  width: 50px; height: 50px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 40%, rgba(204,255,0,0.6), rgba(0,212,255,0.3) 60%, transparent);
  display: flex; align-items: center; justify-content: center;
}

.orb-core {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0%, var(--neon-green) 60%, transparent 100%);
  box-shadow: 0 0 10px var(--neon-green);
}

/* Voice bars */
.voice-bars {
  position: absolute;
  bottom: -24px;
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 20px;
  opacity: 0;
  transition: opacity 0.3s;
}

.voice-bars.active { opacity: 1; }

.voice-bars span {
  display: block;
  width: 3px;
  background: var(--neon-green);
  border-radius: 2px;
  height: 4px;
  box-shadow: 0 0 4px var(--neon-green);
  transition: height 0.1s;
}

.voice-bars.active span { animation: bar-dance 0.6s ease-in-out infinite alternate; }
.voice-bars.active span:nth-child(1)  { animation-delay: 0.0s; }
.voice-bars.active span:nth-child(2)  { animation-delay: 0.05s; }
.voice-bars.active span:nth-child(3)  { animation-delay: 0.1s; }
.voice-bars.active span:nth-child(4)  { animation-delay: 0.15s; }
.voice-bars.active span:nth-child(5)  { animation-delay: 0.2s; }
.voice-bars.active span:nth-child(6)  { animation-delay: 0.25s; }
.voice-bars.active span:nth-child(7)  { animation-delay: 0.3s; }
.voice-bars.active span:nth-child(8)  { animation-delay: 0.25s; }
.voice-bars.active span:nth-child(9)  { animation-delay: 0.2s; }
.voice-bars.active span:nth-child(10) { animation-delay: 0.15s; }
.voice-bars.active span:nth-child(11) { animation-delay: 0.1s; }
.voice-bars.active span:nth-child(12) { animation-delay: 0.05s; }
.voice-bars.active span:nth-child(13) { animation-delay: 0.0s; }
.voice-bars.active span:nth-child(14) { animation-delay: 0.05s; }
.voice-bars.active span:nth-child(15) { animation-delay: 0.1s; }

@keyframes bar-dance {
  from { height: 3px; }
  to   { height: 18px; }
}

.orb-label {
  margin-top: 32px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-align: center;
  transition: color 0.3s;
}

/* ── Chat Window ── */
.chat-window {
  flex: 1;
  overflow: hidden;
  position: relative;
  margin: 8px 0;
}

.chat-messages {
  height: 100%;
  overflow-y: auto;
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--text-dim); border-radius: 2px; }

/* Messages */
.message {
  display: flex;
  gap: 12px;
  animation: msg-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes msg-in {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.message-user {
  flex-direction: row-reverse;
}

.message-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.message-ai .message-avatar {
  background: linear-gradient(135deg, rgba(204,255,0,0.2), rgba(0,212,255,0.2));
  border: 1px solid rgba(204,255,0,0.3);
  color: var(--neon-green);
  box-shadow: 0 0 10px rgba(204,255,0,0.1);
}

.message-user .message-avatar {
  background: linear-gradient(135deg, rgba(255,60,172,0.2), rgba(255,107,43,0.2));
  border: 1px solid rgba(255,60,172,0.3);
  color: var(--neon-pink);
}

.message-content {
  max-width: calc(100% - 50px);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.message-user .message-content { align-items: flex-end; }

.message-bubble {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.65;
  word-break: break-word;
}

.message-ai .message-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px var(--radius) var(--radius) var(--radius);
  color: var(--text-primary);
}

.message-user .message-bubble {
  background: linear-gradient(135deg, rgba(204,255,0,0.12), rgba(0,212,255,0.08));
  border: 1px solid rgba(204,255,0,0.2);
  border-radius: var(--radius) 4px var(--radius) var(--radius);
  color: var(--text-primary);
}

.message-time {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  padding: 0 4px;
}

/* Code blocks inside messages */
.message-bubble pre {
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  overflow-x: auto;
  margin: 8px 0;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
}

.message-bubble code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: rgba(204,255,0,0.08);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--neon-green);
}

.message-bubble pre code {
  background: none;
  padding: 0;
  color: #e0e0ff;
}

/* Typing indicator */
.typing-indicator .message-bubble {
  padding: 14px 18px;
}

.typing-dots {
  display: flex;
  gap: 5px;
  align-items: center;
}

.typing-dots span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--neon-green);
  animation: typing-bounce 1.2s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* ── Capability Pills ── */
.capability-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 8px;
  flex-shrink: 0;
  scrollbar-width: none;
}
.capability-pills::-webkit-scrollbar { display: none; }

.pill {
  flex-shrink: 0;
  background: rgba(204,255,0,0.05);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 12px;
  padding: 6px 14px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.pill:hover {
  background: rgba(204,255,0,0.1);
  border-color: var(--border-bright);
  color: var(--neon-green);
  transform: translateY(-1px);
}

/* ── Input Area ── */
.input-area {
  padding: 8px 0 16px;
  flex-shrink: 0;
}

.input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 10px 10px 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-wrapper:focus-within {
  border-color: var(--border-bright);
  box-shadow: 0 0 20px rgba(204,255,0,0.08);
}

.user-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  resize: none;
  max-height: 120px;
  overflow-y: auto;
}

.user-input::placeholder { color: var(--text-dim); }

.user-input::-webkit-scrollbar { width: 3px; }
.user-input::-webkit-scrollbar-thumb { background: var(--text-dim); border-radius: 2px; }

.input-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.mic-btn, .send-btn {
  width: 38px; height: 38px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.mic-btn {
  background: rgba(255,107,43,0.1);
  color: #FF6B2B;
  border: 1px solid rgba(255,107,43,0.2);
}
.mic-btn:hover { background: rgba(255,107,43,0.2); border-color: rgba(255,107,43,0.5); }
.mic-btn.active {
  background: rgba(255,107,43,0.25);
  border-color: #FF6B2B;
  color: #FF6B2B;
  box-shadow: 0 0 15px rgba(255,107,43,0.3);
  animation: mic-pulse 1s ease-in-out infinite;
}

@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 10px rgba(255,107,43,0.3); }
  50% { box-shadow: 0 0 25px rgba(255,107,43,0.6); }
}

.send-btn {
  background: var(--neon-green);
  color: #000;
}
.send-btn:hover {
  background: #d4ff1a;
  box-shadow: 0 0 20px rgba(204,255,0,0.4);
  transform: scale(1.05);
}
.send-btn:disabled {
  background: var(--text-dim);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.input-hint {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  text-align: center;
  margin-top: 6px;
  letter-spacing: 0.5px;
}

/* ── Utility ── */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .orb-section { padding: 12px 0 6px; }
  .orb-container { width: 90px; height: 90px; }
  .orb { width: 64px; height: 64px; }
  .orb-ring-1 { width: 80px; height: 80px; }
  .orb-ring-2 { width: 92px; height: 92px; }
  .orb-ring-3 { width: 104px; height: 104px; }
  .orb-label { margin-top: 28px; }
  .logo-text { font-size: 18px; }
}