/**
 * 果链 (GuoLian) - Global Styles
 * Blockchain Fruit Traceability Platform
 */

/* ============================================
   CSS Custom Properties (Variables)
   ============================================ */
:root {
  /* Primary Colors */
  --color-primary: #22C55E;
  --color-primary-dark: #16A34A;
  --color-primary-light: #4ADE80;
  
  /* Secondary Colors */
  --color-secondary: #3B82F6;
  --color-secondary-dark: #2563EB;
  --color-secondary-light: #60A5FA;
  
  /* Accent Colors */
  --color-accent: #F97316;
  --color-accent-light: #FB923C;
  --color-accent-dark: #EA580C;
  
  /* Background Colors */
  --color-bg: #FFFFFF;
  --color-bg-alt: #F0FDF4;
  --color-bg-gray: #F8FAFC;
  
  /* Text Colors */
  --color-text-primary: #1F2937;
  --color-text-secondary: #6B7280;
  --color-text-light: #9CA3AF;
  
  /* Border & UI Colors */
  --color-border: #E5E7EB;
  --color-success: #10B981;
  --color-warning: #FBBF24;
  
  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  
  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  --shadow-glow-green: 0 0 20px rgba(34, 197, 94, 0.3);
  --shadow-glow-blue: 0 0 20px rgba(59, 130, 246, 0.3);
  
  /* Animation Durations */
  --duration-fast: 0.2s;
  --duration-normal: 0.4s;
  --duration-slow: 0.6s;
  --duration-slower: 0.8s;
  
  /* Animation Easings */
  --ease-default: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-entrance: cubic-bezier(0, 0, 0.2, 1);
  --ease-exit: cubic-bezier(0.4, 0, 1, 1);
  --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
  --ease-smooth: cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* ============================================
   Base Styles
   ============================================ */
html {
  scroll-behavior: smooth;
}

body {
  font-family: "Noto Sans SC", system-ui, -apple-system, sans-serif;
  color: var(--color-text-primary);
  background-color: var(--color-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   Typography
   ============================================ */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.3;
  color: var(--color-text-primary);
}

h1 {
  font-size: 2.5rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 1.875rem;
  letter-spacing: -0.01em;
}

h3 {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.4;
}

h4 {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.5;
}

.text-body-large {
  font-size: 1.125rem;
  line-height: 1.7;
}

.text-body {
  font-size: 1rem;
  line-height: 1.6;
}

.text-body-small {
  font-size: 0.875rem;
  line-height: 1.5;
}

.text-caption {
  font-size: 0.75rem;
  line-height: 1.4;
  letter-spacing: 0.02em;
}

/* ============================================
   Animation Keyframes
   ============================================ */

/* Fade In */
@keyframes fadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

/* Fade In Up */
@keyframes fadeInUp {
  0% { 
    opacity: 0; 
    transform: translateY(20px); 
  }
  100% { 
    opacity: 1; 
    transform: translateY(0); 
  }
}

/* Fade In Down */
@keyframes fadeInDown {
  0% { 
    opacity: 0; 
    transform: translateY(-20px); 
  }
  100% { 
    opacity: 1; 
    transform: translateY(0); 
  }
}

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

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

/* Scale In */
@keyframes scaleIn {
  0% { 
    opacity: 0; 
    transform: scale(0.95); 
  }
  100% { 
    opacity: 1; 
    transform: scale(1); 
  }
}

/* Flip In X */
@keyframes flipInX {
  0% { 
    opacity: 0; 
    transform: perspective(400px) rotateX(90deg); 
  }
  100% { 
    opacity: 1; 
    transform: perspective(400px) rotateX(0); 
  }
}

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

/* Pulse Animation */
@keyframes pulse {
  0%, 100% { 
    opacity: 1;
    transform: scale(1);
  }
  50% { 
    opacity: 0.8;
    transform: scale(1.05);
  }
}

/* Progress Fill Animation */
@keyframes progressFill {
  0% { width: 0; }
  100% { width: var(--progress-value, 100%); }
}

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

/* Count Up Animation Helper */
@keyframes countUp {
  0% { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* ============================================
   Animation Utility Classes
   ============================================ */
.animate-fade-in {
  animation: fadeIn var(--duration-slow) var(--ease-entrance) forwards;
}

.animate-fade-in-up {
  animation: fadeInUp var(--duration-slow) var(--ease-entrance) forwards;
}

.animate-fade-in-down {
  animation: fadeInDown var(--duration-slow) var(--ease-entrance) forwards;
}

.animate-slide-in-left {
  animation: slideInLeft var(--duration-slow) var(--ease-entrance) forwards;
}

.animate-slide-in-right {
  animation: slideInRight var(--duration-slow) var(--ease-entrance) forwards;
}

.animate-scale-in {
  animation: scaleIn var(--duration-slow) var(--ease-smooth) forwards;
}

.animate-flip-in-x {
  animation: flipInX var(--duration-slower) var(--ease-smooth) forwards;
}

.animate-float {
  animation: float 3s ease-in-out infinite;
}

.animate-pulse-slow {
  animation: pulse 2s ease-in-out infinite;
}

.animate-bounce-slow {
  animation: bounce 2s ease-in-out infinite;
}

/* Animation Delays */
.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; }
.delay-600 { animation-delay: 0.6s; }
.delay-700 { animation-delay: 0.7s; }
.delay-800 { animation-delay: 0.8s; }
.delay-900 { animation-delay: 0.9s; }
.delay-1000 { animation-delay: 1s; }

/* Initial state for scroll animations */
.scroll-animate {
  opacity: 0;
}

.scroll-animate.animated {
  opacity: 1;
}

/* ============================================
   Button Styles
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-xl);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.01em;
  border-radius: var(--radius-md);
  transition: all var(--duration-fast) var(--ease-default);
  cursor: pointer;
  border: none;
  text-decoration: none;
}

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

.btn-primary:hover {
  background-color: var(--color-primary-dark);
  transform: scale(1.05);
  box-shadow: var(--shadow-lg);
}

.btn-secondary {
  background-color: var(--color-secondary);
  color: white;
  box-shadow: var(--shadow-md);
}

.btn-secondary:hover {
  background-color: var(--color-secondary-dark);
  transform: scale(1.05);
  box-shadow: var(--shadow-lg);
}

.btn-outline {
  background-color: transparent;
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
}

.btn-outline:hover {
  background-color: var(--color-primary);
  color: white;
}

.btn-ghost {
  background-color: transparent;
  color: var(--color-text-primary);
}

.btn-ghost:hover {
  background-color: var(--color-bg-gray);
}

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

.btn-white:hover {
  background-color: var(--color-bg-gray);
  transform: scale(1.05);
  box-shadow: var(--shadow-lg);
}

/* ============================================
   Card Styles
   ============================================ */
.card {
  background-color: white;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-lg);
  transition: all var(--duration-normal) var(--ease-default);
}

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

.card-feature {
  background-color: white;
  border: 2px solid transparent;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: var(--space-xl);
  transition: all var(--duration-normal) var(--ease-default);
}

.card-feature:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-xl);
  border-color: var(--color-primary);
}

