/* ReplyFlow AI — premium dark SaaS design system */

:root {
  /* Brand */
  --bg-0: #050507;
  --bg-1: #0A0A0C;
  --bg-2: #111114;
  --bg-3: #16161A;
  --surface: #131318;
  --surface-2: #1A1A20;
  --border: #222228;
  --border-strong: #2A2A33;
  --hairline: rgba(255,255,255,0.06);

  --text-0: #FAFAFA;
  --text-1: #E6E6EB;
  --text-2: #9CA0AB;
  --text-3: #6B7280;
  --text-4: #44464F;

  --accent: #10B981;
  --accent-glow: #10B98133;
  --accent-soft: #10B98114;
  --info: #3B82F6;
  --info-glow: #3B82F633;
  --warn: #F59E0B;
  --danger: #EF4444;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow: 0 8px 24px rgba(0,0,0,0.4);
  --shadow-lg: 0 24px 64px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 32px rgba(16,185,129,0.15);

  --font-sans: "Geist", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: "Geist Mono", "JetBrains Mono", ui-monospace, "SF Mono", monospace;

  --easing: cubic-bezier(0.22, 1, 0.36, 1);
  --easing-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

[data-theme="light"] {
  --bg-0: #FFFFFF;
  --bg-1: #FAFAFA;
  --bg-2: #F4F4F5;
  --bg-3: #ECECEF;
  --surface: #FFFFFF;
  --surface-2: #F8F8FA;
  --border: #E4E4E7;
  --border-strong: #D4D4D8;
  --hairline: rgba(0,0,0,0.06);

  --text-0: #09090B;
  --text-1: #18181B;
  --text-2: #52525B;
  --text-3: #71717A;
  --text-4: #A1A1AA;

  --accent-soft: #10B9810D;
  --shadow-glow: 0 0 32px rgba(16,185,129,0.18);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-0);
  color: var(--text-0);
  font-family: var(--font-sans);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  letter-spacing: -0.011em;
  overflow-x: hidden;
}

button { font-family: inherit; }

/* ─── Background system ─── */

.bg-stage {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: var(--bg-0);
  pointer-events: none;
}

.bg-noise {
  position: absolute;
  inset: 0;
  opacity: 0.025;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* Mesh gradient orbs */
.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.45;
  will-change: transform;
}
.bg-orb.a { width: 720px; height: 720px; top: -200px; left: -120px; background: radial-gradient(circle, #10B981 0%, transparent 60%); animation: float-a 24s ease-in-out infinite; }
.bg-orb.b { width: 600px; height: 600px; top: 40%; right: -120px; background: radial-gradient(circle, #3B82F6 0%, transparent 60%); animation: float-b 30s ease-in-out infinite; opacity: 0.35; }
.bg-orb.c { width: 480px; height: 480px; bottom: -160px; left: 30%; background: radial-gradient(circle, #8B5CF6 0%, transparent 60%); animation: float-c 36s ease-in-out infinite; opacity: 0.25; }

@keyframes float-a { 0%,100%{transform:translate(0,0)} 50%{transform:translate(60px,40px)} }
@keyframes float-b { 0%,100%{transform:translate(0,0)} 50%{transform:translate(-80px,60px)} }
@keyframes float-c { 0%,100%{transform:translate(0,0)} 50%{transform:translate(40px,-50px)} }

/* Aurora */
.bg-aurora {
  position: absolute;
  inset: 0;
  opacity: 0.6;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(16,185,129,0.18), transparent),
    radial-gradient(ellipse 60% 40% at 80% 30%, rgba(59,130,246,0.12), transparent),
    radial-gradient(ellipse 50% 30% at 20% 70%, rgba(139,92,246,0.10), transparent);
}

/* Starfield (canvas placed in #threeStage) */
.bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, black 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, black 30%, transparent 80%);
}

[data-theme="light"] .bg-orb { opacity: 0.18; }
[data-theme="light"] .bg-noise { opacity: 0.015; }
[data-theme="light"] .bg-aurora { opacity: 0.4; }

/* ─── Glass cards ─── */

.glass {
  background: linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0.005));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
}
[data-theme="light"] .glass {
  background: linear-gradient(180deg, rgba(255,255,255,0.7), rgba(255,255,255,0.4));
  border-color: var(--border);
}

.glass-strong {
  background: linear-gradient(180deg, rgba(20,20,26,0.85), rgba(12,12,18,0.7));
  border: 1px solid var(--border);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
}
[data-theme="light"] .glass-strong {
  background: linear-gradient(180deg, rgba(255,255,255,0.85), rgba(255,255,255,0.65));
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: transform .24s var(--easing), border-color .24s var(--easing), box-shadow .24s var(--easing);
}
.card.hoverable:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

/* ─── Typography ─── */

h1, h2, h3, h4 {
  letter-spacing: -0.025em;
  font-weight: 600;
  margin: 0;
  color: var(--text-0);
}

h1 { font-size: clamp(40px, 6vw, 76px); line-height: 1.02; letter-spacing: -0.04em; font-weight: 600; }
h2 { font-size: clamp(28px, 3.4vw, 44px); line-height: 1.1; letter-spacing: -0.03em; }
h3 { font-size: clamp(20px, 2vw, 26px); line-height: 1.25; }
h4 { font-size: 17px; line-height: 1.3; }

.eyebrow {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-2);
}

