/* =================================================================
   Appify - Dark Design System
   ================================================================= */

:root {
  --ink-950: #05050a;
  --ink-900: #0a0a0f;
  --ink-800: #11111a;
  --ink-700: #1a1a26;
  --ink-600: #242433;
  --ink-500: #2f2f42;

  --neon-purple: #a855f7;
  --neon-pink: #ec4899;
  --neon-cyan: #22d3ee;
  --neon-green: #10b981;
  --neon-amber: #f59e0b;

  --grad-primary: linear-gradient(135deg, #a855f7 0%, #ec4899 50%, #22d3ee 100%);
  --grad-subtle: linear-gradient(135deg, rgba(168, 85, 247, 0.15) 0%, rgba(34, 211, 238, 0.15) 100%);
}

* {
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--ink-950);
  color: #fff;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
  letter-spacing: -0.011em;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--ink-900);
}
::-webkit-scrollbar-thumb {
  background: var(--ink-600);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--ink-500);
}

/* Selection */
::selection {
  background: var(--neon-purple);
  color: #fff;
}

/* =================================================================
   Noise / grain overlay
   ================================================================= */
.noise-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.035;
  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='3' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* =================================================================
   Aurora animated background
   ================================================================= */
.aurora-bg {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}

.aurora {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  animation: blob 18s infinite ease-in-out;
  will-change: transform;
}

.aurora-1 {
  width: 500px;
  height: 500px;
  top: -10%;
  left: -10%;
  background: radial-gradient(circle, #a855f7 0%, transparent 70%);
}

.aurora-2 {
  width: 600px;
  height: 600px;
  top: 20%;
  right: -15%;
  background: radial-gradient(circle, #ec4899 0%, transparent 70%);
  animation-delay: -6s;
}

.aurora-3 {
  width: 450px;
  height: 450px;
  bottom: -10%;
  left: 30%;
  background: radial-gradient(circle, #22d3ee 0%, transparent 70%);
  animation-delay: -12s;
}

@keyframes blob {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(50px, -30px) scale(1.1); }
  50% { transform: translate(-30px, 50px) scale(0.95); }
  75% { transform: translate(30px, 30px) scale(1.05); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

@keyframes gradient {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

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

@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

@keyframes pulse-ring {
  0% { transform: scale(0.8); opacity: 1; }
  100% { transform: scale(2.5); opacity: 0; }
}

@keyframes spin-slow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes wave {
  0%, 100% { transform: scaleY(0.3); }
  50% { transform: scaleY(1); }
}

@keyframes caret-blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

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

/* =================================================================
   Buttons
   ================================================================= */
.btn-primary {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 0.75rem;
  font-weight: 600;
  color: #fff;
  background: var(--grad-primary);
  background-size: 200% 200%;
  animation: gradient 8s ease infinite;
  transition: transform 0.15s ease, box-shadow 0.25s ease;
  overflow: hidden;
  isolation: isolate;
}

.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transform: translateX(-100%);
  transition: transform 0.6s;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 40px -10px rgba(168, 85, 247, 0.5);
}

.btn-primary:hover::before {
  transform: translateX(100%);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 0.75rem;
  font-weight: 600;
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  color: rgba(255, 255, 255, 0.7);
  transition: all 0.15s;
}

.btn-ghost:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

/* =================================================================
   Cards & Glass
   ================================================================= */
.glass {
  background: rgba(26, 26, 38, 0.5);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 1rem;
}

.glass-strong {
  background: rgba(17, 17, 26, 0.75);
  backdrop-filter: blur(32px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1rem;
}

.card {
  background: rgba(17, 17, 26, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 1rem;
  transition: all 0.25s;
  position: relative;
  overflow: hidden;
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
  box-shadow: 0 20px 40px -20px rgba(0, 0, 0, 0.5);
}

.card-glow {
  position: relative;
  background: linear-gradient(rgba(17, 17, 26, 0.9), rgba(17, 17, 26, 0.9)) padding-box,
              linear-gradient(135deg, rgba(168, 85, 247, 0.4), rgba(34, 211, 238, 0.4)) border-box;
  border: 1px solid transparent;
  border-radius: 1rem;
}

.card-glow::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(400px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(168, 85, 247, 0.1),
    transparent 40%);
  pointer-events: none;
  transition: opacity 0.3s;
}

/* =================================================================
   Text gradients
   ================================================================= */
.text-gradient {
  background: var(--grad-primary);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: gradient 8s ease infinite;
}

.text-gradient-cyan {
  background: linear-gradient(135deg, #22d3ee, #10b981);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.text-gradient-pink {
  background: linear-gradient(135deg, #ec4899, #f59e0b);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* =================================================================
   Badges & chips
   ================================================================= */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.8);
}

.chip-purple {
  background: rgba(168, 85, 247, 0.12);
  border-color: rgba(168, 85, 247, 0.3);
  color: #c084fc;
}

.chip-cyan {
  background: rgba(34, 211, 238, 0.12);
  border-color: rgba(34, 211, 238, 0.3);
  color: #67e8f9;
}

.chip-pink {
  background: rgba(236, 72, 153, 0.12);
  border-color: rgba(236, 72, 153, 0.3);
  color: #f472b6;
}

.chip-green {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.3);
  color: #34d399;
}

.chip-amber {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}

/* Status dot */
.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--neon-green);
  position: relative;
}
.dot::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid currentColor;
  animation: pulse-ring 2s infinite;
}
.dot-warn { background: var(--neon-amber); }
.dot-off  { background: #4a4a66; }
.dot-off::after { display: none; }

/* =================================================================
   Hero elements
   ================================================================= */
.hero-title {
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
}

.mesh-grid {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
}

/* Shimmer loading bars */
.shimmer {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04) 0%,
    rgba(255, 255, 255, 0.08) 50%,
    rgba(255, 255, 255, 0.04) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 2.5s linear infinite;
}

/* =================================================================
   Voice wave / recording
   ================================================================= */
.voice-wave {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 32px;
}
.voice-wave span {
  display: block;
  width: 3px;
  height: 100%;
  background: var(--neon-cyan);
  border-radius: 2px;
  animation: wave 1.2s ease-in-out infinite;
  transform-origin: center;
}
.voice-wave span:nth-child(1) { animation-delay: -1.1s; }
.voice-wave span:nth-child(2) { animation-delay: -1.0s; }
.voice-wave span:nth-child(3) { animation-delay: -0.9s; }
.voice-wave span:nth-child(4) { animation-delay: -0.8s; }
.voice-wave span:nth-child(5) { animation-delay: -0.7s; }
.voice-wave span:nth-child(6) { animation-delay: -0.6s; }
.voice-wave span:nth-child(7) { animation-delay: -0.5s; }

/* Mic button with rings */
.mic-btn {
  position: relative;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--grad-primary);
  background-size: 200% 200%;
  animation: gradient 8s ease infinite;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 32px;
  cursor: pointer;
  transition: transform 0.2s;
  box-shadow: 0 10px 40px -10px rgba(168, 85, 247, 0.6);
  border: none;
}

.mic-btn::before,
.mic-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--neon-purple);
  animation: pulse-ring 2.5s infinite;
  pointer-events: none;
}
.mic-btn::after { animation-delay: 1s; }

