/* ============================================================================
   MERO BOT V8 — MODERN SAAS DESIGN SYSTEM
   Fonts: Space Grotesk (Display) + Inter (UI) + IBM Plex Sans Arabic + JetBrains Mono
   Dark & Light Mode · Scroll Reveal · Glass Depth · Guaranteed Inbox Scrolling
   ============================================================================ */

:root {
  --bg-body: #07070a;
  --bg-surface: #0e0e13;
  --bg-card: #13131a;
  --bg-elevated: #1a1a24;
  --bg-input: #0b0b10;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text-primary: #f8fafc;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --accent: #6366f1;
  --accent-2: #8b5cf6;
  --accent-light: #a5b4fc;
  --accent-soft: rgba(99, 102, 241, 0.14);
  --accent-border: rgba(99, 102, 241, 0.38);
  --shadow-card: 0 14px 36px -14px rgba(0, 0, 0, 0.72);
  --orbit-line: rgba(129, 140, 248, 0.30);
  --orbit-ring: rgba(255, 255, 255, 0.07);
  --dot-grid: rgba(255, 255, 255, 0.06);
}

html.light {
  --bg-body: #f6f7fb;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-elevated: #f1f5f9;
  --bg-input: #f8fafc;
  --border-subtle: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.14);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --accent: #4f46e5;
  --accent-2: #7c3aed;
  --accent-light: #4f46e5;
  --accent-soft: rgba(79, 70, 229, 0.09);
  --accent-border: rgba(79, 70, 229, 0.28);
  --shadow-card: 0 14px 34px -16px rgba(15, 23, 42, 0.12);
  --orbit-line: rgba(79, 70, 229, 0.24);
  --orbit-ring: rgba(15, 23, 42, 0.08);
  --dot-grid: rgba(15, 23, 42, 0.06);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', 'IBM Plex Sans Arabic', 'Cairo', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-primary);
  transition: background-color 0.25s ease, color 0.25s ease;
}

h1, h2, h3, .font-display {
  font-family: 'Space Grotesk', 'IBM Plex Sans Arabic', 'Cairo', system-ui, sans-serif;
  letter-spacing: -0.02em;
}

.font-mono {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
}

html[dir="rtl"] body,
html[dir="rtl"] h1,
html[dir="rtl"] h2,
html[dir="rtl"] h3,
html[dir="rtl"] .font-display {
  font-family: 'IBM Plex Sans Arabic', 'Cairo', 'Inter', sans-serif;
  letter-spacing: 0;
}

/* Hero Dot-Grid & Ambient Mesh */
.hero-mesh {
  background-image:
    radial-gradient(at 18% 12%, rgba(99, 102, 241, 0.16) 0px, transparent 48%),
    radial-gradient(at 84% 18%, rgba(139, 92, 246, 0.14) 0px, transparent 46%),
    radial-gradient(var(--dot-grid) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 24px 24px;
}

/* Theme utility surfaces */
.surface-nav {
  background: color-mix(in srgb, var(--bg-surface) 82%, transparent);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
}
.surface-sidebar {
  background: var(--bg-surface);
  border-inline-end: 1px solid var(--border-subtle);
}
.surface-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-card);
}
.surface-elevated {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
}
.surface-input {
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.surface-input::placeholder { color: var(--text-muted); }
.surface-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.text-main { color: var(--text-primary); }
.text-sub { color: var(--text-secondary); }
.text-dim { color: var(--text-muted); }
.border-theme { border-color: var(--border-subtle); }

/* Brand Buttons */
.btn-primary {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 55%, #7c3aed 100%);
  background-size: 160% 160%;
  color: #ffffff;
  font-weight: 700;
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.22s ease, background-position 0.3s ease, opacity 0.2s ease;
  box-shadow: 0 10px 24px -8px rgba(99, 102, 241, 0.55);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1.5px);
  background-position: 100% 0%;
  box-shadow: 0 14px 28px -8px rgba(99, 102, 241, 0.72);
}
.btn-primary:active:not(:disabled) { transform: translateY(0px); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  font-weight: 600;
  transition: border-color 0.18s ease, background-color 0.18s ease, transform 0.16s ease;
}
.btn-secondary:hover:not(:disabled) {
  border-color: var(--accent);
  transform: translateY(-1px);
}

/* Sidebar Nav */
.side-link {
  color: var(--text-secondary);
  transition: all 0.18s ease;
}
.side-link:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  transform: translateX(2px);
}
html[dir="rtl"] .side-link:hover { transform: translateX(-2px); }
.side-link.active {
  background: var(--accent-soft);
  color: var(--accent-light);
  border: 1px solid var(--accent-border);
  font-weight: 700;
}

