/**
 * 果链 (GuoLian) - Global Stylesheet
 * Blockchain Fruit Traceability Platform
 * Version: 1.0.0
 */

/* ============================================
   CSS VARIABLES - Design System Tokens
   ============================================ */
:root {
  /* Primary Colors */
  --fruit-green: #22C55E;
  --blockchain-blue: #3B82F6;
  --fresh-lime: #84CC16;

  /* Secondary Colors */
  --soft-peach: #FED7AA;
  --sky-blue: #7DD3FC;
  --mint-green: #6EE7B7;

  /* Neutral Colors */
  --dark-slate: #1E293B;
  --slate-gray: #64748B;
  --light-gray: #E2E8F0;
  --off-white: #F8FAFC;
  --pure-white: #FFFFFF;

  /* Semantic Colors */
  --success: #22C55E;
  --info: #3B82F6;
  --warning: #F59E0B;
  --error: #EF4444;

  /* Gradient Definitions */
  --gradient-primary: linear-gradient(135deg, #22C55E 0%, #3B82F6 100%);
  --gradient-hero: linear-gradient(180deg, #F0FDF4 0%, #EFF6FF 50%, #FFFFFF 100%);
  --gradient-card: linear-gradient(145deg, #FFFFFF 0%, #F8FAFC 100%);
  --gradient-accent: linear-gradient(90deg, #22C55E 0%, #84CC16 100%);
  --gradient-dark: linear-gradient(180deg, #1E293B 0%, #334155 100%);

  /* Typography */
  --font-family-base: "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-family-mono: "SF Mono", "Consolas", "Monaco", monospace;

  /* Font Sizes */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;

  /* Font Weights */
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;

  /* Line Heights */
  --leading-tight: 1.2;
  --leading-snug: 1.3;
  --leading-normal: 1.5;
  --leading-relaxed: 1.6;
  --leading-loose: 1.7;

  /* Spacing System (4px base) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-2xl: 32px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 20px rgba(34, 197, 94, 0.3);
  --shadow-glow-blue: 0 0 20px rgba(59, 130, 246, 0.3);
  --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.05);

  /* Animation Timing */
  --ease-default: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
  --ease-elastic: cubic-bezier(0.175, 0.885, 0.32, 1.275);

  /* Animation Durations */
  --duration-fast: 150ms;
  --duration-normal: 300ms;
  --duration-slow: 500ms;
  --duration-slower: 700ms;

  /* Z-Index Scale */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-fixed: 300;
  --z-modal-backdrop: 400;
  --z-modal: 500;
  --z-popover: 600;
  --z-tooltip: 700;
  --z-toast: 800;
}

/* ============================================
   BASE STYLES
   ============================================ */
html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family-base);
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  color: var(--dark-slate);
  background-color: var(--off-white);
  min-height: 100vh;
}

/* Selection Color */
::selection {
  background-color: rgba(34, 197, 94, 0.2);
  color: var(--dark-slate);
}

/* Focus Styles */
:focus-visible {
  outline: 2px solid var(--fruit-green);
  outline-offset: 2px;
}

/* ============================================
   ANIMATION KEYFRAMES
   ============================================ */

/* Fade In Up */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade In Down */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade In Left */
@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Fade In Right */
@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Scale In */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Scale In Bounce */
@keyframes scaleInBounce {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Slide In Right */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Slide In Left */
@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Pulse Glow */
@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.3);
  }
  50% {
    box-shadow: 0 0 40px rgba(34, 197, 94, 0.6);
  }
}

/* Pulse Glow Blue */
@keyframes pulseGlowBlue {
  0%, 100% {
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
  }
  50% {
    box-shadow: 0 0 40px rgba(59, 130, 246, 0.6);
  }
}

/* Float */
@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

/* Float Slow */
@keyframes floatSlow {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-15px) rotate(3deg);
  }
}

/* Bounce */
@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-15px);
  }
}

/* Rotate */
@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Rotate Reverse */
@keyframes rotateReverse {
  from {
    transform: rotate(360deg);
  }
  to {
    transform: rotate(0deg);
  }
}

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

/* Pulse */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Shake */
@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  10%, 30%, 50%, 70%, 90% {
    transform: translateX(-5px);
  }
  20%, 40%, 60%, 80% {
    transform: translateX(5px);
  }
}

/* Scanner Line */
@keyframes scannerLine {
  0% {
    top: 0;
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    top: 100%;
    opacity: 0;
  }
}

/* Count Up */
@keyframes countUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Toast Slide In */
@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(100%) translateY(-50%);
  }
  to {
    opacity: 1;
    transform: translateX(0) translateY(0);
  }
}

/* Toast Slide Out */
@keyframes toastSlideOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

/* Animation Utilities */
.animate-fadeInUp {
  animation: fadeInUp var(--duration-normal) var(--ease-out) forwards;
}

.animate-fadeInDown {
  animation: fadeInDown var(--duration-normal) var(--ease-out) forwards;
}

.animate-fadeInLeft {
  animation: fadeInLeft var(--duration-normal) var(--ease-out) forwards;
}

.animate-fadeInRight {
  animation: fadeInRight var(--duration-normal) var(--ease-out) forwards;
}

.animate-scaleIn {
  animation: scaleIn var(--duration-normal) var(--ease-out) forwards;
}

.animate-scaleInBounce {
  animation: scaleInBounce var(--duration-slow) var(--ease-bounce) forwards;
}

