/* ===================================================================
   Aria App — Yandere Synthwave Aesthetic
   Neon pink, cyan, purple on deep dark backgrounds
   =================================================================== */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --pink: #ff1493;
  --pink-light: #ff69b4;
  --pink-glow: rgba(255, 20, 147, 0.4);
  --cyan: #00ffff;
  --cyan-glow: rgba(0, 255, 255, 0.3);
  --purple: #a855f7;
  --purple-glow: rgba(168, 85, 247, 0.3);
  --bg-deep: #0a0015;
  --bg-card: #120022;
  --bg-msg: #1a0033;
  --text: #e8d0f5;
  --text-dim: #8870a0;
  --border: rgba(255, 20, 147, 0.15);
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  background: var(--bg-deep);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* --- CRT Scanline Overlay --- */
#crt-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 4px
  );
  mix-blend-mode: overlay;
  opacity: 0.3;
}

/* --- Animated Background --- */
#bg-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

/* --- App Container --- */
#app {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 500px;
  margin: 0 auto;
  background: rgba(10, 0, 21, 0.92);
  backdrop-filter: blur(8px);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  box-shadow: 0 0 60px rgba(255, 20, 147, 0.08);
}

/* ===================================================================
   HEADER
   =================================================================== */
#header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(18, 0, 34, 0.95);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 10;
}

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

.aria-avatar {
  position: relative;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.aria-avatar svg {
  filter: drop-shadow(0 0 6px var(--pink-glow));
}

.online-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  background: #22c55e;
  border-radius: 50%;
  border: 2px solid var(--bg-card);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; box-shadow: 0 0 4px #22c55e; }
  50% { opacity: 0.7; box-shadow: 0 0 10px #22c55e; }
}

.header-info {
  display: flex;
  flex-direction: column;
}

.header-name {
  font-weight: 700;
  font-size: 16px;
  background: linear-gradient(135deg, var(--pink), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-status {
  font-size: 11px;
  color: var(--text-dim);
  transition: color 0.3s;
}

.header-status.online { color: #22c55e; }
.header-status.thinking { color: var(--pink); }
.header-status.misses { color: var(--purple); }

.header-right {
  display: flex;
  gap: 8px;
}

.icon-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  padding: 8px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s;
}

.icon-btn:hover {
  color: var(--pink-light);
  background: rgba(255, 20, 147, 0.1);
}

/* ===================================================================
   TAB NAVIGATION
   =================================================================== */
#tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: rgba(12, 0, 24, 0.95);
}

.tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 8px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.tab-btn:hover {
  color: var(--text);
  background: rgba(255, 20, 147, 0.05);
}

.tab-btn.active {
  color: var(--pink);
  border-bottom-color: var(--pink);
  text-shadow: 0 0 10px var(--pink-glow);
}

/* ===================================================================
   TAB CONTENT
   =================================================================== */
.tab-content {
  display: none;
  flex: 1;
  overflow: hidden;
  flex-direction: column;
}

.tab-content.active {
  display: flex;
}

/* ===================================================================
   CHAT TAB
   =================================================================== */
#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

#chat-messages::-webkit-scrollbar {
  width: 4px;
}

#chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

#chat-messages::-webkit-scrollbar-thumb {
  background: var(--pink-glow);
  border-radius: 2px;
}

/* --- Message Bubbles --- */
.message {
  display: flex;
  animation: msg-in 0.3s ease-out;
}

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

.message.user-message {
  justify-content: flex-end;
}

.message.aria-message {
  justify-content: flex-start;
}

.bubble {
  max-width: 82%;
  display: flex;
  gap: 6px;
  align-items: flex-end;
}

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

.bubble-avatar {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.8;
}

.user-message .bubble-avatar {
  display: none;
}

.bubble-content {
  padding: 10px 14px;
  border-radius: 18px;
  position: relative;
  word-wrap: break-word;
  overflow-wrap: break-word;
  line-height: 1.45;
  font-size: 14.5px;
}

.aria-message .bubble-content {
  background: linear-gradient(135deg, rgba(255, 20, 147, 0.12), rgba(168, 85, 247, 0.08));
  border: 1px solid rgba(255, 20, 147, 0.2);
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 12px rgba(255, 20, 147, 0.06);
}

.user-message .bubble-content {
  background: linear-gradient(135deg, rgba(0, 255, 255, 0.12), rgba(168, 85, 247, 0.06));
  border: 1px solid rgba(0, 255, 255, 0.2);
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 12px rgba(0, 255, 255, 0.06);
}

.bubble-content p {
  margin: 0;
}

.aria-message .bubble-content p {
  color: #f0d0f8;
}

.user-message .bubble-content p {
  color: #d0f0ff;
}

.msg-time {
  font-size: 10px;
  color: var(--text-dim);
  display: block;
  margin-top: 4px;
  opacity: 0.7;
}

.user-message .msg-time {
  text-align: right;
}

/* --- Typing Indicator --- */
#typing-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  animation: fade-in 0.3s ease-out;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

#typing-indicator.hidden {
  display: none;
}

.typing-avatar {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.8;
}

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

.dot {
  width: 6px;
  height: 6px;
  background: var(--pink-light);
  border-radius: 50%;
  animation: bounce-dot 1.4s ease-in-out infinite;
}

.dot:nth-child(1) { animation-delay: 0s; }
.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }

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

