/* ============================================
   灵感食仓 (InspiLarder) - 全局样式 v2.0
   设计主题：现代极简 · 柑橘暖阳 · 玻璃拟态
   ============================================ */

:root {
  /* 主色调 - 柑橘橙 */
  --primary-50: #FFF7ED;
  --primary-100: #FFEDD5;
  --primary-200: #FED7AA;
  --primary-300: #FDBA74;
  --primary-400: #FB923C;
  --primary-500: #F97316;
  --primary-600: #EA580C;
  --primary-700: #C2410C;
  
  /* 琥珀色 */
  --amber-50: #FFFBEB;
  --amber-100: #FEF3C7;
  --amber-200: #FDE68A;
  --amber-300: #FCD34D;
  --amber-400: #FBBF24;
  --amber-500: #F59E0B;
  
  /* 中性色 */
  --neutral-50: #FAFAF9;
  --neutral-100: #F5F5F4;
  --neutral-200: #E7E5E4;
  --neutral-300: #D6D3D1;
  --neutral-400: #A8A29E;
  --neutral-500: #78716C;
  --neutral-600: #57534E;
  --neutral-700: #44403C;
  --neutral-800: #292524;
  --neutral-900: #1C1917;
  
  /* 状态色 */
  --success: #22C55E;
  --success-light: #DCFCE7;
  --error: #EF4444;
  --error-light: #FEE2E2;
  --warning: #F59E0B;
  --warning-light: #FEF3C7;
  --info: #3B82F6;
  --info-light: #DBEAFE;
  
  /* 玻璃拟态 */
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(255, 255, 255, 0.5);
  --glass-shadow: 0 8px 32px rgba(249, 115, 22, 0.1);
  
  /* 阴影 */
  --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 -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-orange: 0 4px 14px rgba(249, 115, 22, 0.35);
  --shadow-orange-lg: 0 8px 28px rgba(249, 115, 22, 0.45);
  
  /* 圆角 */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-2xl: 32px;
  --radius-full: 9999px;
  
  /* 过渡 */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 350ms ease;
  --transition-spring: 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* 重置样式 */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 16px;
}

body {
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  line-height: 1.6;
  color: var(--neutral-800);
  background: linear-gradient(135deg, var(--neutral-50) 0%, var(--primary-50) 50%, var(--amber-50) 100%);
  background-attachment: fixed;
  min-height: 100vh;
  overflow-x: hidden;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  height: auto;
}

/* 滚动条 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--neutral-300);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--neutral-400);
}

/* ==================== 动画 ==================== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

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

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

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

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

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

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-10px) rotate(2deg); }
}

@keyframes morph {
  0%, 100% { border-radius: 50% 40% 60% 50%; }
  25% { border-radius: 40% 60% 50% 50%; }
  50% { border-radius: 60% 50% 40% 60%; }
  75% { border-radius: 50% 50% 60% 40%; }
}

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

@keyframes ripple {
  0% {
    transform: scale(0);
    opacity: 1;
  }
  100% {
    transform: scale(4);
    opacity: 0;
  }
}

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

/* 动画工具类 */
.animate-fadeIn {
  animation: fadeIn 0.3s ease-out forwards;
  will-change: opacity;
}

.animate-fadeInUp {
  animation: fadeInUp 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
  will-change: opacity, transform;
}

.animate-fadeInScale {
  animation: fadeInScale 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  will-change: opacity, transform;
}

.animate-slideInRight {
  animation: slideInRight 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  will-change: opacity, transform;
}

.animate-bounce {
  animation: bounce 1s cubic-bezier(0.36, 0, 0.66, -0.56) infinite;
  will-change: transform;
}

.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  will-change: opacity, transform;
}

.animate-spin {
  animation: spin 1s linear infinite;
  will-change: transform;
}

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

.animate-morph {
  animation: morph 8s ease-in-out infinite;
  will-change: border-radius;
}

.animate-gradient {
  background-size: 200% 200%;
  animation: gradient 3s ease infinite;
  will-change: background-position;
}

.delay-100 { animation-delay: 80ms; }
.delay-200 { animation-delay: 160ms; }
.delay-300 { animation-delay: 240ms; }
.delay-400 { animation-delay: 320ms; }
.delay-500 { animation-delay: 400ms; }
.delay-600 { animation-delay: 480ms; }