/* GUARANTEED DUAL-PANE SCROLLING FOR LIVE INBOX */
.inbox-shell {
  height: calc(100vh - 11.5rem);
  min-height: 540px;
  max-height: 820px;
  display: grid;
  overflow: hidden;
}
.inbox-pane {
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.inbox-scroll {
  flex: 1 1 0%;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
@media (max-width: 1023px) {
  .inbox-shell {
    height: auto;
    max-height: none;
    overflow: visible;
  }
  .inbox-pane-left {
    height: 300px;
    max-height: 300px;
  }
  .inbox-pane-right {
    height: 580px;
    max-height: 75vh;
  }
}

/* Animations */
@keyframes floatSlow {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-7px); }
}
@keyframes pulseRing {
  0% { transform: scale(0.95); opacity: 0.7; }
  75% { transform: scale(1.22); opacity: 0; }
  100% { transform: scale(1.22); opacity: 0; }
}
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes modalPop {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes popIn {
  0% { opacity: 0; transform: translate(-50%, -14px) scale(0.95); }
  100% { opacity: 1; transform: translate(-50%, 0) scale(1); }
}
@keyframes dashFlow { to { stroke-dashoffset: -28; } }
@keyframes shimmerText {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.gradient-shimmer {
  background-size: 220% 220%;
  animation: shimmerText 6s ease infinite;
}
.anim-fade-up { animation: fadeSlideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) both; }
.anim-delay-1 { animation-delay: 0.08s; }
.anim-delay-2 { animation-delay: 0.16s; }
.anim-delay-3 { animation-delay: 0.24s; }
.modal-animate { animation: modalPop 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.toast-animate { animation: popIn 0.2s ease-out forwards; }

.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

.orbit-node {
  animation: floatSlow 4.8s ease-in-out infinite;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-card);
}
.orbit-node:nth-child(2n) { animation-delay: 1.1s; }
.orbit-node:nth-child(3n) { animation-delay: 2.2s; }
.orbit-line {
  stroke: var(--orbit-line);
  stroke-width: 1.5;
  stroke-dasharray: 5 5;
  animation: dashFlow 2.5s linear infinite;
}
.pulse-halo { animation: pulseRing 2.6s cubic-bezier(0.4, 0, 0.6, 1) infinite; }

.card-hover {
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease, box-shadow 0.25s ease;
}
.card-hover:hover {
  transform: translateY(-3px);
  border-color: var(--accent-border);
  box-shadow: 0 18px 38px -18px rgba(99, 102, 241, 0.28);
}

/* Crisp audio player inside chat bubbles */
.chat-audio {
  width: 240px;
  max-width: 100%;
  height: 34px;
  border-radius: 999px;
}

/* Custom slim scrollbars */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.28); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(148, 163, 184, 0.5); }


/* ============================================================================
   GADGIFTS V10 — ENHANCED HERO AURORA, LIVE TYPING & SIMULATION ANIMATIONS
   ============================================================================ */
@keyframes auroraDrift {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.65; }
  33% { transform: translate(28px, -22px) scale(1.08); opacity: 0.9; }
  66% { transform: translate(-20px, 18px) scale(0.96); opacity: 0.7; }
}
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}
@keyframes wavePulse {
  0%, 100% { transform: scaleY(0.35); }
  50% { transform: scaleY(1); }
}
@keyframes simBubbleIn {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes beamSlide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(220%); }
}
@keyframes badgeFloat {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-6px); }
}

.aurora-orb-1 {
  background: radial-gradient(circle, rgba(99, 102, 241, 0.34) 0%, transparent 68%);
  animation: auroraDrift 11s ease-in-out infinite;
}
.aurora-orb-2 {
  background: radial-gradient(circle, rgba(16, 185, 129, 0.24) 0%, transparent 68%);
  animation: auroraDrift 13s ease-in-out infinite reverse;
}
.aurora-orb-3 {
  background: radial-gradient(circle, rgba(168, 85, 247, 0.28) 0%, transparent 68%);
  animation: auroraDrift 15s ease-in-out infinite 2s;
}

.hero-float-badge {
  animation: badgeFloat 4.5s ease-in-out infinite;
}
.hero-float-badge-delay {
  animation: badgeFloat 5.2s ease-in-out infinite 1.4s;
}

.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #34d399;
  display: inline-block;
  animation: typingBounce 1.2s infinite ease-in-out;
}
.typing-dot:nth-child(2) { animation-delay: 0.16s; }
.typing-dot:nth-child(3) { animation-delay: 0.32s; }

.wave-bar {
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, #818cf8, #34d399);
  transform-origin: center;
  animation: wavePulse 1.1s ease-in-out infinite;
}
.wave-bar:nth-child(2n) { animation-delay: 0.15s; animation-duration: 0.9s; }
.wave-bar:nth-child(3n) { animation-delay: 0.3s; animation-duration: 1.3s; }
.wave-bar:nth-child(4n) { animation-delay: 0.45s; animation-duration: 1.0s; }

.sim-bubble {
  animation: simBubbleIn 0.34s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.sim-stage-card {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s ease, box-shadow 0.3s ease;
}
.sim-stage-card.is-active {
  border-color: rgba(99, 102, 241, 0.65);
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.35), 0 22px 44px -18px rgba(99, 102, 241, 0.42);
  transform: translateY(-3px);
}
.sim-stage-card.is-alert-active {
  border-color: rgba(244, 63, 94, 0.7);
  box-shadow: 0 0 0 1px rgba(244, 63, 94, 0.35), 0 22px 44px -18px rgba(244, 63, 94, 0.42);
  transform: translateY(-3px);
}

.flow-beam-track {
  position: relative;
  overflow: hidden;
  background: var(--border-subtle);
}
.flow-beam-track::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 45%;
  background: linear-gradient(90deg, transparent, #6366f1, #34d399, transparent);
  animation: beamSlide 2s linear infinite;
}

.wa-wallpaper {
  background-color: color-mix(in srgb, var(--bg-input) 92%, #064e3b 8%);
  background-image: radial-gradient(rgba(16, 185, 129, 0.08) 1px, transparent 1px);
  background-size: 18px 18px;
}


/* Theme-reactive GadGifts Brand Logos (instant swap with zero flicker) */
.brand-logo-dark { display: block; }
.brand-logo-light { display: none; }
html.light .brand-logo-dark { display: none; }
html.light .brand-logo-light { display: block; }
