/* ── Variables — Red Live Theme ─────────────────────────────────────────── */
:root {
  --bg:        #0a0608;
  --bg2:       #110810;
  --surface:   #160d12;
  --surface2:  #1f1018;
  --border:    rgba(220, 38, 38, 0.15);
  --border2:   rgba(220, 38, 38, 0.08);

  --accent:    #ee417d;   /* rose-600 */
  --accent2:   #fb7185;   /* rose-400 */
  --accent3:   #ee417d;   /* bright red */
  --accentDim: rgba(225, 29, 72, 0.18);

  --live:      #ee417d;
  --live-glow: rgba(255, 59, 48, 0.5);

  --success:   #34d399;
  --danger:    #ee417d;
  --warn:      #fbbf24;

  --text:      #f1e8ea;
  --text-muted:#7c5c63;
  --text-dim:  #b08090;

  --radius:    16px;
  --radius-sm: 10px;
  --font:      'Vazirmatn', sans-serif;
  --font-logo: 'Syne', sans-serif;
  --shadow:    0 8px 40px rgba(0,0,0,0.6);
  --glow:      0 0 24px rgba(225, 29, 72, 0.4);
  --glow-sm:   0 0 12px rgba(225, 29, 72, 0.3);
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  direction: rtl;
}

/* ── Background ──────────────────────────────────────────────────────────── */
.bg-orbs {
  position: fixed; inset: 0; z-index: 0;
  pointer-events: none; overflow: hidden;
}

.orb {
  position: absolute; border-radius: 50%;
  filter: blur(90px); opacity: 0.18;
  animation: orbFloat 14s ease-in-out infinite alternate;
}

.orb-1 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, #e11d48, #7f1d1d, transparent);
  top: -200px; right: -180px;
  animation-duration: 11s;
}

.orb-2 {
  width: 450px; height: 450px;
  background: radial-gradient(circle, #9f1239, transparent);
  bottom: -120px; left: -100px;
  animation-duration: 16s; animation-delay: -6s;
}

.orb-3 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, #ee417d, transparent);
  top: 45%; left: 45%;
  transform: translate(-50%,-50%);
  animation-duration: 20s; animation-delay: -4s;
  opacity: 0.1;
}

.noise-overlay {
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  opacity: 0.5;
}

@keyframes orbFloat {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(25px, 30px) scale(1.08); }
}

/* ── Stats bar ───────────────────────────────────────────────────────────── */
.stats-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px;
  background: rgba(10, 6, 8, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.stat {
  display: flex; align-items: center; gap: 7px;
  font-size: 13px; color: var(--text-dim);
}

.stat-dot {
  width: 7px; height: 7px; border-radius: 50%;
}

.online-dot {
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
  animation: dotPulse 2s infinite;
}

.paired-dot {
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
}

@keyframes dotPulse {
  0%,100% { opacity:1; } 50% { opacity:0.35; }
}

/* Logo */
.logo {
  font-family: var(--font-logo);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  user-select: none;
}

.logo-mulle {
  color: #fff;
}

.logo-live {
  color: var(--accent);
}

/* ── Screens ─────────────────────────────────────────────────────────────── */
.screen {
  display: none; position: fixed; inset: 0; z-index: 10;
  padding-top: 62px;
  align-items: center; justify-content: center;
}

.screen.active { display: flex; }

/* ── HOME ────────────────────────────────────────────────────────────────── */
.home-content {
  text-align: center;
  max-width: 440px;
  padding: 40px 24px;
  animation: fadeUp 0.55s cubic-bezier(.22,1,.36,1);
}

@keyframes fadeUp {
  from { opacity:0; transform:translateY(32px); }
  to   { opacity:1; transform:translateY(0); }
}

.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(225,29,72,0.15);
  border: 1px solid rgba(225,29,72,0.35);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent2);
  letter-spacing: 2px;
  margin-bottom: 24px;
  animation: badgePulse 3s ease-in-out infinite;
}