.text-grad {
  background: linear-gradient(180deg, var(--text-0) 30%, var(--text-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.text-grad-em {
  background: linear-gradient(110deg, var(--accent) 0%, #34D399 50%, var(--info) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.mono { font-family: var(--font-mono); }

/* ─── Buttons ─── */

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  cursor: default;
  transition: all .2s var(--easing);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(180deg, #34D399, #10B981);
  color: #052e23;
  font-weight: 600;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.25) inset,
    0 0 0 1px rgba(16,185,129,0.4),
    0 8px 24px -8px rgba(16,185,129,0.5);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.3) inset,
    0 0 0 1px rgba(16,185,129,0.5),
    0 12px 32px -8px rgba(16,185,129,0.7);
}

.btn-ghost {
  background: rgba(255,255,255,0.04);
  color: var(--text-0);
  border-color: var(--border);
  backdrop-filter: blur(8px);
}
.btn-ghost:hover {
  background: rgba(255,255,255,0.08);
  border-color: var(--border-strong);
}
[data-theme="light"] .btn-ghost {
  background: rgba(0,0,0,0.03);
}
[data-theme="light"] .btn-ghost:hover {
  background: rgba(0,0,0,0.06);
}

.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 15px; border-radius: 12px; }

/* ─── Badges & pills ─── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-1);
}
.badge.dot::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}
.badge-emerald { color: var(--accent); border-color: rgba(16,185,129,0.3); background: rgba(16,185,129,0.08); }
.badge-blue { color: var(--info); border-color: rgba(59,130,246,0.3); background: rgba(59,130,246,0.08); }
.badge-amber { color: var(--warn); border-color: rgba(245,158,11,0.3); background: rgba(245,158,11,0.08); }
.badge-red { color: var(--danger); border-color: rgba(239,68,68,0.3); background: rgba(239,68,68,0.08); }

/* ─── Layout containers ─── */

.container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 32px;
}
@media (max-width: 720px) {
  .container { padding: 0 20px; }
}

.section { padding: 96px 0; position: relative; }
.section-sm { padding: 56px 0; }

/* ─── Nav ─── */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 16px 0;
  background: linear-gradient(180deg, rgba(10,10,12,0.85), rgba(10,10,12,0.4));
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid transparent;
  transition: border-color .3s, background .3s;
}
.nav.scrolled { border-bottom-color: var(--border); }
[data-theme="light"] .nav { background: linear-gradient(180deg, rgba(255,255,255,0.85), rgba(255,255,255,0.5)); }

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}
.nav-links {
  display: flex;
  gap: 4px;
  align-items: center;
}
.nav-link {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-2);
  text-decoration: none;
  transition: color .2s, background .2s;
  cursor: default;
}
.nav-link:hover { color: var(--text-0); background: rgba(255,255,255,0.04); }
[data-theme="light"] .nav-link:hover { background: rgba(0,0,0,0.04); }
.nav-link.active { color: var(--text-0); }

@media (max-width: 880px) {
  .nav-links.middle { display: none; }
}

/* ─── Logo ─── */

