/* Custom Design Variables */
:root {
  --bg: #08060b;
  --bg-secondary: #0f0c15;
  --bg-elevated: #161220;
  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);
  --text-primary: #f5f2f7;
  --text-secondary: #b3a9c2;
  --text-muted: #786e85;
  --brand: #8b5cf6;
  --brand-light: #a78bfa;
  --accent: #f97316;
  --scrollbar-width: 6px;
  --focus-ring: 0 0 0 2px rgba(139, 92, 246, 0.5);
}

.light {
  --bg: #faf9fc;
  --bg-secondary: #f1eef6;
  --bg-elevated: #ffffff;
  --border: rgba(0, 0, 0, 0.08);
  --border-hover: rgba(0, 0, 0, 0.15);
  --text-primary: #150d22;
  --text-secondary: #605273;
  --text-muted: #9385a8;
  --brand: #7c3aed;
  --brand-light: #8b5cf6;
  --accent: #ea580c;
  --focus-ring: 0 0 0 2px rgba(124, 58, 237, 0.3);
}

/* Custom backgrounds and grids */
body {
  background-color: var(--bg);
  color: var(--text-primary);
}

.page-bg::before {
  content: '';
  position: fixed;
  top: -40%;
  left: 50%;
  transform: translateX(-50%);
  width: 120%;
  height: 80vh;
  background: radial-gradient(ellipse at center, rgba(65, 88, 245, 0.12) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.light .page-bg::before {
  background: radial-gradient(ellipse at center, rgba(65, 88, 245, 0.05) 0%, transparent 70%);
}

/* Custom classes for aesthetic overlays */
.glass-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.light .glass-card {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--border);
}

.noise-overlay {
  position: relative;
}

.noise-overlay::before {
  content: '';
  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.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  border-radius: inherit;
  z-index: 0;
}

.light .noise-overlay::before {
  opacity: 0.015;
}

/* Global shadow configurations */
.shadow-glow-sm {
  box-shadow: 0 0 20px rgba(65, 88, 245, 0.1);
}

.shadow-glow {
  box-shadow: 0 0 40px rgba(65, 88, 245, 0.15);
}

.shadow-card-hover {
  box-shadow: 0 20px 60px rgba(0,0,0,0.4), 0 1px 0 rgba(255,255,255,0.05);
}

.light .shadow-card-hover {
  box-shadow: 0 20px 40px rgba(0,0,0,0.06), 0 1px 0 rgba(0,0,0,0.05);
}

.shadow-inner-glow {
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.07);
}

.light .shadow-inner-glow {
  box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.03);
}

/* Accessible focus ring utility */
.focus-ring:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* Min touch target for accessibility */
.min-h-touch {
  min-height: 44px;
}

/* Scrollbar behaviors */
::-webkit-scrollbar {
  width: var(--scrollbar-width);
  height: var(--scrollbar-width);
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
}
.light ::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Theme color maps */
.text-primary {
  color: var(--text-primary);
}
.text-secondary {
  color: var(--text-secondary);
}
.text-muted {
  color: var(--text-muted);
}
.border-surface {
  border-color: var(--border);
}
.bg-surface-50 {
  background-color: var(--bg-secondary);
}
.bg-surface-100 {
  background-color: var(--bg-elevated);
}

/* Custom inputs styling */
.input-base {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  outline: none;
  font-family: inherit;
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

.input-base:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(65, 88, 245, 0.12);
  background-color: var(--bg-elevated);
}

.input-base:hover:not(:focus) {
  border-color: var(--border-hover);
}

