/* ============================================================
   JARWO AI ASSISTANT - Futuristic Dark Theme
   ============================================================ */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #050510;
  color: #d0d0e0;
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* --- Animated Grid Background --- */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background-image:
    linear-gradient(rgba(0, 212, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 212, 255, 0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  z-index: 0;
  pointer-events: none;
}

/* --- Particle Canvas --- */
#particles {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.4;
}

/* --- Container --- */
.container {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 20px 40px;
  min-height: 100vh;
}

/* --- Header --- */
header {
  text-align: center;
  padding: 20px 0 10px;
}

h1 {
  font-family: 'Orbitron', sans-serif;
  font-size: 3.2rem;
  font-weight: 900;
  background: linear-gradient(135deg, #00d4ff 0%, #7c3aed 50%, #00d4ff 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 4s ease-in-out infinite;
  letter-spacing: 6px;
  text-shadow: none;
  filter: drop-shadow(0 0 30px rgba(0, 212, 255, 0.25));
}

.subtitle {
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  font-weight: 300;
  letter-spacing: 10px;
  -webkit-text-fill-color: rgba(255, 255, 255, 0.35);
  display: block;
  margin-top: 4px;
}

@keyframes shimmer {
  0%, 100% { background-position: 0% center; }
  50% { background-position: 100% center; }
}

/* --- Visualizer Container --- */
.visualizer-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 0 16px;
  gap: 16px;
}

/* --- Radar --- */
.radar {
  position: relative;
  width: 170px;
  height: 170px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.radar-ring {
  position: absolute;
  border-radius: 50%;
  border: 1.5px solid rgba(0, 212, 255, 0.13);
  animation: pulse-ring 2.5s ease-out infinite;
}

.ring-1 { width: 100%; height: 100%; animation-delay: 0s; border-color: rgba(0, 212, 255, 0.10); }
.ring-2 { width: 72%; height: 72%; animation-delay: 0.6s; border-color: rgba(0, 212, 255, 0.12); }
.ring-3 { width: 44%; height: 44%; animation-delay: 1.2s; border-color: rgba(0, 212, 255, 0.15); }

.radar-dot {
  position: relative;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #00d4ff;
  box-shadow: 0 0 16px rgba(0, 212, 255, 0.6), 0 0 40px rgba(0, 212, 255, 0.2);
  transition: all 0.4s ease;
  z-index: 2;
}

.radar-dot::after {
  content: '';
  position: absolute;
  top: -6px; left: -6px;
  width: calc(100% + 12px);
  height: calc(100% + 12px);
  border-radius: 50%;
  border: 2px solid rgba(0, 212, 255, 0.1);
  animation: pulse-ring 1.8s ease-out infinite;
}

@keyframes pulse-ring {
  0%   { transform: scale(0.85); opacity: 0.6; }
  50%  { opacity: 0.2; }
  100% { transform: scale(1.25); opacity: 0; }
}

/* --- Radar State: LISTENING --- */
.radar.listening .radar-dot {
  background: #10b981;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.7), 0 0 50px rgba(16, 185, 129, 0.25);
  animation: pulse-listen 1.2s ease-in-out infinite;
}
.radar.listening .radar-dot::after {
  border-color: rgba(16, 185, 129, 0.15);
}
.radar.listening .radar-ring {
  border-color: rgba(16, 185, 129, 0.15);
}
@keyframes pulse-listen {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

/* --- Radar State: SPEAKING --- */
.radar.speaking .radar-dot {
  background: #f59e0b;
  box-shadow: 0 0 24px rgba(245, 158, 11, 0.7), 0 0 55px rgba(245, 158, 11, 0.25);
  animation: pulse-speak 0.6s ease-in-out infinite;
}
.radar.speaking .radar-dot::after {
  border-color: rgba(245, 158, 11, 0.15);
}
.radar.speaking .radar-ring {
  border-color: rgba(245, 158, 11, 0.12);
}
@keyframes pulse-speak {
  0%, 100% { transform: scale(1); box-shadow: 0 0 20px rgba(245,158,11,0.5); }
  50% { transform: scale(1.15); box-shadow: 0 0 35px rgba(245,158,11,0.8); }
}

/* --- Radar State: RECORDING --- */
.radar.recording .radar-dot {
  background: #ef4444;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.7), 0 0 50px rgba(239, 68, 68, 0.25);
  animation: pulse-record 0.4s ease-in-out infinite;
}
.radar.recording .radar-dot::after {
  border-color: rgba(239, 68, 68, 0.15);
  animation-duration: 0.8s;
}
.radar.recording .radar-ring {
  border-color: rgba(239, 68, 68, 0.12);
}
@keyframes pulse-record {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(0.85); }
}

/* --- Radar State: ERROR --- */
.radar.error .radar-dot {
  background: #ef4444;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.4);
  animation: none;
}

/* --- Wave Bars --- */
.wave-bars {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 30px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

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

.wave-bar {
  width: 3px;
  background: #ef4444;
  border-radius: 2px;
  height: 4px;
  animation: wave-move 0.6s ease-in-out infinite alternate;
}

.wave-bars.active .wave-bar:nth-child(1) { animation-delay: 0.0s; }
.wave-bars.active .wave-bar:nth-child(2) { animation-delay: 0.07s; }
.wave-bars.active .wave-bar:nth-child(3) { animation-delay: 0.14s; }
.wave-bars.active .wave-bar:nth-child(4) { animation-delay: 0.21s; }
.wave-bars.active .wave-bar:nth-child(5) { animation-delay: 0.28s; }
.wave-bars.active .wave-bar:nth-child(6) { animation-delay: 0.21s; }
.wave-bars.active .wave-bar:nth-child(7) { animation-delay: 0.14s; }
.wave-bars.active .wave-bar:nth-child(8) { animation-delay: 0.07s; }

@keyframes wave-move {
  0%   { height: 4px; }
  100% { height: 26px; }
}

/* --- Status --- */
.status-container {
  text-align: center;
  padding: 8px 0 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  background: #00d4ff;
  box-shadow: 0 0 8px rgba(0, 212, 255, 0.6);
  transition: all 0.4s ease;
}

.status-text {
  font-family: 'Orbitron', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 4px;
  transition: color 0.4s ease;
}

/* --- Panels (Transcript, Response) --- */
.transcript-container,
.response-container {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 14px 18px;
  margin: 8px 0;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all 0.3s ease;
}

.panel-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 3px;
  color: rgba(255, 255, 255, 0.25);
  margin-bottom: 6px;
}

.transcript-text {
  font-size: 1.1rem;
  color: #7dd3fc;
  min-height: 1.6em;
  line-height: 1.4;
  font-weight: 400;
}

.response-text {
  font-size: 1rem;
  color: #fcd34d;
  min-height: 1.6em;
  line-height: 1.4;
  font-weight: 400;
}

/* --- Recording Info --- */
.recording-info {
  text-align: center;
  padding: 16px;
  margin: 8px 0;
  background: rgba(239, 68, 68, 0.04);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 14px;
  animation: glow-red 1.2s ease-in-out infinite alternate;
}

@keyframes glow-red {
  from { box-shadow: 0 0 6px rgba(239, 68, 68, 0.15); }
  to   { box-shadow: 0 0 24px rgba(239, 68, 68, 0.3); }
}

.recording-timer {
  font-family: 'Orbitron', sans-serif;
  font-size: 2.2rem;
  font-weight: 700;
  color: #ef4444;
  letter-spacing: 2px;
}

.recording-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.65rem;
  letter-spacing: 4px;
  color: rgba(239, 68, 68, 0.7);
  margin-top: 4px;
}

