/*
 * Oman AI Agent - Modern Design System & Styles
 * RTL First, Sleek Glassmorphism Dark Mode
 */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800&family=Outfit:wght@400;500;600;700&display=swap');

:root {
  --font-family: 'Cairo', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --bg-main: #0a0d14;
  --bg-card: rgba(18, 24, 38, 0.75);
  --bg-card-hover: rgba(26, 34, 54, 0.85);
  --bg-card-solid: #121826;
  --bg-panel: rgba(15, 20, 32, 0.95);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-active: rgba(99, 102, 241, 0.5);

  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.35);
  --accent-emerald: #10b981;
  --accent-cyan: #06b6d4;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --warning: #f59e0b;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 25px var(--primary-glow);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(99, 102, 241, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(6, 182, 212, 0.1) 0%, transparent 40%);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.6;
  direction: rtl;
  overflow-x: hidden;
}

/* ─── Top Navbar ──────────────────────────────────────────────────────────── */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 36px;
  background: rgba(10, 13, 20, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.brand-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, #6366f1, #06b6d4);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.brand-title {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.3px;
  background: linear-gradient(to left, #fff, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

.header-meta {
  display: flex;
  align-items: center;
  gap: 16px;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 10px var(--accent-emerald);
}

/* ─── Main Container & Hero ────────────────────────────────────────────────── */
.main-container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 32px 24px 100px;
}

.hero-banner {
  text-align: center;
  padding: 32px 20px 40px;
}

.hero-tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: #818cf8;
  background: rgba(99, 102, 241, 0.12);
  padding: 5px 16px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(99, 102, 241, 0.25);
  margin-bottom: 14px;
}

.hero-banner h1 {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 12px;
  background: linear-gradient(to left, #ffffff 40%, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-banner p {
  font-size: 15px;
  color: var(--text-muted);
  max-width: 680px;
  margin: 0 auto;
}

/* ─── Cards & Forms ───────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: var(--shadow-md);
  margin-bottom: 28px;
  transition: var(--transition);
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.14);
}

.card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.card-title h3 {
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.field-group {
  margin-bottom: 18px;
}

.field-label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 8px;
}

.field-label span.req {
  color: var(--danger);
}

.field-label span.hint {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  margin-right: 6px;
}

.input-text, .input-textarea {
  width: 100%;
  background: rgba(11, 15, 25, 0.7);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  padding: 12px 16px;
  font-family: inherit;
  font-size: 14px;
  transition: var(--transition);
}

.input-text:focus, .input-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Drop Zone */
.drop-zone {
  border: 2px dashed rgba(255, 255, 255, 0.16);
  background: rgba(15, 20, 32, 0.5);
  border-radius: var(--radius-md);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}

.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.08);
}

.drop-zone-icon {
  font-size: 36px;
  margin-bottom: 10px;
}

.drop-zone-text {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 4px;
}

.drop-zone-sub {
  font-size: 12px;
  color: var(--text-muted);
}

/* File Chips */
.selected-files-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.file-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 12.5px;
  animation: fadeIn 0.2s ease-out;
}

.file-chip-ext {
  font-weight: 700;
  font-size: 10.5px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
}

.file-chip-name {
  max-width: 160px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-chip-size {
  color: var(--text-dim);
  font-size: 11px;
}

.remove-file-tag {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
}

.remove-file-tag:hover {
  color: var(--danger);
}

/* Buttons */
.btn-primary {
  background: linear-gradient(135deg, var(--primary), #4338ca);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: 14.5px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary:hover:not(:disabled) {
  opacity: 0.95;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Progress Bar */
.progress-container {
  margin-top: 20px;
  background: rgba(0, 0, 0, 0.3);
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 8px;
}

.progress-track {
  height: 8px;
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(to left, var(--accent-cyan), var(--primary));
  border-radius: var(--radius-full);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-fill.indeterminate {
  width: 100% !important;
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Alert Boxes */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  margin-top: 16px;
  font-size: 13.5px;
}

.alert.success {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
}

.alert.error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
}

/* Department Pills */
.dept-pills-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.pill-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

.pill-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.pill-btn.active {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--primary);
  color: white;
  font-weight: 700;
}

.pill-count {
  font-size: 11px;
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

/* ─── Knowledge File Cards & Table ────────────────────────────────────────── */
.kb-files-table-wrap {
  margin-top: 10px;
}

.kb-files-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 14px;
  padding: 0 4px;
}

.total-badge {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
}

.kb-file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.kb-file-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: var(--transition);
}

.kb-file-card:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.kb-file-icon {
  font-size: 28px;
  background: rgba(255, 255, 255, 0.04);
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kb-file-info {
  flex: 1;
  min-width: 0;
}

.kb-file-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.kb-file-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-muted);
}

.badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.badge-pdf { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.badge-doc { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.badge-xls { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.badge-video { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.badge-audio { background: rgba(168, 85, 247, 0.15); color: #c084fc; }
.badge-text { background: rgba(148, 163, 184, 0.15); color: #cbd5e1; }

.btn-danger-ghost {
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #f87171;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}

.btn-danger-ghost:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--danger);
  color: white;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 44px;
  margin-bottom: 12px;
}

/* ─── Floating Chat Bubble Widget (#fw-root) ──────────────────────────────── */
#fw-root {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 999;
}

/* Floating Action Button */
.fw-fab {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 50%, #06b6d4 100%);
  border: 2px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 30px rgba(99, 102, 241, 0.45);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.fw-fab:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 12px 35px rgba(99, 102, 241, 0.65);
}

.fw-fab:active {
  transform: scale(0.96);
}

.fw-fab.active {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.45);
}

.fw-fab.active:hover {
  transform: scale(1.06) translateY(-1px);
  background: linear-gradient(135deg, #334155, #1e293b);
  border-color: rgba(239, 68, 68, 0.45);
  color: #fca5a5;
  box-shadow: 0 10px 30px rgba(239, 68, 68, 0.25);
}

/* FAB Icons Animation (Chat <-> Close) */
.fw-fab-icon {
  position: absolute;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease;
  will-change: transform, opacity;
  pointer-events: none;
}

.fw-fab-icon-chat {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

.fw-fab-icon-close {
  opacity: 0;
  transform: scale(0.4) rotate(-90deg);
}

.fw-fab.active .fw-fab-icon-chat {
  opacity: 0;
  transform: scale(0.3) rotate(90deg);
}

.fw-fab.active .fw-fab-icon-close {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

.fw-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: var(--accent-emerald);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--bg-main);
  z-index: 2;
  box-shadow: 0 0 8px var(--accent-emerald);
}

/* Chat Panel */
.fw-panel {
  position: fixed;
  bottom: 104px;
  right: 28px;
  width: 400px;
  height: 580px;
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 120px);
  background: var(--bg-panel);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.92) translateY(20px);
  transform-origin: bottom right;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1000;
}

.fw-panel.open {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1) translateY(0);
}

/* Chat Header */
.fw-header {
  padding: 16px 18px;
  background: rgba(18, 24, 38, 0.9);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.fw-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.fw-avatar-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #06b6d4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  position: relative;
}

.fw-online-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 9px;
  height: 9px;
  background: var(--accent-emerald);
  border-radius: 50%;
  border: 2px solid var(--bg-card-solid);
}

.fw-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.fw-subtitle {
  font-size: 11px;
  color: var(--accent-emerald);
}

.fw-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* THE NEW VIDEO CALL BUTTON */
.btn-video-call {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  border: none;
  border-radius: var(--radius-full);
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.4);
  transition: var(--transition);
}

.btn-video-call:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.6);
}

.btn-video-call svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

.fw-close-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.2s ease;
}

.fw-close-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.35);
  color: #f87171;
  transform: scale(1.05);
}

.fw-close-btn svg {
  display: block;
  transition: transform 0.25s ease;
}

.fw-close-btn:hover svg {
  transform: rotate(90deg);
}

/* Chat Messages */
.fw-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.msg {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  animation: fadeIn 0.25s ease-out;
}

.msg-user {
  align-self: flex-start;
}

.msg-assistant {
  align-self: flex-end;
}

.msg-bubble {
  padding: 11px 15px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.55;
  position: relative;
  word-break: break-word;
}

.msg-user .msg-bubble {
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  color: white;
  border-bottom-right-radius: 4px;
}

.msg-assistant .msg-bubble {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-bottom-left-radius: 4px;
}

