/* ==========================================================================
   J.A.R.V.I.S. — LUXURY HOLOGRAPHIC VOICE INTERFACE
   Aesthetic: Floating Frosted Glass Card & Glowing Arc Horizon
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg-deep: #020612;
  --bg-space: #050b18;
  
  --card-glass: rgba(13, 22, 42, 0.6);
  --card-glass-hover: rgba(18, 30, 58, 0.7);
  --card-border: rgba(255, 255, 255, 0.12);
  --card-border-glow: rgba(56, 189, 248, 0.35);

  --stark-cyan: #38bdf8;
  --stark-blue: #2563eb;
  --stark-glow: rgba(56, 189, 248, 0.4);
  --stark-ambient: rgba(37, 99, 235, 0.25);
  
  --text-pure: #ffffff;
  --text-primary: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --font-display: 'Plus Jakarta Sans', 'Inter', -apple-system, sans-serif;
  --font-body: 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-card: 28px;
  --radius-pill: 9999px;
  --radius-sm: 12px;
  --blur-glass: blur(32px);
  --ease-spring: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

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

/* Background Glowing Arc Horizon (Luminous bottom crescent glow like the screenshot) */
.stage-horizon {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
  background: radial-gradient(circle at 50% 30%, #060e22 0%, #020612 100%);
}

.stage-horizon::before {
  content: "";
  position: absolute;
  bottom: -40vh;
  left: 50%;
  transform: translateX(-50%);
  width: min(1200px, 140vw);
  height: min(1200px, 140vw);
  border-radius: 50%;
  border: 2px solid rgba(56, 189, 248, 0.6);
  box-shadow:
    0 0 100px rgba(56, 189, 248, 0.45),
    0 0 180px rgba(37, 99, 235, 0.35),
    inset 0 0 80px rgba(56, 189, 248, 0.25);
  background: radial-gradient(circle at 50% 0%, rgba(37, 99, 235, 0.15) 0%, transparent 60%);
  filter: blur(1px);
}

.stage-horizon::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100vw;
  height: 45vh;
  background: radial-gradient(ellipse at 50% 100%, rgba(56, 189, 248, 0.2) 0%, rgba(37, 99, 235, 0.08) 40%, transparent 75%);
  pointer-events: none;
}

/* Main Container */
.app-viewport {
  position: relative;
  z-index: 2;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 24px 32px;
}

/* Header Top Corner Badges (Like the screenshot: Daily Challenge / Day 14/23) */
header.app-header {
  width: 100%;
  max-width: 1200px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.glass-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.09);
  backdrop-filter: var(--blur-glass);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--ease-spring);
  text-decoration: none;
}

.glass-pill:hover {
  background: rgba(30, 41, 59, 0.6);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text-pure);
  transform: translateY(-1px);
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--stark-cyan);
  box-shadow: 0 0 8px var(--stark-cyan);
}

/* ==========================================================================
   FLOATING FROSTED GLASS VOICE CARD (THE HERO)
   ========================================================================== */
.card-stage-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  flex: 1;
}

.voice-card {
  position: relative;
  width: min(380px, 90vw);
  height: min(520px, 72vh);
  background: linear-gradient(175deg, rgba(16, 28, 54, 0.75) 0%, rgba(6, 12, 26, 0.85) 100%);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-card);
  backdrop-filter: var(--blur-glass);
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.5),
    0 0 40px rgba(56, 189, 248, 0.08),
    inset 0 1px 1px rgba(255, 255, 255, 0.2);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 32px 28px;
  overflow: hidden;
  transition: var(--ease-spring);
}

.voice-card:hover {
  border-color: var(--card-border-glow);
  box-shadow:
    0 28px 70px rgba(0, 0, 0, 0.6),
    0 0 50px rgba(56, 189, 248, 0.15),
    inset 0 1px 1px rgba(255, 255, 255, 0.3);
}

/* Card Header with Close/Dismiss button */
.card-header {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.close-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: var(--ease-spring);
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-pure);
  transform: scale(1.08);
}

/* Spoken Prompt / Conversation Text */
.card-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding-top: 10px;
}

.speech-prompt {
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 1.5;
  font-weight: 400;
  color: #cbd5e1;
  letter-spacing: -0.01em;
  transition: var(--ease-spring);
  word-break: break-word;
}

.speech-prompt strong, .speech-prompt .highlight {
  color: var(--text-pure);
  font-weight: 700;
}

.speech-status {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--stark-cyan);
  margin-top: 8px;
  letter-spacing: 0.04em;
}

/* Waveform Canvas Area */
.waveform-container {
  position: relative;
  width: 100%;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 10px 0;
}