/* ==================== AI加载动画 ==================== */
.ai-loading-container {
  position: relative;
  width: 160px;
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-loading-ring {
  position: absolute;
  border-radius: 50%;
  border: 3px solid transparent;
}

.ai-loading-ring-1 {
  width: 160px;
  height: 160px;
  border-top-color: var(--primary-400);
  border-right-color: var(--primary-300);
  animation: spin 2s linear infinite;
  will-change: transform;
}

.ai-loading-ring-2 {
  width: 128px;
  height: 128px;
  border-bottom-color: var(--amber-400);
  border-left-color: var(--amber-300);
  animation: spin-reverse 1.5s linear infinite;
  will-change: transform;
}

.ai-loading-ring-3 {
  width: 96px;
  height: 96px;
  border-top-color: var(--primary-500);
  border-bottom-color: var(--amber-500);
  animation: spin 1s linear infinite;
  will-change: transform;
}

.ai-loading-core {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, var(--primary-500) 0%, var(--amber-500) 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 40px rgba(249, 115, 22, 0.48);
  animation: pulse 2s ease-in-out infinite, morph 4s ease-in-out infinite;
  position: relative;
  z-index: 10;
}

.ai-loading-core::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-400), var(--amber-400));
  z-index: -1;
  opacity: 0.5;
  animation: pulse 2s ease-out infinite;
}

.ai-loading-icon {
  font-size: 32px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.ai-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(0,0,0,0.88) 0%, rgba(0,0,0,0.72) 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.ai-loading-overlay.hidden {
  display: none;
}

.ai-loading-text {
  margin-top: 2rem;
  text-align: center;
}

.ai-loading-text h3 {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary-400), var(--amber-400));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}

.ai-loading-text p {
  color: var(--neutral-400);
  font-size: 0.875rem;
  animation: pulse 2s ease-in-out infinite;
}

.ai-loading-progress {
  width: 240px;
  height: 4px;
  background: rgba(255,255,255,0.12);
  border-radius: 2px;
  margin-top: 2rem;
  overflow: hidden;
  position: relative;
}

.ai-loading-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-400), var(--amber-400));
  border-radius: 2px;
  transition: width 0.3s ease;
  position: relative;
  overflow: hidden;
}

.ai-loading-progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: shimmer 1.5s infinite;
}

/* ==================== 玻璃拟态效果 ==================== */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

.glass-dark {
  background: rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.24);
}

.glass-card {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  transition: all var(--transition-normal);
}

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

/* ==================== 渐变文字 ==================== */
.gradient-text {
  background: linear-gradient(135deg, var(--primary-500) 0%, var(--amber-400) 50%, var(--primary-400) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.gradient-text-animated {
  background: linear-gradient(90deg, var(--primary-500), var(--amber-500), var(--primary-500));
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradient 3s ease infinite;
}

/* ==================== 卡片样式 ==================== */
.card {
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--neutral-100);
  transition: all var(--transition-normal);
  overflow: hidden;
}

.card-hover {
  transition: all var(--transition-spring);
}

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

.food-card {
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--neutral-100);
  overflow: hidden;
  transition: all var(--transition-spring);
  cursor: pointer;
}

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

.food-card img {
  transition: transform 0.5s ease;
}

.food-card:hover img {
  transform: scale(1.05);
}

/* ==================== 按钮样式 ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: var(--radius-lg);
  transition: all var(--transition-normal);
  cursor: pointer;
  border: none;
  outline: none;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 60%);
  transform: translate(-50%, -50%) scale(0);
  transition: transform 0.3s ease;
  border-radius: 50%;
}

.btn:active::after {
  transform: translate(-50%, -50%) scale(2);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-500) 0%, var(--amber-500) 100%);
  color: white;
  box-shadow: var(--shadow-orange);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-orange-lg);
}

.btn-secondary {
  background: white;
  color: var(--neutral-700);
  border: 1px solid var(--neutral-200);
}

.btn-secondary:hover {
  background: var(--neutral-50);
  border-color: var(--neutral-300);
}

.btn-ghost {
  background: transparent;
  color: var(--neutral-600);
}

.btn-ghost:hover {
  background: var(--neutral-100);
  color: var(--neutral-800);
}

/* ==================== 表单输入 ==================== */
.input {
  width: 100%;
  padding: 0.875rem 1rem;
  font-size: 1rem;
  border: 1.5px solid var(--neutral-200);
  border-radius: var(--radius-lg);
  background: white;
  color: var(--neutral-800);
  transition: all var(--transition-normal);
  font-family: inherit;
}

.input:hover {
  border-color: var(--neutral-300);
}

.input:focus {
  outline: none;
  border-color: var(--primary-400);
  box-shadow: 0 0 0 4px var(--primary-100);
}

.input::placeholder {
  color: var(--neutral-400);
}

/* ==================== 状态标签 ==================== */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-full);
}

.status-fresh {
  background: var(--success-light);
  color: var(--success);
}

.status-expiring {
  background: var(--warning-light);
  color: #B45309;
}

.status-expired {
  background: var(--error-light);
  color: var(--error);
}