.msg-context-tag {
  font-size: 10.5px;
  color: #a5b4fc;
  background: rgba(99, 102, 241, 0.15);
  padding: 2px 8px;
  border-radius: 4px;
  margin-top: 6px;
  display: inline-block;
}

.msg-time {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 4px;
  align-self: flex-end;
}

/* Typing indicator */
.typing-dots {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 0;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out both;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Chat Input Bar */
.fw-input-bar {
  padding: 12px 14px;
  background: rgba(18, 24, 38, 0.9);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.fw-textarea {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  padding: 10px 14px;
  font-family: inherit;
  font-size: 13.5px;
  resize: none;
  max-height: 100px;
  min-height: 42px;
  line-height: 1.4;
  direction: rtl;
}

.fw-textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.fw-send-btn {
  background: var(--primary);
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition);
}

.fw-send-btn:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: scale(1.05);
}

.fw-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ─── Live Avatar Video Call Modal ────────────────────────────────────────── */
.avatar-modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 15, 0.88);
  backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease-out;
}

.avatar-modal.visible {
  opacity: 1;
  pointer-events: auto;
}

.avatar-call-card {
  width: 90%;
  max-width: 780px;
  background: #111624;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.avatar-call-header {
  padding: 16px 20px;
  background: rgba(18, 24, 38, 0.95);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.avatar-agent-badge {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar-agent-title {
  font-size: 16px;
  font-weight: 700;
}

/* Video Stage */
.avatar-video-stage {
  position: relative;
  width: 100%;
  height: 440px;
  background: #090c14;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#avatar-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: translateZ(0);
  will-change: transform;
  backface-visibility: hidden;
}

.avatar-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, #1e293b 0%, #090c14 70%);
  color: var(--text-muted);
}

.avatar-placeholder-art {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f46e5, #06b6d4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 46px;
  margin-bottom: 16px;
  box-shadow: 0 0 35px rgba(99, 102, 241, 0.4);
  animation: pulse 2.5s infinite ease-in-out;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.06); opacity: 1; }
}

/* Floating status pill inside video stage */
.status-pill {
  position: absolute;
  top: 18px;
  right: 18px;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 700;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 10;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.95), 0 0 8px rgba(0, 0, 0, 0.8);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
  user-select: none;
}

#avatar-status-text {
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.95), 0 0 8px rgba(0, 0, 0, 0.85);
  font-weight: 700;
  letter-spacing: 0.2px;
}

.status-connecting {
  background: rgba(26, 20, 10, 0.88);
  color: #fef08a;
  border-color: rgba(245, 158, 11, 0.6);
}

.status-listening {
  background: rgba(10, 30, 20, 0.88);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.6);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45), 0 0 14px rgba(16, 185, 129, 0.3);
}

.status-talking {
  background: rgba(18, 18, 38, 0.92);
  color: #c7d2fe;
  border-color: rgba(99, 102, 241, 0.7);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45), 0 0 18px rgba(99, 102, 241, 0.5);
}

.status-processing {
  background: rgba(10, 25, 35, 0.88);
  color: #a5f3fc;
  border-color: rgba(6, 182, 212, 0.6);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45), 0 0 14px rgba(6, 182, 212, 0.3);
}

.status-error {
  background: rgba(35, 15, 15, 0.92);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.6);
}

.status-disconnected {
  background: rgba(20, 24, 30, 0.88);
  color: #e2e8f0;
  border-color: rgba(148, 163, 184, 0.5);
}

/* Call Controls */
.avatar-call-controls {
  padding: 18px 24px;
  background: rgba(18, 24, 38, 0.95);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.btn-ctrl {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 10px 22px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

.btn-ctrl:hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn-ctrl.muted {
  background: rgba(239, 68, 68, 0.2);
  border-color: var(--danger);
  color: #fca5a5;
}

.btn-ctrl-hangup {
  background: var(--danger);
  border-color: var(--danger);
  color: white;
}

.btn-ctrl-hangup:hover {
  background: var(--danger-hover);
  transform: scale(1.04);
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 640px) {
  .app-header { padding: 12px 18px; }
  .main-container { padding: 20px 14px 100px; }
  .fw-panel { width: calc(100vw - 28px); right: 14px; bottom: 86px; height: 75vh; }
  #fw-root { right: 18px; bottom: 18px; }
  .avatar-call-card { width: 96%; }
  .avatar-video-stage { height: 320px; }
}