.animate-float {
  animation: float 3s var(--ease-default) infinite;
}

.animate-float-slow {
  animation: floatSlow 4s var(--ease-default) infinite;
}

.animate-bounce {
  animation: bounce 2s var(--ease-default) infinite;
}

.animate-rotate {
  animation: rotate 2s linear infinite;
}

.animate-rotate-slow {
  animation: rotate 8s linear infinite;
}

.animate-pulse {
  animation: pulse 2s var(--ease-default) infinite;
}

.animate-pulse-glow {
  animation: pulseGlow 2s var(--ease-default) infinite;
}

.animate-shimmer {
  animation: shimmer 2s linear infinite;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  background-size: 200% 100%;
}

.animate-shake {
  animation: shake 0.5s var(--ease-default);
}

/* Animation Delays */
.delay-100 { animation-delay: 100ms; }
.delay-200 { animation-delay: 200ms; }
.delay-300 { animation-delay: 300ms; }
.delay-400 { animation-delay: 400ms; }
.delay-500 { animation-delay: 500ms; }
.delay-600 { animation-delay: 600ms; }
.delay-700 { animation-delay: 700ms; }
.delay-800 { animation-delay: 800ms; }

/* Gradient Text */
.gradient-text {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Glass Effect */
.glass {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.glass-dark {
  background: rgba(30, 41, 59, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Card Styles */
.card {
  background: var(--pure-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-6);
  transition: transform var(--duration-normal) var(--ease-default),
              box-shadow var(--duration-normal) var(--ease-default);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.card-feature {
  background: var(--pure-white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: var(--space-8);
}

/* Button Styles */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  border-radius: var(--radius-md);
  transition: all var(--duration-normal) var(--ease-default);
  cursor: pointer;
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--fruit-green);
  color: var(--pure-white);
  box-shadow: var(--shadow-md);
}

.btn-primary:hover {
  background: #16A34A;
  transform: scale(1.02);
  box-shadow: var(--shadow-lg);
}

.btn-secondary {
  background: var(--pure-white);
  color: var(--fruit-green);
  border: 2px solid var(--fruit-green);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: #F0FDF4;
  transform: scale(1.02);
}

.btn-ghost {
  background: transparent;
  color: var(--fruit-green);
}

.btn-ghost:hover {
  background: #F0FDF4;
}

.btn-gradient {
  background: var(--gradient-primary);
  color: var(--pure-white);
  box-shadow: var(--shadow-lg);
}

.btn-gradient:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-xl);
}

/* Icon Button */
.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-full);
}

/* Section Styles */
.section {
  padding: var(--space-16) var(--space-6);
}

.section-sm {
  padding: var(--space-10) var(--space-6);
}

.section-lg {
  padding: var(--space-20) var(--space-6);
}

/* Container */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

/* Text Utilities */
.text-balance {
  text-wrap: balance;
}

.tracking-tight {
  letter-spacing: -0.02em;
}

/* Scrollbar Styles */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--off-white);
}

::-webkit-scrollbar-thumb {
  background: var(--light-gray);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--slate-gray);
}

/* Hide scrollbar but keep functionality */
.scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

/* Intersection Observer Animation Classes */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity var(--duration-slow) var(--ease-out),
              transform var(--duration-slow) var(--ease-out);
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

.reveal-left {
  opacity: 0;
  transform: translateX(-30px);
  transition: opacity var(--duration-slow) var(--ease-out),
              transform var(--duration-slow) var(--ease-out);
}

.reveal-left.active {
  opacity: 1;
  transform: translateX(0);
}

.reveal-right {
  opacity: 0;
  transform: translateX(30px);
  transition: opacity var(--duration-slow) var(--ease-out),
              transform var(--duration-slow) var(--ease-out);
}

.reveal-right.active {
  opacity: 1;
  transform: translateX(0);
}

.reveal-scale {
  opacity: 0;
  transform: scale(0.9);
  transition: opacity var(--duration-slow) var(--ease-out),
              transform var(--duration-slow) var(--ease-out);
}

.reveal-scale.active {
  opacity: 1;
  transform: scale(1);
}

/* Stagger Children */
.stagger-children > * {
  opacity: 0;
  transform: translateY(20px);
}

.stagger-children.active > * {
  opacity: 1;
  transform: translateY(0);
  transition: opacity var(--duration-normal) var(--ease-out),
              transform var(--duration-normal) var(--ease-out);
}

.stagger-children.active > *:nth-child(1) { transition-delay: 0ms; }
.stagger-children.active > *:nth-child(2) { transition-delay: 100ms; }
.stagger-children.active > *:nth-child(3) { transition-delay: 200ms; }
.stagger-children.active > *:nth-child(4) { transition-delay: 300ms; }
.stagger-children.active > *:nth-child(5) { transition-delay: 400ms; }
.stagger-children.active > *:nth-child(6) { transition-delay: 500ms; }

/* ============================================
   RESPONSIVE UTILITIES
   ============================================ */

/* Mobile-first responsive padding for sections */
@media (min-width: 640px) {
  .section {
    padding: var(--space-16) var(--space-8);
  }
}

@media (min-width: 1024px) {
  .section {
    padding: var(--space-20) var(--space-12);
  }
  
  .container {
    padding: 0 var(--space-8);
  }
}

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

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
  .no-print {
    display: none !important;
  }
  
  body {
    background: white !important;
    color: black !important;
  }
  
  .card,
  .card-feature {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
  }
}