.status-opened {
  background: var(--info-light);
  color: var(--info);
}

/* ==================== 欢迎横幅 ==================== */
.welcome-banner {
  position: relative;
  background: linear-gradient(135deg, var(--primary-500) 0%, var(--amber-500) 100%);
  border-radius: var(--radius-2xl);
  padding: 2rem;
  color: white;
  overflow: hidden;
  box-shadow: var(--shadow-orange-lg);
}

.welcome-banner::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 300px;
  height: 300px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
}

.welcome-banner::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -5%;
  width: 200px;
  height: 200px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 50%;
}

/* ==================== 统计卡片 ==================== */
.stat-card {
  background: white;
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--neutral-100);
  transition: all var(--transition-normal);
  margin-bottom: 0.5rem
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin: 0 auto 0.75rem;
}

.stat-card-icon-orange {
  background: var(--primary-100);
}

.stat-card-icon-amber {
  background: var(--amber-100);
}

.stat-card-icon-blue {
  background: var(--info-light);
}

.stat-card-icon-green {
  background: var(--success-light);
}

.stat-card-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--neutral-800);
  margin-bottom: 0.25rem;
}

.stat-card-label {
  font-size: 0.875rem;
  color: var(--neutral-500);
}

/* ==================== 临期提醒 ==================== */
.expiry-alert {
  background: linear-gradient(135deg, #FEF2F2 0%, #FEE2E2 100%);
  border: 1px solid #FECACA;
  border-radius: var(--radius-xl);
  padding: 1rem 1.25rem;
}

/* ==================== 空状态 ==================== */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
}

.empty-state-icon {
  width: 80px;
  height: 80px;
  background: var(--neutral-100);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  margin: 0 auto 1rem;
}

.empty-state-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--neutral-700);
  margin-bottom: 0.5rem;
}

.empty-state-text {
  font-size: 0.875rem;
  color: var(--neutral-500);
  margin-bottom: 1.5rem;
}

/* ==================== AI消息气泡 ==================== */
.ai-message {
  background: linear-gradient(135deg, var(--primary-50) 0%, var(--amber-50) 100%);
  border: 1px solid var(--primary-200);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
}

/* ==================== 输入方式选择按钮 ==================== */
.input-method-btn {
  transition: all var(--transition-normal);
}

.input-method-btn.active {
  border-color: var(--primary-400);
  background: var(--primary-50);
  color: var(--primary-600);
}

/* ==================== 响应式调整 ==================== */
@media (max-width: 767px) {
  .md\\:hidden {
    display: none !important;
  }
  
  .welcome-banner {
    padding: 1.5rem;
  }
  
  .stat-card-value {
    font-size: 1.5rem;
  }
}

@media (min-width: 768px) {
  .md\:flex {
    display: flex !important;
  }
  
  .md\:hidden {
    display: none !important;
  }
  
  .md\:ml-64 {
    margin-left: 16rem;
  }
}

/* ==================== 工具类 ==================== */
.hidden {
  display: none;
}

.flex {
  display: flex;
}

.line-clamp-1 {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.safe-area-pb {
  padding-bottom: env(safe-area-inset-bottom);
}

.safe-area-pt {
  padding-top: env(safe-area-inset-top);
}

.stagger-list {
  contain: layout style;
}

.stagger-list > * {
  opacity: 0;
  animation: fadeInUp 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
  will-change: opacity, transform;
}

.stagger-list > *:nth-child(1) { animation-delay: 0ms; }
.stagger-list > *:nth-child(2) { animation-delay: 80ms; }
.stagger-list > *:nth-child(3) { animation-delay: 160ms; }
.stagger-list > *:nth-child(4) { animation-delay: 240ms; }
.stagger-list > *:nth-child(5) { animation-delay: 320ms; }
.stagger-list > *:nth-child(6) { animation-delay: 400ms; }
.stagger-list > *:nth-child(7) { animation-delay: 480ms; }
.stagger-list > *:nth-child(8) { animation-delay: 560ms; }
.stagger-list > *:nth-child(9) { animation-delay: 640ms; }

/* ==================== Toast动画 ==================== */
@keyframes toastFadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px) translateX(-50%);
  }
  to {
    opacity: 1;
    transform: translateY(0) translateX(-50%);
  }
}

@keyframes toastFadeOut {
  from {
    opacity: 1;
    transform: translateY(0) translateX(-50%);
  }
  to {
    opacity: 0;
    transform: translateY(-10px) translateX(-50%);
  }
}

.animate-toastIn {
  animation: toastFadeIn 0.3s ease forwards;
}

.animate-toastOut {
  animation: toastFadeOut 0.2s ease forwards;
}