.mic-btn:hover { transform: scale(1.05); }
.mic-btn:active { transform: scale(0.95); }

.mic-btn.recording {
  background: linear-gradient(135deg, #ef4444 0%, #ec4899 100%);
}

/* =================================================================
   Toggle / switch
   ================================================================= */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch .slider {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  cursor: pointer;
  transition: 0.25s;
}

.switch .slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.25s;
}

.switch input:checked + .slider {
  background: var(--grad-primary);
}

.switch input:checked + .slider::before {
  transform: translateX(20px);
}

/* Checkbox custom */
.chk {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.chk input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.chk .box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.03);
  transition: 0.15s;
  flex-shrink: 0;
}

.chk input:checked + .box {
  background: var(--grad-primary);
  border-color: transparent;
}

.chk input:checked + .box::after {
  content: '\2713';
  color: #fff;
  font-size: 12px;
  font-weight: bold;
}

/* =================================================================
   Option card (radio card)
   ================================================================= */
.opt-card {
  position: relative;
  display: block;
  padding: 1rem;
  border-radius: 0.875rem;
  background: rgba(17, 17, 26, 0.6);
  border: 1.5px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: all 0.2s;
  overflow: hidden;
}

.opt-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(26, 26, 38, 0.7);
}

.opt-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.opt-card.selected,
.opt-card:has(input:checked) {
  border-color: rgba(168, 85, 247, 0.6);
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.08), rgba(34, 211, 238, 0.06));
}

.opt-card:has(input:checked)::before {
  content: '\2713';
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--grad-primary);
  color: #fff;
  font-weight: bold;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* =================================================================
   Code / terminal-ish
   ================================================================= */
.terminal {
  background: rgba(5, 5, 10, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0.75rem;
  padding: 1rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8125rem;
  color: #e5e7eb;
  overflow-x: auto;
}

.terminal-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 0.75rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.terminal-header span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #333;
}

