:root {
  --bg-color: #0c0a09; /* stone-950 */
  --panel-bg: rgba(28, 25, 23, 0.65); /* stone-900 with opacity */
  --text-main: #f8fafc;
  --text-muted: #a8a29e; /* stone-400 */
  --accent-orange: #FF8C00;
  --accent-red: #E60000;
  --border-color: rgba(255, 255, 255, 0.08);
  
  /* Status Colors */
  --color-disconnected: #dc2626;
  --color-connecting: #ea580c;
  --color-connected: #10b981;

  --font-family: 'Vazirmatn', system-ui, -apple-system, sans-serif;
}

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

body {
  font-family: var(--font-family);
  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;
  padding: 20px 0;
}

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

@keyframes floatGlow {
  0% { transform: translate(-55%, -45%) scale(1); }
  100% { transform: translate(-45%, -55%) scale(1.15); }
}

/* App Container Layout */
.app-container {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 40px;
  width: 100%;
  max-width: 1100px;
  padding: 20px;
  z-index: 10;
  align-items: start;
}

@media (max-width: 900px) {
  .app-container {
    grid-template-columns: 1fr;
    max-width: 520px;
    gap: 30px;
  }
}

/* General Panels style */
.panel {
  background: var(--panel-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 30px 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.panel-header {
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 16px;
}

.logo {
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
}

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

.subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.panel-section {
  margin-bottom: 24px;
}

.panel-section h3 {
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.desc-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  line-height: 1.6;
}

/* Forms */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

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

input[type="text"], input[type="password"], select, textarea {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 12px 14px;
  color: #fff;
  font-family: var(--font-family);
  font-size: 0.85rem;
  outline: none;
  transition: all 0.3s ease;
  width: 100%;
}

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

input:focus, select:focus, textarea:focus {
  border-color: var(--accent-orange);
  box-shadow: 0 0 10px rgba(255, 140, 0, 0.15);
}

/* Tabs */
.tabs {
  display: flex;
  gap: 8px;
  background: rgba(0,0,0,0.2);
  padding: 4px;
  border-radius: 10px;
  margin-bottom: 12px;
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-family);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.tab-btn.active {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.05);
}

/* File upload styling */
.file-upload-box {
  border: 2px dashed var(--border-color);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  position: relative;
  cursor: pointer;
  transition: all 0.3s ease;
}

.file-upload-box:hover {
  border-color: var(--accent-orange);
  background: rgba(255,140,0,0.02);
}

.file-upload-box input[type="file"] {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  opacity: 0;
  cursor: pointer;
}

.file-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Buttons */
.primary-btn {
  background: linear-gradient(135deg, var(--accent-orange) 0%, var(--accent-red) 100%);
  border: none;
  color: #fff;
  font-family: var(--font-family);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 12px 20px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
  box-shadow: 0 8px 16px rgba(230, 0, 0, 0.2);
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(230, 0, 0, 0.35);
}

.status-msg {
  font-size: 0.8rem;
  margin-top: 10px;
  text-align: center;
  font-weight: 500;
}

.status-msg.success { color: var(--color-connected); }
.status-msg.error { color: var(--color-disconnected); }
.status-msg.loading { color: var(--color-connecting); }

/* ==============================================
   PHONE CALL SIMULATOR (SMARTPHONE CASING)
   ============================================== */
.phone-panel {
  display: flex;
  justify-content: center;
  align-items: center;
}

.phone-frame {
  width: 320px;
  height: 640px;
  background: #1e1b18; /* phone shell color */
  border: 12px solid #2d2621; /* bezel frame */
  border-radius: 46px;
  position: relative;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6), 
              inset 0 4px 10px rgba(255, 255, 255, 0.05),
              inset 0 -4px 10px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
}

/* Top Hardware details */
.phone-speaker {
  width: 60px;
  height: 4px;
  background: #111;
  border-radius: 2px;
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99;
}

