/* ============================================================
   Power Fitness Pro — Chat Interface
   Dark Athleisure Aesthetic
   ============================================================ */

:root {
  --bg-deep: #0a0a0f;
  --bg-surface: #12121a;
  --bg-elevated: #1a1a26;
  --bg-input: #161622;
  --border-subtle: #252538;
  --border-active: #FF6B35;
  --text-primary: #e8e8f0;
  --text-secondary: #8888a0;
  --text-muted: #555570;
  --accent-fire: #FF6B35;
  --accent-rose: #FF3E6C;
  --accent-glow: #FF6B3540;
  --accent-rose-glow: #FF3E6C30;
  --success: #34D399;
  --warning: #FBBF24;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 24px;
  --font-brand: 'Bebas Neue', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --shadow-glow: 0 0 30px var(--accent-glow);
  --transition-fast: 150ms ease;
  --transition-smooth: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-deep);
}

/* ─── Background effects ─────────────────────────────── */

.grid-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image:
    linear-gradient(rgba(255,107,53,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,107,53,0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 80% 50% at 50% 50%, black 40%, transparent 70%);
}

.scanline {
  position: fixed;
  inset: 0;
  z-index: 0;
  opacity: 0.015;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(255,255,255,0.3) 2px,
    rgba(255,255,255,0.3) 4px
  );
  pointer-events: none;
}

/* ─── App layout ─────────────────────────────────────── */

.app-container {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 800px;
  margin: 0 auto;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-subtle);
  border-right: 1px solid var(--border-subtle);
}

/* ─── Header ─────────────────────────────────────────── */

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.header-left { display: flex; align-items: center; gap: 14px; }
.logo-mark { position: relative; }
.logo-svg { width: 44px; height: 44px; display: block; }

.brand-name {
  font-family: var(--font-brand);
  font-size: 22px;
  font-weight: 400;
  letter-spacing: 2px;
  color: var(--text-primary);
  line-height: 1;
}
.brand-name .accent {
  background: linear-gradient(135deg, var(--accent-fire), var(--accent-rose));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.brand-tagline {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-muted);
}

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

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  font-size: 11px;
  color: var(--text-secondary);
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; }
.status-dot.online { background: var(--success); box-shadow: 0 0 8px var(--success); }
.status-dot.offline { background: var(--warning); box-shadow: 0 0 8px var(--warning); }

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.btn-icon:hover { border-color: var(--accent-fire); color: var(--accent-fire); }

/* ─── Quick Actions ──────────────────────────────────── */

.quick-actions {
  display: flex;
  gap: 10px;
  padding: 14px 20px;
  overflow-x: auto;
  flex-shrink: 0;
  scrollbar-width: none;
}
.quick-actions::-webkit-scrollbar { display: none; }

.quick-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
  transition: all var(--transition-smooth);
  flex-shrink: 0;
}
.quick-btn:hover {
  border-color: var(--accent-fire);
  color: var(--text-primary);
  background: var(--bg-input);
  transform: translateY(-1px);
  box-shadow: 0 4px 15px var(--accent-glow);
}
.qb-icon { font-size: 16px; }

/* ─── Chat Area ──────────────────────────────────────── */

.chat-area {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  scroll-behavior: smooth;
}

.messages-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ─── Message bubbles ────────────────────────────────── */

.message-bubble {
  display: flex;
  gap: 10px;
  max-width: 88%;
  animation: fadeInUp 0.35s var(--transition-smooth) both;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

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

.bubble-avatar {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
}

.message-bubble.agent .bubble-avatar {
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
}

.message-bubble.user .bubble-avatar {
  background: linear-gradient(135deg, var(--accent-fire), var(--accent-rose));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.bubble-content {
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  position: relative;
}

.message-bubble.agent .bubble-content {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-top-left-radius: 4px;
}

.message-bubble.user .bubble-content {
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  border: 1px solid var(--accent-rose-glow);
  border-top-right-radius: 4px;
}

.bubble-text {
  line-height: 1.65;
  color: var(--text-primary);
  font-size: 13px;
}
.bubble-text + .bubble-text { margin-top: 8px; }

.bubble-list {
  list-style: none;
  margin: 8px 0;
  padding: 0;
}
.bubble-list li {
  padding: 4px 0;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.bubble-time {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 6px;
}

.bubble-text strong {
  color: var(--accent-fire);
  font-weight: 500;
}

/* ─── Typing Indicator ───────────────────────────────── */

.typing-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px 12px;
  flex-shrink: 0;
}

.typing-dots {
  display: flex;
  gap: 4px;
}
.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-fire);
  animation: typingBounce 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

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

.typing-label {
  font-size: 11px;
  color: var(--text-muted);
}

/* ─── Input Area ─────────────────────────────────────── */

.input-area {
  flex-shrink: 0;
  border-top: 1px solid var(--border-subtle);
  padding: 12px 20px 16px;
  background: var(--bg-elevated);
}

.input-container {
  display: flex;
  gap: 10px;
  align-items: center;
}

.message-input {
  flex: 1;
  padding: 12px 18px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition-fast);
}
.message-input:focus {
  border-color: var(--accent-fire);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.message-input::placeholder { color: var(--text-muted); }

.send-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--accent-fire), var(--accent-rose));
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  transition: all var(--transition-smooth);
  flex-shrink: 0;
}
.send-btn:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-glow);
}
.send-btn:active { transform: scale(0.96); }
.send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.input-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 8px;
}

.footer-badge {
  display: inline-block;
  padding: 2px 8px;
  background: var(--accent-glow);
  color: var(--accent-fire);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
}

.footer-text {
  font-size: 10px;
  color: var(--text-muted);
}

/* ─── Scrollbar ──────────────────────────────────────── */

.chat-area::-webkit-scrollbar { width: 5px; }
.chat-area::-webkit-scrollbar-track { background: transparent; }
.chat-area::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 3px;
}

/* ─── Connection toast ───────────────────────────────── */

.connection-toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  padding: 10px 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--warning);
  border-radius: var(--radius-md);
  color: var(--warning);
  font-size: 12px;
  animation: fadeInUp 0.3s ease;
  display: none;
}
.connection-toast.show { display: block; }

/* ─── Responsive ─────────────────────────────────────── */

@media (max-width: 600px) {
  .app-container { max-width: 100%; border: none; }
  .header { padding: 10px 14px; }
  .brand-name { font-size: 18px; }
  .quick-actions { padding: 10px 14px; gap: 6px; }
  .quick-btn { padding: 8px 12px; font-size: 11px; }
  .chat-area { padding: 12px 14px; }
  .message-bubble { max-width: 92%; }
  .input-area { padding: 10px 14px 14px; }
}
