:root {
  --bg-color: #090b10;
  --bg-card: rgba(22, 27, 39, 0.7);
  --bg-glass: rgba(255, 255, 255, 0.04);
  --border-glass: rgba(255, 255, 255, 0.08);
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --primary-cyan: #06b6d4;
  --accent-blue: #3b82f6;
  --glow-cyan: rgba(6, 182, 212, 0.45);
  --glow-blue: rgba(59, 130, 246, 0.35);
  --status-green: #10b981;
  --status-red: #ef4444;
  --status-amber: #f59e0b;
  --status-purple: #a855f7;
  --font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-main);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  direction: rtl;
  display: flex;
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle at 50% 25%, #151d30 0%, #090b10 70%);
}

.app-container {
  width: 100%;
  max-width: 480px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px 20px calc(16px + env(safe-area-inset-bottom, 0px)) 20px;
  position: relative;
}

/* Header */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 4px;
}

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

.brand-avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(59, 130, 246, 0.1));
  border: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-cyan);
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.15);
}

.brand-info h1 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #ffffff;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(8px);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--status-amber);
  transition: all 0.3s ease;
}

.connection-status.connected .status-dot {
  background-color: var(--status-green);
  box-shadow: 0 0 8px var(--status-green);
}

.connection-status.disconnected .status-dot {
  background-color: var(--status-red);
  box-shadow: 0 0 8px var(--status-red);
}

.status-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Visualizer Area */
.visualizer-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  position: relative;
  margin: 10px 0;
}

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

#orbCanvas {
  width: 280px;
  height: 280px;
  z-index: 2;
  position: relative;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.orb-wrapper:hover #orbCanvas {
  transform: scale(1.03);
}

.orb-wrapper:active #orbCanvas {
  transform: scale(0.97);
}

.orb-aura {
  position: absolute;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--glow-cyan) 0%, transparent 70%);
  filter: blur(35px);
  z-index: 1;
  opacity: 0.7;
  transition: all 0.5s ease;
  animation: pulse-aura 4s ease-in-out infinite alternate;
}

@keyframes pulse-aura {
  0% { transform: scale(0.9); opacity: 0.5; }
  100% { transform: scale(1.25); opacity: 0.85; }
}

/* State Badge */
.state-badge-container {
  margin-top: 10px;
  margin-bottom: 12px;
}

.state-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 18px;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--primary-cyan);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  transition: all 0.3s ease;
}

.state-icon {
  font-size: 0.65rem;
  animation: blink-dot 1.2s infinite;
}

.state-badge.listening {
  color: var(--status-green);
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.25);
}
.state-badge.listening .state-icon {
  color: var(--status-green);
}

.state-badge.thinking {
  color: var(--status-amber);
  border-color: rgba(245, 158, 11, 0.4);
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.25);
}
.state-badge.thinking .state-icon {
  color: var(--status-amber);
}

.state-badge.speaking {
  color: var(--primary-cyan);
  border-color: rgba(6, 182, 212, 0.5);
  box-shadow: 0 0 16px var(--glow-cyan);
}
.state-badge.speaking .state-icon {
  color: var(--primary-cyan);
}

.state-badge.error {
  color: var(--status-red);
  border-color: rgba(239, 68, 68, 0.4);
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.25);
}
.state-badge.error .state-icon {
  color: var(--status-red);
}

@keyframes blink-dot {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

/* Dialogue Box */
.dialogue-box {
  width: 100%;
  min-height: 90px;
  max-height: 130px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  padding: 10px 14px;
  border-radius: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(12px);
  scrollbar-width: none;
}

.dialogue-box::-webkit-scrollbar {
  display: none;
}

.bubble {
  font-size: 0.82rem;
  line-height: 1.5;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  transition: opacity 0.3s ease;
}

.bubble-tag {
  font-weight: 700;
  white-space: nowrap;
}

.user-bubble {
  color: #7dd3fc;
}

.user-bubble .bubble-tag {
  color: var(--primary-cyan);
}

.bot-bubble {
  color: var(--text-main);
}

.bot-bubble .bubble-tag {
  color: var(--accent-blue);
}

/* Controls Dock */
.controls-dock {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 10px 0;
  position: relative;
}

.top-status-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.call-timer-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 14px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  font-size: 0.78rem;
  font-weight: 700;
  color: #10b981;
  letter-spacing: 0.5px;
}

.timer-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #10b981;
  animation: blink-dot 1s infinite;
}

.action-btn {
  border: none;
  cursor: pointer;
  outline: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.secondary-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
}

.secondary-btn:hover {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.secondary-btn:active {
  transform: scale(0.94);
}

.secondary-btn.muted {
  color: var(--status-red);
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.1);
}

/* Call Button - Phone Style */
.call-btn {
  min-width: 140px;
  height: 64px;
  padding: 0 20px;
  border-radius: 32px;
  color: #ffffff;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--font-family);
  font-size: 0.95rem;
  font-weight: 700;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.call-btn.start-call {
  background: linear-gradient(135deg, #10b981, #059669);
  box-shadow: 0 0 25px rgba(16, 185, 129, 0.4);
}

.call-btn.start-call:hover {
  transform: scale(1.04);
  box-shadow: 0 0 35px rgba(16, 185, 129, 0.6);
}

.call-btn.in-call {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  box-shadow: 0 0 30px rgba(239, 68, 68, 0.5);
  animation: call-pulse 2s infinite;
}

.call-btn.in-call:hover {
  transform: scale(1.04);
  box-shadow: 0 0 40px rgba(239, 68, 68, 0.7);
}

.call-btn-pulse {
  position: absolute;
  inset: -4px;
  border-radius: 36px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  opacity: 0;
  pointer-events: none;
}

.call-btn.in-call .call-btn-pulse {
  animation: ripple-call 2s infinite;
}

@keyframes call-pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

@keyframes ripple-call {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(1.15); opacity: 0; }
}