.phone-camera {
  width: 10px;
  height: 10px;
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 50%;
  position: absolute;
  top: 14px;
  left: 38%;
  z-index: 99;
}

/* Screen */
.phone-screen {
  flex: 1;
  background: #09090b; /* screen bg */
  border-radius: 36px;
  margin: 4px;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 16px;
  user-select: none;
}

/* Top Status Bar */
.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
  padding: 0 8px;
  z-index: 90;
}

.status-bar .signals {
  display: flex;
  align-items: center;
  gap: 4px;
}

.icon-wifi {
  width: 10px;
  height: 10px;
}

/* Screen Views */
.screen-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 24px 0 10px 0;
  z-index: 80;
}

/* Dynamic Island Notch effect */
.dynamic-island {
  width: 85px;
  height: 20px;
  background: #000;
  border-radius: 12px;
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 95;
}

/* Caller Profiles */
.caller-profile {
  text-align: center;
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.caller-profile.mini {
  margin-top: 10px;
  gap: 4px;
}

.caller-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-orange), var(--accent-red));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 25px rgba(230, 0, 0, 0.3);
  transition: all 0.5s ease;
}

.caller-avatar.pulsing {
  animation: avatarPulse 2.5s infinite ease-in-out;
}

@keyframes avatarPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 10px 25px rgba(230, 0, 0, 0.3); }
  50% { transform: scale(1.08); box-shadow: 0 10px 35px rgba(230, 0, 0, 0.6); }
}

.avatar-letter {
  font-size: 2.8rem;
  font-weight: 800;
  color: #fff;
  font-family: 'Outfit', sans-serif;
}

.caller-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
}

.caller-profile.mini .caller-name {
  font-size: 1rem;
}

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

.call-timer {
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.5px;
}

.pulse-text {
  animation: pulseText 1.5s infinite alternate;
}

@keyframes pulseText {
  0% { opacity: 0.4; }
  100% { opacity: 1; }
}

/* Dialer Settings inside phone */
.dialer-settings {
  width: 100%;
  padding: 0 10px;
}

.phone-select {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.75rem;
}

/* Buttons Area */
.phone-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.action-btn {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.action-btn:hover {
  transform: scale(1.08);
}

.call-btn {
  background: #10b981; /* Green */
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
}

.call-btn:hover {
  box-shadow: 0 12px 28px rgba(16, 185, 129, 0.6);
}

.hangup-btn {
  background: #ef4444; /* Red */
  box-shadow: 0 8px 20px rgba(239, 68, 68, 0.4);
}

.hangup-btn:hover {
  box-shadow: 0 12px 28px rgba(239, 68, 68, 0.6);
}

.hangup-btn.mini {
  width: 58px;
  height: 58px;
}

.phone-icon {
  width: 26px;
  height: 26px;
}

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

/* ==============================================
   ACTIVE CALL GRAPHICS
   ============================================== */
.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.65rem;
  font-weight: 600;
  margin-top: 4px;
}

.live-indicator .status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-connected);
  box-shadow: 0 0 6px var(--color-connected);
}

.live-indicator.connecting .status-dot {
  background: var(--color-connecting);
  box-shadow: 0 0 6px var(--color-connecting);
  animation: pulseText 0.8s infinite alternate;
}

.live-indicator.disconnected .status-dot {
  background: var(--color-disconnected);
  box-shadow: 0 0 6px var(--color-disconnected);
}

/* Visualizer Center Casing */
.visualizer-center {
  position: relative;
  width: 100%;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.visualizer-rings {
  position: relative;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.visualizer-glow {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 140, 0, 0.2) 0%, rgba(0,0,0,0) 70%);
  transition: all 0.5s ease;
  z-index: 1;
}

.visual-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  color: #fff;
  box-shadow: 0 8px 16px rgba(0,0,0,0.5);
  transition: all 0.3s ease;
}