.text-brand-gradient {
  background: linear-gradient(135deg, var(--brand-light) 0%, var(--brand) 50%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-gradient {
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-gradient-overlay {
  background: radial-gradient(ellipse 80% 60% at 50% -20%, rgba(139, 92, 246, 0.16) 0%, transparent 70%);
}

.light .hero-gradient-overlay {
  background: radial-gradient(ellipse 80% 60% at 50% -20%, rgba(124, 58, 237, 0.05) 0%, transparent 70%);
}

/* Code representation */
.code-chip {
  font-size: clamp(2.5rem, 8vw, 5rem);
  letter-spacing: 0.15em;
  background: linear-gradient(135deg, #fff 0%, rgba(255,255,255,0.7) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.light .code-chip {
  background: linear-gradient(135deg, #1a1f4e 0%, #4158f5 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Simple CSS micro-animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
  animation: fadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Support select dropdown custom styling */
select option {
  background-color: #111219;
  color: #f0f1f5;
}

.light select option {
  background-color: #ffffff;
  color: #0d0e14;
}

/* Responsive utilities */
.divider {
  border-top: 1px solid var(--border);
}

/* Premium micro-interactions & Focus states */
.hover-lift {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
  transform: translateY(-4px);
  border-color: rgba(65, 88, 245, 0.35);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25), 0 1px 0 rgba(255, 255, 255, 0.05);
}

.light .hover-lift:hover {
  border-color: rgba(65, 88, 245, 0.25);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.05), 0 1px 0 rgba(0, 0, 0, 0.02);
}

/* Premium Focus ring */
.input-base:focus-visible {
  outline: 2px solid rgba(65, 88, 245, 0.5);
  outline-offset: 1px;
}

/* Page transitions */
.page-transition-exit {
  animation: pageExit 0.15s ease-in forwards;
}

.page-transition-enter {
  animation: pageEnter 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

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

/* Skeleton Loading Shimmer */
.skeleton-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.skeleton-line {
  height: 1rem;
  width: 100%;
  border-radius: 0.375rem;
  background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-elevated) 50%, var(--bg-secondary) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
}

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

/* Scroll reveal triggers (disabled for Android webview display stability) */
.reveal {
  opacity: 1;
  transform: none;
}

.revealed {
  opacity: 1;
  transform: none;
}

/* Accessibility & Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-delay: 0s !important;
    animation-duration: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0s !important;
    scroll-behavior: auto !important;
    transform: none !important;
  }
}

/* Onboarding modal overlay */
@keyframes overlayFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalSlideUp {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

#onboarding-overlay {
  animation: overlayFadeIn 0.2s ease forwards;
}

#onboarding-modal {
  animation: modalSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Demo animation */
@keyframes demoArrow {
  0%, 100% { transform: translateY(0); opacity: 0.5; }
  50% { transform: translateY(4px); opacity: 1; }
}

.demo-arrow-animate {
  animation: demoArrow 1.4s ease-in-out infinite;
}

/* Interactive demo typed code effect */
@keyframes codeAppear {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

.code-appear {
  animation: codeAppear 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Mobile breakpoint helpers */
@media (max-width: 375px) {
  .code-chip {
    font-size: clamp(2rem, 10vw, 3.5rem);
  }
}

/* Premium Motion & Redesign Animations */
@keyframes springBounce {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}
.springy-bounce {
  animation: springBounce 0.4s cubic-bezier(0.25, 1.5, 0.5, 1);
}

@keyframes heroEntrance {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.hero-entrance {
  animation: heroEntrance 0.75s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes scrollBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(5px); }
}
.scroll-bounce {
  animation: scrollBounce 1.8s ease-in-out infinite;
}

/* Timeline Interactive Active States */
.timeline-step {
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.timeline-step-active {
  border-color: rgba(93, 109, 247, 0.3) !important;
  background: rgba(93, 109, 247, 0.02);
  box-shadow: 0 4px 20px -2px rgba(93, 109, 247, 0.06);
}
.timeline-number {
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.timeline-number-active {
  background-color: var(--brand) !important;
  border-color: var(--brand) !important;
  color: #ffffff !important;
  box-shadow: 0 0 12px rgba(93, 109, 247, 0.3);
}