@keyframes badgePulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(225,29,72,0); }
  50%      { box-shadow: 0 0 0 6px rgba(225,29,72,0); }
}

.hero-title {
  font-size: 58px;
  font-weight: 900;
  line-height: 1.05;
  margin-bottom: 18px;
  background: linear-gradient(140deg, #fff 0%, var(--accent2) 55%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  color: var(--text-dim);
  font-size: 16px;
  line-height: 1.75;
  margin-bottom: 36px;
}

.features {
  display: flex; gap: 10px; justify-content: center;
  margin-bottom: 40px; flex-wrap: wrap;
}

.feature {
  display: flex; align-items: center; gap: 7px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 20px;
  padding: 7px 15px;
  font-size: 13px;
  color: var(--text-dim);
}

.feat-icon { font-size: 15px; }

/* Primary button */
.btn-start {
  display: inline-flex; align-items: center; gap: 10px;
  background: linear-gradient(135deg, var(--accent) 0%, #9f1239 100%);
  color: #fff;
  border: none; border-radius: 50px;
  padding: 16px 44px;
  font-size: 17px; font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 4px 28px rgba(225,29,72,0.45);
  position: relative; overflow: hidden;
}

.btn-start::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
  opacity: 0; transition: opacity 0.3s;
}

.btn-start:hover { transform: translateY(-3px); box-shadow: 0 8px 36px rgba(225,29,72,0.6); }
.btn-start:hover::before { opacity: 1; }
.btn-start:active { transform: translateY(-1px); }

.btn-live-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 6px #fff;
  flex-shrink: 0;
  animation: liveDot 1.2s ease-in-out infinite;
}

@keyframes liveDot {
  0%,100% { opacity:1; transform:scale(1); }
  50%      { opacity:0.4; transform:scale(0.7); }
}

.terms-note {
  margin-top: 18px; font-size: 12px; color: var(--text-muted);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 50px;
  padding: 10px 24px;
  font-size: 14px; font-family: var(--font);
  cursor: pointer; transition: all 0.2s;
}

.btn-ghost:hover { border-color: var(--accent); color: var(--accent2); }

/* ── PERMISSION ──────────────────────────────────────────────────────────── */
.perm-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 52px 44px;
  max-width: 380px; text-align: center;
  box-shadow: var(--shadow), var(--glow);
  animation: fadeUp 0.4s ease;
}

.perm-icon { font-size: 56px; margin-bottom: 22px; }

.perm-card h2 { font-size: 22px; font-weight: 700; margin-bottom: 12px; }

.perm-card p {
  color: var(--text-dim); font-size: 15px;
  line-height: 1.65; margin-bottom: 30px;
}