.logo {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--text-0);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.02em;
  cursor: default;
}
.logo-mark {
  width: 26px; height: 26px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  background: linear-gradient(135deg, #10B981, #059669 60%, #064e3b);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.25) inset,
    0 0 0 1px rgba(16,185,129,0.4),
    0 4px 14px rgba(16,185,129,0.4);
}
.logo-mark svg { display:block; width:14px; height:14px; }

/* ─── Utility ─── */

.row { display: flex; align-items: center; }
.col { display: flex; flex-direction: column; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.gap-8 { gap: 32px; }
.flex-1 { flex: 1; min-width: 0; }
.center { display:flex; align-items:center; justify-content:center; }

.hr { height: 1px; background: var(--border); border: 0; margin: 0; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(16,185,129,0.06);
  border: 1px solid rgba(16,185,129,0.18);
  color: var(--accent);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
  backdrop-filter: blur(8px);
}
.tag .tag-dot {
  width: 6px; height: 6px; border-radius:50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }

/* ─── Animations ─── */

@keyframes fade-up {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes scale-in {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}
.reveal { opacity: 0; transform: translateY(20px); transition: opacity .8s var(--easing), transform .8s var(--easing); }
.reveal.in { opacity: 1; transform: translateY(0); }

[data-anim="off"] .reveal { opacity:1; transform:none; transition:none; }
[data-anim="off"] .bg-orb { animation: none; }
[data-anim="off"] *, [data-anim="off"] *::before, [data-anim="off"] *::after {
  animation-duration: 0.001s !important;
  transition-duration: 0.001s !important;
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.06); border-radius: 5px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.12); border-radius:5px; border: 2px solid transparent; background-clip: content-box; }
[data-theme="light"] ::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); border:2px solid transparent; background-clip: content-box; }

/* ─── Form controls ─── */

.input {
  appearance: none;
  width: 100%;
  height: 44px;
  padding: 0 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-0);
  font-size: 14px;
  font-family: inherit;
  transition: border-color .2s, box-shadow .2s, background .2s;
  outline: none;
}
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(16,185,129,0.15);
}
.input::placeholder { color: var(--text-3); }

.label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-1);
  margin-bottom: 6px;
}

/* ─── Avatars ─── */
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
}

/* ─── Channel colors ─── */
.ch-whatsapp { background: linear-gradient(135deg, #25D366, #128C7E); }
.ch-instagram { background: linear-gradient(135deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); }
.ch-facebook { background: linear-gradient(135deg, #1877F2, #0a59c4); }
.ch-telegram { background: linear-gradient(135deg, #2AABEE, #229ED9); }
.ch-viber { background: linear-gradient(135deg, #7360F2, #5A40E0); }
.ch-email { background: linear-gradient(135deg, #6B7280, #374151); }
.ch-website { background: linear-gradient(135deg, #10B981, #059669); }
.ch-sms { background: linear-gradient(135deg, #F59E0B, #d97706); }

/* ─── Marketing nav special styling ─── */
.btn-ghost.btn-sm svg, .btn-primary.btn-sm svg { width: 14px; height: 14px; }

/* ─── Page enter ─── */
.page-enter { animation: page-fade .5s var(--easing) both; }
@keyframes page-fade {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── Sidebar (app) ─── */
.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: var(--bg-1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 5;
}
.sidebar-section { padding: 16px 12px; }
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-2);
  text-decoration: none;
  cursor: default;
  transition: all .15s var(--easing);
  position: relative;
}
.sidebar-item:hover { background: rgba(255,255,255,0.04); color: var(--text-0); }
.sidebar-item.active { background: rgba(16,185,129,0.08); color: var(--text-0); }
.sidebar-item.active::before {
  content:""; position:absolute; left:-12px; top:8px; bottom:8px; width:2px;
  background: var(--accent); border-radius: 0 2px 2px 0;
}
.sidebar-item svg { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.85; }

@media (max-width: 880px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  padding: 64px 0 48px;
  margin-top: 96px;
}

/* Stat cards */
.stat-card {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.stat-num {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--text-0);
  font-variant-numeric: tabular-nums;
}
.stat-delta { font-size: 12px; color: var(--accent); font-weight: 500; }
.stat-delta.down { color: var(--danger); }

/* Skeletons */
.skel {
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.04), transparent);
  background-size: 200% 100%;
  animation: skel 1.4s linear infinite;
}
@keyframes skel { 0%{background-position:200% 0} 100%{background-position:-200% 0} }