/* --- Audio Player --- */
.audio-player-container {
  padding: 14px;
  margin: 8px 0;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
}

.audio-player-container audio {
  width: 100%;
  border-radius: 6px;
}

.recording-meta {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 8px;
  text-align: center;
  font-family: 'Inter', sans-serif;
}

/* --- Buttons --- */
.button-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  padding: 16px 0;
}

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 10px;
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  position: relative;
  overflow: hidden;
}

.btn:disabled {
  opacity: 0.25;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.btn:not(:disabled):hover {
  transform: translateY(-2px);
}

.btn:not(:disabled):active {
  transform: translateY(0);
}

.btn-primary {
  background: linear-gradient(135deg, #00d4ff, #0088cc);
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 212, 255, 0.25);
}
.btn-primary:not(:disabled):hover {
  box-shadow: 0 6px 24px rgba(0, 212, 255, 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: #c0c0d0;
  border: 1px solid rgba(255, 255, 255, 0.10);
}
.btn-secondary:not(:disabled):hover {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.20);
}

.btn-record {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.2);
}
.btn-record:not(:disabled):hover {
  box-shadow: 0 6px 24px rgba(16, 185, 129, 0.35);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.2);
}
.btn-danger:not(:disabled):hover {
  box-shadow: 0 6px 24px rgba(239, 68, 68, 0.35);
}

.btn-accent {
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  color: #fff;
  box-shadow: 0 4px 14px rgba(139, 92, 246, 0.2);
}
.btn-accent:not(:disabled):hover {
  box-shadow: 0 6px 24px rgba(139, 92, 246, 0.35);
}

.btn-ghost {
  background: transparent;
  color: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.10);
}
.btn-ghost:not(:disabled):hover {
  color: #f59e0b;
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.05);
}

/* --- Support Notice --- */
.support-notice {
  display: none;
  text-align: center;
  padding: 12px;
  margin: 8px 0;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 10px;
  color: #ef4444;
  font-size: 0.85rem;
}

.support-notice.visible {
  display: block;
}

/* --- History --- */
.history-container {
  margin: 20px 0;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 14px;
}

.history-list {
  max-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.history-empty {
  color: rgba(255, 255, 255, 0.2);
  font-size: 0.85rem;
  font-style: italic;
  padding: 4px 0;
}

.history-item {
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.6);
  transition: background 0.2s;
}

.history-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

.history-item .time {
  color: rgba(255, 255, 255, 0.25);
  margin-right: 8px;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.65rem;
}

/* --- Privacy Footer --- */
.privacy-footer {
  text-align: center;
  padding: 24px 0 8px;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.15);
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0, 212, 255, 0.2); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 212, 255, 0.35); }

/* --- Responsive --- */
@media (max-width: 600px) {
  .container { padding: 16px 14px 30px; }

  h1 {
    font-size: 2rem;
    letter-spacing: 3px;
  }
  .subtitle {
    font-size: 0.6rem;
    letter-spacing: 6px;
  }

  .radar { width: 130px; height: 130px; }
  .radar-dot { width: 14px; height: 14px; }

  .status-text { font-size: 0.85rem; }

  .transcript-text { font-size: 0.95rem; }
  .response-text  { font-size: 0.9rem; }

  .recording-timer { font-size: 1.6rem; }

  .button-container { flex-direction: column; gap: 6px; }
  .btn { width: 100%; text-align: center; padding: 12px 16px; }
}