.btn-grant {
  display: block; width: 100%;
  background: linear-gradient(135deg, var(--accent), #9f1239);
  color: #fff; border: none; border-radius: var(--radius-sm);
  padding: 14px; font-size: 16px; font-weight: 600;
  font-family: var(--font); cursor: pointer;
  margin-bottom: 12px; transition: opacity 0.2s;
  box-shadow: 0 4px 18px rgba(225,29,72,0.4);
}

.btn-grant:hover { opacity: 0.9; }

/* ── WAITING ─────────────────────────────────────────────────────────────── */
.waiting-content { text-align: center; animation: fadeUp 0.4s ease; }

.waiting-content h2 { font-size: 24px; font-weight: 700; margin-bottom: 10px; }

.wait-sub { color: var(--text-dim); margin-bottom: 34px; font-size: 15px; }

.pulse-ring {
  width: 130px; height: 130px;
  margin: 0 auto 34px;
  position: relative;
  display: flex; align-items: center; justify-content: center;
}

.pulse-ring::before,
.pulse-ring::after {
  content: '';
  position: absolute; border-radius: 50%;
  border: 2px solid var(--accent);
  animation: pulseRing 2.2s ease-out infinite;
}

.pulse-ring::before { width: 100%; height: 100%; animation-delay: 0s; }
.pulse-ring::after  { width: 145%; height: 145%; animation-delay: 0.6s; opacity: 0.5; }

@keyframes pulseRing {
  0%   { opacity: 0.9; transform: scale(0.75); }
  100% { opacity: 0;   transform: scale(1.3); }
}

.pulse-inner {
  width: 76px; height: 76px;
  background: var(--surface);
  border: 2px solid var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  position: relative; z-index: 1;
  box-shadow: var(--glow);
}

.pulse-logo {
  font-family: var(--font-logo);
  font-size: 30px; font-weight: 800;
  color: var(--accent);
}

.btn-cancel {
  background: transparent;
  border: 1px solid #ee417d;
  color: var(--danger);
  border-radius: 50px;
  padding: 10px 30px;
  font-size: 14px; font-family: var(--font);
  cursor: pointer; transition: all 0.2s;
}

.btn-cancel:hover { background: rgba(255,59,48,0.08); }

/* ── CHAT SCREEN ─────────────────────────────────────────────────────────── */
#screen-chat { align-items: stretch; padding: 62px 0 0; }

.chat-layout {
  display: flex; width: 100%; height: 100%;
  max-width: 980px; margin: 0 auto;
  padding: 16px; gap: 14px;
}

/* Voice Panel */
.voice-panel {
  flex: 0 0 300px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 20px;
  display: flex; flex-direction: column; gap: 18px;
  box-shadow: var(--shadow);
}

.voice-header {
  display: flex; align-items: center; justify-content: space-between;
}

.connected-badge {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 700;
  color: var(--accent2); letter-spacing: 1.5px;
}

.live-dot-anim {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--live);
  box-shadow: 0 0 8px var(--live-glow);
  animation: liveDot 1s ease-in-out infinite;
}

#call-timer {
  font-size: 13px; color: var(--text-muted);
  font-variant-numeric: tabular-nums; letter-spacing: 1px;
}

.avatars-area {
  display: flex; align-items: center; justify-content: center;
  gap: 14px; flex: 1;
}

.avatar-wrap {
  display: flex; flex-direction: column;
  align-items: center; gap: 10px;
}

.avatar {
  width: 82px; height: 82px; border-radius: 50%;
  background: var(--surface2);
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600; color: var(--text-dim);
  position: relative; transition: all 0.3s;
}

.avatar.speaking {
  border-color: var(--accent);
  box-shadow: 0 0 20px #ee417d;
}

.partner-avatar { font-size: 28px; }

.speak-ring {
  position: absolute; inset: -7px; border-radius: 50%;
  border: 2px solid transparent; transition: all 0.2s;
}

.speak-ring.active {
  border-color: var(--accent);
  animation: speakPulse 1s ease-in-out infinite;
}

@keyframes speakPulse {
  0%,100% { transform:scale(1); opacity:1; }
  50%      { transform:scale(1.1); opacity:0.6; }
}

.avatar-label { font-size: 12px; color: var(--text-muted); }

/* Wave divider */
.wave-divider {
  display: flex; align-items: center; gap: 3px;
}

.wave-bar {
  width: 3px; background: var(--border);
  border-radius: 2px;
  animation: waveBounce 1.4s ease-in-out infinite;
}

.wave-bar:nth-child(1) { height:14px; animation-delay:0s; }
.wave-bar:nth-child(2) { height:22px; animation-delay:0.12s; }
.wave-bar:nth-child(3) { height:30px; animation-delay:0.24s; }
.wave-bar:nth-child(4) { height:22px; animation-delay:0.36s; }
.wave-bar:nth-child(5) { height:14px; animation-delay:0.48s; }

.wave-bar.active { background: var(--accent); }

@keyframes waveBounce {
  0%,100% { transform:scaleY(0.5); }
  50%      { transform:scaleY(1.3); }
}

/* Controls */
.controls {
  display: flex; align-items: center; justify-content: center; gap: 12px;
}

.ctrl-btn {
  width: 54px; height: 54px; border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}

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

