:root {
  --font-family-sans: 'Vazirmatn', system-ui, -apple-system, sans-serif;
  --font-family-display: 'Outfit', sans-serif;
  
  --bg-color: #0c0a09; /* stone-950 */
  --panel-bg: #1c1917; /* stone-900 */
  --text-main: #f8fafc;
  --text-muted: #a8a29e; /* stone-400 */
  --accent: #FF8C00; /* brand-orange */
  
  --bg-card: rgba(28, 25, 23, 0.6); /* stone-900 with opacity */
  --border-color: rgba(255, 255, 255, 0.08);
  
  --color-text: #e2e8f0;
  --color-muted: #a8a29e;
  
  /* Status Colors */
  --status-disconnected: #E60000; /* brand-red */
  --status-connecting: #FF8C00; /* brand-orange */
  --status-connected: #10b981;
  
  /* Aiolexa Brand Accents */
  --accent-cyan: #FF8C00; /* brand-orange */
  --accent-purple: #E60000; /* brand-red */
  --accent-teal: #FF8C00;
  
  --glow-shadow-cyan: 0 0 30px rgba(255, 140, 0, 0.4);
  --glow-shadow-purple: 0 0 30px rgba(230, 0, 0, 0.4);
  --glow-shadow-teal: 0 0 30px rgba(255, 140, 0, 0.4);
}

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

body {
  font-family: 'Vazirmatn', system-ui, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  position: relative;
}

/* Background Animated Glows */
.background-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(230, 0, 0, 0.08) 0%, rgba(255, 140, 0, 0.06) 50%, rgba(0, 0, 0, 0) 70%);
  filter: blur(80px);
  z-index: -1;
  pointer-events: none;
  animation: glow-float 20s ease-in-out infinite alternate;
}

@keyframes glow-float {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 0.8; }
  100% { transform: translate(-45%, -55%) scale(1.2); opacity: 1; }
}