.terminal-header span:nth-child(1) { background: #ef4444; }
.terminal-header span:nth-child(2) { background: #f59e0b; }
.terminal-header span:nth-child(3) { background: #10b981; }

.caret::after {
  content: '▋';
  color: var(--neon-cyan);
  animation: caret-blink 1s infinite;
  margin-left: 2px;
}

/* =================================================================
   Phone mockup
   ================================================================= */
.phone {
  width: 280px;
  aspect-ratio: 9 / 19;
  background: linear-gradient(135deg, #1a1a26, #0a0a0f);
  border-radius: 2.5rem;
  padding: 12px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.5),
              0 0 0 1px rgba(168, 85, 247, 0.2),
              inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  position: relative;
}

.phone::before {
  content: '';
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 22px;
  background: #000;
  border-radius: 999px;
  z-index: 2;
}

.phone-screen {
  width: 100%;
  height: 100%;
  border-radius: 2rem;
  overflow: hidden;
  background: #05050a;
  position: relative;
}

/* =================================================================
   Marquee
   ================================================================= */
.marquee {
  overflow: hidden;
  position: relative;
  mask-image: linear-gradient(90deg, transparent, black 10%, black 90%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, black 10%, black 90%, transparent);
}

.marquee-track {
  display: flex;
  gap: 2rem;
  animation: marquee 35s linear infinite;
  width: max-content;
}

/* =================================================================
   Step indicator
   ================================================================= */
.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  transition: 0.3s;
}

.step-dot.active {
  width: 24px;
  background: var(--grad-primary);
  border-radius: 4px;
}

.step-dot.done {
  background: var(--neon-green);
}

/* =================================================================
   Accordion
   ================================================================= */
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
details[open] .acc-icon { transform: rotate(180deg); }
.acc-icon { transition: transform 0.25s; }

/* =================================================================
   Utilities
   ================================================================= */
.reveal {
  animation: reveal 0.6s ease-out both;
}

.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }

.divider-glow {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(168, 85, 247, 0.5), transparent);
}

.ring-gradient {
  position: relative;
}
.ring-gradient::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: var(--grad-primary);
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s;
}
.ring-gradient:hover::before {
  opacity: 1;
}

/* Scroll snap for horizontal tabs */
.snap-x { scroll-snap-type: x mandatory; }
.snap-start { scroll-snap-align: start; }

/* Hide scrollbar */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* Mobile bottom nav padding */
@media (max-width: 767px) {
  main { padding-bottom: calc(5rem + env(safe-area-inset-bottom)); }
}

/* Prefers reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* 3D tilt cards via JS */
.tilt {
  transition: transform 0.1s linear;
  transform-style: preserve-3d;
}

/* Connection lines (for integrations) */
.connection-line {
  stroke: url(#grad-line);
  stroke-width: 2;
  stroke-dasharray: 4 4;
  animation: dash-move 2s linear infinite;
}

@keyframes dash-move {
  to { stroke-dashoffset: -16; }
}

/* Glow boxes */
.glow-purple {
  box-shadow: 0 0 40px -10px rgba(168, 85, 247, 0.5);
}
.glow-cyan {
  box-shadow: 0 0 40px -10px rgba(34, 211, 238, 0.5);
}
.glow-pink {
  box-shadow: 0 0 40px -10px rgba(236, 72, 153, 0.5);
}

/* Bento grid */
.bento-item {
  position: relative;
  overflow: hidden;
  border-radius: 1.25rem;
  background: linear-gradient(135deg, rgba(17, 17, 26, 0.85), rgba(10, 10, 15, 0.85));
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 1.5rem;
  transition: all 0.3s;
}

.bento-item:hover {
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-4px);
}

.bento-item::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(600px circle at var(--mx, 50%) var(--my, 50%), rgba(168, 85, 247, 0.08), transparent 40%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}

.bento-item:hover::after {
  opacity: 1;
}

/* Mini app preview in phone */
.mini-app-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  font-size: 0.625rem;
  color: rgba(255, 255, 255, 0.7);
}

/* QR code styled */
.qr-placeholder {
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #000 25%, transparent 25%),
    linear-gradient(-45deg, #000 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #000 75%),
    linear-gradient(-45deg, transparent 75%, #000 75%);
  background-size: 12px 12px;
  background-position: 0 0, 0 6px, 6px -6px, -6px 0;
}

/* Floating tag */
.floating-tag {
  position: absolute;
  padding: 0.5rem 0.875rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  background: rgba(17, 17, 26, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  animation: float 6s ease-in-out infinite;
}

/* Pill tabs */
.pill-tabs {
  display: inline-flex;
  padding: 4px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.pill-tabs button {
  padding: 0.5rem 1rem;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s;
}
.pill-tabs button.active {
  background: var(--grad-primary);
  color: #fff;
  box-shadow: 0 4px 16px -4px rgba(168, 85, 247, 0.5);
}