.speaker-icon {
  width: 20px;
  height: 20px;
}

/* Pulsing rings */
.ring {
  position: absolute;
  border: 1px solid rgba(255,255,255,0.03);
  border-radius: 50%;
  pointer-events: none;
  z-index: 5;
  transition: all 0.5s ease;
}

.r-1 { width: 100px; height: 100px; }
.r-2 { width: 130px; height: 130px; }
.r-3 { width: 160px; height: 160px; }

/* In-call animation states */
.visualizer-center.listening .visual-avatar {
  border-color: var(--accent-orange);
  background: rgba(255, 140, 0, 0.1);
}

.visualizer-center.listening .ring {
  border-color: rgba(255, 140, 0, 0.12);
}

.visualizer-center.listening .r-1 { animation: ringRipple 2s infinite linear; }
.visualizer-center.listening .r-2 { animation: ringRipple 2s infinite linear 0.6s; }
.visualizer-center.listening .r-3 { animation: ringRipple 2s infinite linear 1.2s; }

.visualizer-center.speaking .visual-avatar {
  border-color: var(--accent-red);
  background: rgba(230, 0, 0, 0.15);
  transform: scale(1.05);
}

.visualizer-center.speaking .ring {
  border-color: rgba(230, 0, 0, 0.15);
}

.visualizer-center.speaking .r-1 { animation: ringRipple 1.4s infinite linear; }
.visualizer-center.speaking .r-2 { animation: ringRipple 1.4s infinite linear 0.4s; }
.visualizer-center.speaking .r-3 { animation: ringRipple 1.4s infinite linear 0.8s; }

@keyframes ringRipple {
  0% { transform: scale(0.9); opacity: 0.1; }
  50% { opacity: 0.6; }
  100% { transform: scale(1.2); opacity: 0; }
}

/* Audio waves canvas overlay */
.waves-canvas {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 50px;
  pointer-events: none;
  opacity: 0.4;
  z-index: 12;
}

/* In-call Live Subtitles / Transcripts container */
.subtitles-container {
  width: 100%;
  height: 80px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 10px 14px;
  overflow-y: auto;
  scrollbar-width: none; /* Hide scrollbars */
  margin: 10px 0;
}

.subtitles-container::-webkit-scrollbar {
  display: none;
}

.subtitle-text {
  font-size: 0.78rem;
  line-height: 1.5;
  color: rgba(255,255,255,0.9);
  text-align: right;
  font-weight: 500;
}

.subtitle-text .ai-label {
  color: var(--accent-orange);
  font-weight: 700;
  display: block;
  margin-bottom: 2px;
}

/* Call Control Buttons (Mute, Speaker) */
.active-call-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 0 10px;
}

.ctrl-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: rgba(255,255,255,0.6);
  transition: all 0.3s ease;
}

.ctrl-btn:hover {
  color: #fff;
}

.ctrl-btn.active {
  color: var(--accent-orange);
}

.ctrl-icon {
  width: 20px;
  height: 20px;
}

.ctrl-label {
  font-size: 0.65rem;
  font-weight: 500;
}

/* Hardware indicator details */
.phone-home-indicator {
  width: 110px;
  height: 4px;
  background: rgba(255,255,255,0.3);
  border-radius: 2px;
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
}

.app-footer {
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-muted);
  opacity: 0.5;
  margin-top: 30px;
}

/* Mobile Responsive */
@media (max-width: 480px) {
  body {
    padding: 0;
  }
  .app-container {
    padding: 0;
    gap: 0;
  }
  .phone-panel {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100vw;
  }
  .phone-frame {
    width: 100vw;
    height: 100vh;
    border: none;
    border-radius: 0;
    box-shadow: none;
  }
  .phone-screen {
    border-radius: 0;
  }
  .panel {
    border-radius: 0;
    border: none;
    border-bottom: 1px solid var(--border-color);
  }
}