/* Container */
.container {
  width: 100%;
  max-width: 520px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  z-index: 1;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.logo-accent {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Status Badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(5px);
  transition: all 0.3s ease;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* Status Modes */
.status-badge.disconnected .status-dot { background-color: var(--status-disconnected); box-shadow: 0 0 8px var(--status-disconnected); }
.status-badge.connecting .status-dot { background-color: var(--status-connecting); box-shadow: 0 0 8px var(--status-connecting); animation: status-blink 1s infinite alternate; }
.status-badge.connected .status-dot { background-color: var(--status-connected); box-shadow: 0 0 8px var(--status-connected); }

@keyframes status-blink {
  0% { opacity: 0.3; }
  100% { opacity: 1; }
}

/* Main Operator Card */
.operator-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

/* Visualizer Container */
.visualizer-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  height: 240px;
}

.avatar-ring-container {
  position: relative;
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-glow {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.02);
  transition: all 0.5s ease;
  z-index: 1;
}

/* Visual Glow States */
.visualizer-container.idle .avatar-glow {
  background: radial-gradient(circle, rgba(255, 140, 0, 0.1) 0%, rgba(0,0,0,0) 70%);
}
.visualizer-container.connecting .avatar-glow {
  background: radial-gradient(circle, rgba(255, 140, 0, 0.15) 0%, rgba(0,0,0,0) 70%);
  animation: pulse-glow 2s infinite ease-in-out;
}
.visualizer-container.listening .avatar-glow {
  background: radial-gradient(circle, rgba(255, 140, 0, 0.25) 0%, rgba(0,0,0,0) 70%);
  box-shadow: var(--glow-shadow-cyan);
}
.visualizer-container.speaking .avatar-glow {
  background: radial-gradient(circle, rgba(230, 0, 0, 0.25) 0%, rgba(0,0,0,0) 70%);
  box-shadow: var(--glow-shadow-purple);
}

@keyframes pulse-glow {
  0%, 100% { opacity: 0.5; transform: scale(0.95); }
  50% { opacity: 1; transform: scale(1.05); }
}

/* Animated Ring Effects */
.avatar-ring {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  transition: border-color 0.5s ease;
}

.ring-1 { width: 180px; height: 180px; }
.ring-2 { width: 230px; height: 230px; }
.ring-3 { width: 280px; height: 280px; }

.visualizer-container.listening .avatar-ring {
  border-color: rgba(255, 140, 0, 0.15);
}
.visualizer-container.speaking .avatar-ring {
  border-color: rgba(230, 0, 0, 0.15);
}

.visualizer-container.listening .ring-1 { animation: ripple 3s infinite linear; }
.visualizer-container.listening .ring-2 { animation: ripple 3s infinite linear 1s; }
.visualizer-container.listening .ring-3 { animation: ripple 3s infinite linear 2s; }

.visualizer-container.speaking .ring-1 { animation: ripple 2s infinite linear; }
.visualizer-container.speaking .ring-2 { animation: ripple 2s infinite linear 0.6s; }
.visualizer-container.speaking .ring-3 { animation: ripple 2s infinite linear 1.2s; }

@keyframes ripple {
  0% { transform: scale(0.9); opacity: 0.1; }
  50% { opacity: 0.5; }
  100% { transform: scale(1.15); opacity: 0; }
}

/* Mic Button */
.mic-button {
  position: relative;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, rgba(28, 25, 23, 0.8) 0%, rgba(12, 10, 9, 0.9) 100%);
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  color: var(--color-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.mic-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.mic-icon {
  width: 32px;
  height: 32px;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Hover & Active States */
.mic-button:not(:disabled):hover {
  transform: scale(1.05);
  color: var(--color-text);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}

.visualizer-container.listening .mic-button {
  background: linear-gradient(135deg, #c2410c 0%, #ea580c 100%);
  border-color: var(--accent-cyan);
  color: #fff;
  box-shadow: var(--glow-shadow-cyan);
}

.visualizer-container.speaking .mic-button {
  background: linear-gradient(135deg, #991b1b 0%, #dc2626 100%);
  border-color: var(--accent-purple);
  color: #fff;
  box-shadow: var(--glow-shadow-purple);
}

/* Tooltip */
.mic-tooltip {
  position: absolute;
  bottom: -40px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.5px;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-5px);
  transition: all 0.3s ease;
  color: var(--color-text);
}

.mic-button:hover .mic-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Visualizer Wave Canvas */
.audio-wave {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 60px;
  opacity: 0.35;
  pointer-events: none;
  z-index: 1;
  transition: opacity 0.5s ease;
}

.visualizer-container.idle .audio-wave {
  opacity: 0.1;
}

/* Info Box */
.info-text {
  font-family: 'Vazirmatn', system-ui, sans-serif;
  font-size: 0.95rem;
  color: var(--text-main);
  line-height: 1.6;
  margin-bottom: 8px;
}

/* Transcript Box */
.transcript-box {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  height: 110px;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.6;
  color: var(--color-text);
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.05) transparent;
}

.transcript-placeholder {
  color: rgba(255, 255, 255, 0.2);
  font-style: italic;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-size: 13px;
}

/* Form Settings Drawer */
.settings-drawer {
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s ease;
}

.settings-summary {
  list-style: none;
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
  color: var(--color-muted);
  transition: color 0.2s ease;
}

.settings-summary:hover {
  color: var(--color-text);
}

.settings-summary::-webkit-details-marker {
  display: none;
}

.settings-icon {
  width: 16px;
  height: 16px;
  transition: transform 0.3s ease;
}

.settings-drawer[open] .settings-icon {
  transform: rotate(45deg);
}

.settings-content {
  padding: 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Form Controls */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

label {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-muted);
}

input[type="password"], select, textarea {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--color-text);
  font-family: var(--font-family-sans);
  font-size: 13px;
  outline: none;
  transition: all 0.3s ease;
}

textarea {
  resize: vertical;
  min-height: 60px;
}

input[type="password"]:focus, select:focus, textarea:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.15);
}

/* Footer styling */
.app-footer {
  text-align: center;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.15);
  letter-spacing: 0.5px;
}

/* Mobile Responsive */
@media (max-width: 480px) {
  body {
    padding: 0;
  }
  .container {
    width: 100vw;
    height: 100vh;
    max-width: 100%;
    margin: 0;
    padding: 15px;
    border: none;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
  }
  .operator-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  .control-panel {
    margin-top: auto;
  }
  .background-glow {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
  }
}