.card-dark {
  background-color: var(--color-text-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-lg);
  color: white;
}

/* ============================================
   Section Styles
   ============================================ */
.section {
  padding: var(--space-3xl) var(--space-lg);
}

.section-alt {
  background-color: var(--color-bg-alt);
}

.section-gray {
  background-color: var(--color-bg-gray);
}

.section-gradient {
  background: linear-gradient(135deg, var(--color-bg-alt) 0%, #EFF6FF 100%);
}

.section-title {
  font-size: 1.875rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: var(--space-sm);
  color: var(--color-text-primary);
}

.section-subtitle {
  font-size: 1.125rem;
  text-align: center;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-xl);
}

/* ============================================
   Icon Container Styles
   ============================================ */
.icon-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-full);
  transition: all var(--duration-normal) var(--ease-default);
}

.icon-container-green {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: white;
}

.icon-container-blue {
  background: linear-gradient(135deg, var(--color-secondary) 0%, var(--color-secondary-dark) 100%);
  color: white;
}

.icon-container-orange {
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-dark) 100%);
  color: white;
}

.icon-container:hover {
  transform: rotate(10deg) scale(1.1);
}

/* ============================================
   Badge Styles
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-md);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-full);
}

.badge-green {
  background-color: var(--color-bg-alt);
  color: var(--color-primary-dark);
}

.badge-blue {
  background-color: #EFF6FF;
  color: var(--color-secondary-dark);
}

.badge-orange {
  background-color: #FFF7ED;
  color: var(--color-accent-dark);
}

/* ============================================
   Toast Notification
   ============================================ */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background-color: var(--color-text-primary);
  color: white;
  padding: var(--space-md) var(--space-xl);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  font-size: 0.875rem;
  z-index: 9999;
  opacity: 0;
  transition: all var(--duration-normal) var(--ease-default);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast-success {
  background-color: var(--color-success);
}

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

/* ============================================
   Mobile-First Responsive Styles
   ============================================ */

/* Mobile (< 640px) */
@media (max-width: 639px) {
  h1 {
    font-size: 2rem;
  }
  
  h2 {
    font-size: 1.5rem;
  }
  
  .section {
    padding: var(--space-2xl) var(--space-md);
  }
  
  .section-title {
    font-size: 1.5rem;
  }
  
  .btn {
    padding: var(--space-sm) var(--space-lg);
    font-size: 0.875rem;
  }
}

/* Tablet (640px - 1024px) */
@media (min-width: 640px) and (max-width: 1023px) {
  .section {
    padding: var(--space-3xl) var(--space-xl);
  }
}

/* Desktop (> 1024px) */
@media (min-width: 1024px) {
  .container {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
  }
}

/* ============================================
   Accessibility
   ============================================ */
@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;
  }
}

/* Focus styles */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ============================================
   Utility Classes
   ============================================ */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.text-center {
  text-align: center;
}

.w-full {
  width: 100%;
}

.h-full {
  height: 100%;
}

.flex {
  display: flex;
}

.items-center {
  align-items: center;
}

.justify-center {
  justify-content: center;
}

.gap-sm {
  gap: var(--space-sm);
}

.gap-md {
  gap: var(--space-md);
}

.gap-lg {
  gap: var(--space-lg);
}