.mute-btn.muted {
  background: rgba(255,59,48,0.15);
  border-color: var(--danger);
  color: var(--danger);
}

.skip-btn {
  background: rgba(225,29,72,0.08);
  border-color: rgba(225,29,72,0.25);
  color: var(--accent2);
}

.skip-btn:hover {
  background: rgba(225,29,72,0.18);
  box-shadow: var(--glow-sm);
}

.end-btn {
  background: rgba(225,29,72,0.1);
  border-color: rgba(225,29,72,0.3);
  color: var(--accent);
}

.end-btn:hover {
  background: rgba(225,29,72,0.22);
  box-shadow: var(--glow);
}

.mute-status {
  text-align: center; font-size: 13px; color: var(--danger);
  background: rgba(255,59,48,0.1); border-radius: var(--radius-sm); padding: 8px;
}

/* Chat Panel */
.chat-panel {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: var(--shadow);
}

.chat-panel-header {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border2);
  font-size: 13px; font-weight: 600;
  color: var(--text-dim); display: flex; align-items: center; gap: 6px;
}

.chat-messages {
  flex: 1; overflow-y: auto;
  padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.system-msg {
  text-align: center; font-size: 13px; color: var(--text-muted);
  padding: 8px 16px; background: var(--surface2);
  border-radius: 20px; margin: 0 auto;
}

.msg {
  max-width: 75%; padding: 10px 15px;
  border-radius: 14px; font-size: 14px; line-height: 1.55;
  animation: msgIn 0.2s ease; word-break: break-word;
}

@keyframes msgIn {
  from { opacity:0; transform:translateY(8px); }
  to   { opacity:1; transform:translateY(0); }
}

.msg.me {
  background: linear-gradient(135deg, rgba(225,29,72,0.22), rgba(159,18,57,0.15));
  border: 1px solid rgba(225,29,72,0.2);
  align-self: flex-end;
}

.msg.partner {
  background: var(--surface2);
  border: 1px solid var(--border2);
  align-self: flex-start;
}

.typing-indicator {
  padding: 10px 16px; font-size: 13px; color: var(--text-muted);
  display: flex; align-items: center; gap: 6px;
}

.typing-indicator span {
  width: 5px; height: 5px; background: var(--accent);
  border-radius: 50%; display: inline-block;
  animation: typingDot 1.2s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingDot {
  0%,60%,100% { transform:translateY(0); }
  30%          { transform:translateY(-5px); }
}

.chat-input-wrap {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border2);
}

#chat-input {
  flex: 1; background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 24px; padding: 10px 16px;
  font-size: 14px; font-family: var(--font);
  color: var(--text); outline: none; direction: rtl;
  transition: border-color 0.2s;
}

#chat-input:focus { border-color: var(--accent); }
#chat-input::placeholder { color: var(--text-muted); }

#btn-send {
  width: 44px; height: 44px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #9f1239);
  border: none; color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all 0.2s;
  box-shadow: 0 2px 12px rgba(225,29,72,0.35);
}

#btn-send:hover { opacity: 0.9; transform: scale(1.06); }

/* ── DISCONNECTED ─────────────────────────────────────────────────────────── */
.disc-content {
  text-align: center; max-width: 380px;
  padding: 40px 24px; animation: fadeUp 0.4s ease;
}

.disc-icon { font-size: 64px; margin-bottom: 20px; }

.disc-content h2 { font-size: 26px; font-weight: 700; margin-bottom: 10px; }

.disc-content p { color: var(--text-dim); margin-bottom: 34px; font-size: 15px; }

.disc-actions {
  display: flex; flex-direction: column;
  gap: 12px; align-items: center;
}

/* ── Scrollbar ────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 680px) {
  .chat-layout { flex-direction: column; padding: 10px; }
  .voice-panel { flex: 0 0 auto; }
  .hero-title { font-size: 42px; }
  .stats-bar { padding: 12px 16px; }
}