.wave-canvas {
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Bottom Action / White Glowing Microphone Button */
.card-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.mic-button {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #ffffff;
  border: none;
  box-shadow:
    0 10px 30px rgba(56, 189, 248, 0.5),
    0 4px 12px rgba(0, 0, 0, 0.3);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s;
  position: relative;
  z-index: 5;
}

.mic-button:hover {
  transform: scale(1.08);
  box-shadow:
    0 14px 40px rgba(56, 189, 248, 0.7),
    0 0 20px rgba(255, 255, 255, 0.5);
}

.mic-button:active {
  transform: scale(0.95);
}

.mic-button svg {
  width: 22px;
  height: 22px;
  fill: #0f172a;
  transition: fill 0.2s;
}

/* Active listening / speaking pulse on card */
body.listening .voice-card {
  border-color: rgba(239, 68, 68, 0.5);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.6), 0 0 50px rgba(239, 68, 68, 0.2);
}

body.listening .mic-button {
  background: #ef4444;
  box-shadow: 0 10px 35px rgba(239, 68, 68, 0.7);
}
body.listening .mic-button svg {
  fill: #ffffff;
}

body.speaking .mic-button {
  background: var(--stark-cyan);
  box-shadow: 0 10px 35px rgba(56, 189, 248, 0.8);
}
body.speaking .mic-button svg {
  fill: #020612;
}

/* Quick Text Bar Drawer Toggle */
.quick-input-row {
  width: 100%;
  margin-top: 14px;
  display: flex;
  gap: 8px;
}

.quick-input-row input {
  flex: 1;
  background: rgba(2, 6, 23, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-pill);
  padding: 8px 16px;
  color: var(--text-pure);
  font-family: var(--font-body);
  font-size: 12px;
  outline: none;
  transition: var(--ease-spring);
}

.quick-input-row input:focus {
  border-color: var(--stark-cyan);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.2);
}

/* ==========================================================================
   FOOTER USER BADGE (Like @mhmoradi in screenshot)
   ========================================================================== */
footer.app-footer {
  width: 100%;
  max-width: 1200px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 16px 6px 8px;
  border-radius: var(--radius-pill);
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: var(--blur-glass);
  cursor: pointer;
  transition: var(--ease-spring);
  text-decoration: none;
}

.user-badge:hover {
  background: rgba(30, 41, 59, 0.7);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(56, 189, 248, 0.6);
  object-fit: cover;
}

.user-meta {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.user-handle {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-pure);
}

.user-role {
  font-family: var(--font-body);
  font-size: 10px;
  color: var(--text-muted);
}

/* ==========================================================================
   MODAL (SETTINGS & DIAGNOSTICS)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.85);
  backdrop-filter: var(--blur-glass);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.settings-card {
  width: min(560px, 92vw);
  background: linear-gradient(175deg, rgba(16, 28, 54, 0.95) 0%, rgba(6, 12, 26, 0.98) 100%);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-head {
  padding: 20px 26px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-head h3 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-pure);
}

.modal-tabs {
  display: flex;
  background: rgba(2, 6, 23, 0.5);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0 16px;
  gap: 4px;
}

.modal-tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  padding: 12px 14px;
  cursor: pointer;
  transition: var(--ease-spring);
}

.modal-tab-btn:hover { color: var(--text-pure); }
.modal-tab-btn.active {
  color: var(--stark-cyan);
  border-bottom-color: var(--stark-cyan);
}

.modal-body {
  padding: 22px 26px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 55vh;
  overflow-y: auto;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.form-group input, .form-group select {
  background: rgba(2, 6, 23, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-pure);
  font-family: var(--font-body);
  font-size: 13px;
  outline: none;
}

.form-group input:focus, .form-group select:focus {
  border-color: var(--stark-cyan);
}

.engine-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.engine-box {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 12px;
  cursor: pointer;
  transition: var(--ease-spring);
}

.engine-box:hover {
  background: rgba(30, 41, 59, 0.7);
  border-color: rgba(255, 255, 255, 0.2);
}

.engine-box.selected {
  border-color: var(--stark-cyan);
  background: rgba(56, 189, 248, 0.1);
}

.engine-box h4 {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-pure);
}

.engine-box p {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.modal-foot {
  padding: 16px 26px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: rgba(2, 6, 23, 0.6);
}

.btn-action {
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--ease-spring);
  border: none;
}

.btn-action.ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-action.ghost:hover { color: var(--text-pure); }

.btn-action.primary {
  background: #ffffff;
  color: #0f172a;
}
.btn-action.primary:hover {
  background: var(--stark-cyan);
  box-shadow: 0 4px 15px rgba(56, 189, 248, 0.4);
}

/* Toast */
.toast-msg {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--stark-cyan);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  color: var(--text-pure);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 500;
  padding: 8px 20px;
  border-radius: var(--radius-pill);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s, opacity 0.25s;
  z-index: 200;
}

.toast-msg.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