.typing-text {
  font-size: 11px;
  color: var(--text-dim);
  font-style: italic;
}

/* --- Chat Input --- */
#chat-input-area {
  padding: 10px 12px 14px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: rgba(12, 0, 24, 0.95);
}

#chat-input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 20, 147, 0.15);
  border-radius: 24px;
  padding: 4px 4px 4px 16px;
  transition: all 0.3s;
}

#chat-input-wrapper:focus-within {
  border-color: var(--pink);
  box-shadow: 0 0 20px var(--pink-glow), inset 0 0 20px rgba(255, 20, 147, 0.04);
}

#chat-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 15px;
  font-family: var(--font);
  padding: 8px 0;
}

#chat-input::placeholder {
  color: var(--text-dim);
  opacity: 0.6;
}

#send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--pink), var(--purple));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s;
  flex-shrink: 0;
  opacity: 0.6;
  transform: scale(0.9);
  box-shadow: 0 0 12px rgba(255, 20, 147, 0.2);
}

#send-btn.active {
  opacity: 1;
  transform: scale(1);
  animation: pulse-send 2s ease-in-out infinite;
}

#send-btn.active:hover {
  box-shadow: 0 0 24px var(--pink-glow);
}

@keyframes pulse-send {
  0%, 100% { box-shadow: 0 0 12px rgba(255, 20, 147, 0.3); }
  50% { box-shadow: 0 0 24px rgba(255, 20, 147, 0.6); }
}

/* ===================================================================
   CALL TAB
   =================================================================== */
.call-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 40px 24px;
  text-align: center;
  gap: 16px;
}

.call-heart {
  margin-bottom: 8px;
  filter: drop-shadow(0 0 20px rgba(255, 20, 147, 0.5));
}

.call-title {
  font-size: 28px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--pink), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.call-subtitle {
  color: var(--text-dim);
  font-size: 14px;
  margin-bottom: 8px;
}

.glow-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 40px;
  border-radius: 50px;
  border: 2px solid var(--pink);
  background: linear-gradient(135deg, rgba(255, 20, 147, 0.15), rgba(168, 85, 247, 0.1));
  color: var(--pink-light);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 0 30px rgba(255, 20, 147, 0.2), inset 0 0 30px rgba(255, 20, 147, 0.05);
  position: relative;
  overflow: hidden;
}

.glow-btn::before {
  content: '';
  position: absolute;
  top: -2px; left: -2px; right: -2px; bottom: -2px;
  border-radius: 50px;
  background: linear-gradient(135deg, var(--pink), var(--cyan), var(--purple), var(--pink));
  background-size: 300% 300%;
  z-index: -1;
  animation: border-glow 4s ease infinite;
  opacity: 0;
  transition: opacity 0.3s;
}

.glow-btn:hover::before {
  opacity: 1;
}

.glow-btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 0 50px rgba(255, 20, 147, 0.4);
  color: white;
}

@keyframes border-glow {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.call-info {
  color: var(--text-dim);
  font-size: 12px;
  margin-top: 8px;
}

.call-link {
  color: var(--cyan);
  font-family: monospace;
  font-size: 13px;
  margin-top: 4px;
  opacity: 0.8;
}

#last-call {
  margin-top: 16px;
  padding: 12px 24px;
  background: rgba(255, 20, 147, 0.06);
  border: 1px solid rgba(255, 20, 147, 0.15);
  border-radius: 16px;
}

#last-call.hidden {
  display: none;
}

.last-call-label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.last-call-duration {
  font-size: 24px;
  font-weight: 700;
  color: var(--cyan);
  margin-top: 4px;
}

/* ===================================================================
   ABOUT TAB
   =================================================================== */
.about-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 24px;
  flex: 1;
  text-align: center;
  overflow-y: auto;
}

.about-avatar {
  margin-bottom: 16px;
  filter: drop-shadow(0 0 30px rgba(255, 20, 147, 0.3));
}

.about-title {
  font-size: 36px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--pink), var(--purple), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 4px;
}

.about-subtitle {
  color: var(--pink-light);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 20px;
  opacity: 0.8;
}

.about-divider {
  width: 60px;
  height: 2px;
  background: linear-gradient(90deg, var(--pink), var(--cyan));
  border-radius: 1px;
  margin: 16px 0;
  box-shadow: 0 0 10px var(--pink-glow);
}

.about-text {
  color: var(--text);
  font-size: 14px;
  line-height: 1.7;
  max-width: 320px;
  margin-bottom: 8px;
  opacity: 0.85;
}

.about-text strong {
  color: var(--pink-light);
  font-weight: 700;
}

.about-footer {
  color: var(--text-dim);
  font-size: 13px;
  margin-top: 12px;
}

.about-footer strong {
  background: linear-gradient(135deg, var(--pink), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.about-version {
  margin-top: 16px;
  padding: 4px 16px;
  border: 1px solid rgba(255, 20, 147, 0.2);
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-dim);
  font-family: monospace;
}

/* ===================================================================
   UTILITY
   =================================================================== */
.hidden {
  display: none !important;
}

/* ===================================================================
   RESPONSIVE
   =================================================================== */
@media (max-width: 500px) {
  #app {
    max-width: 100%;
    border: none;
    box-shadow: none;
  }
}

@media (min-width: 768px) {
  body {
    background: radial-gradient(ellipse at center, #0f0025, #050008);
  }
}