/**
 * Sun Team - Unified Component Styles
 * 统一组件样式 - 基于 styles.css 的设计系统
 * 
 * 注意: 此文件定义核心组件变量和基础样式
 * 页面特定样式见 styles.css 和 index.css
 */

/* ========================================
   CSS Variables - Design Tokens (引用自 styles.css)
   ======================================== */
:root {
  /* Primary Colors - 统一使用 accent-* 命名 */
  --color-primary: var(--accent-orange);
  --color-secondary: var(--accent-pink);
  
  /* Backgrounds */
  --bg-dark: #0a0a0a;
  --bg-dark-secondary: #1c1c1e;
  --bg-dark-tertiary: #2c2c2e;
  --bg-light: #ffffff;
  --bg-light-secondary: #f5f5f7;
  
  /* Text */
  --text-dark: #f5f5f7;
  --text-dark-secondary: #98989d;
  --text-dark-muted: #636366;
  --text-light: #1d1d1f;
  --text-light-secondary: #6e6e73;
  
  /* Borders */
  --border-dark: #38383a;
  --border-light: #d2d2d7;
  
  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.2);
  --shadow-glow: 0 0 40px rgba(255, 149, 0, 0.3);
  
  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  
  /* Border Radius - 统一使用 12px 基准 */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;
  
  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.3s ease;
  --transition-slow: 0.5s ease;
}

/* ========================================
   Button Base Styles - 统一按钮规范
   ======================================== */

/* 基础按钮类 (供其他按钮样式继承) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  border: none;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.btn:hover::before {
  left: 100%;
}

/* Primary Button */
.btn-primary {
  background: var(--gradient-brand);
  color: white;
  box-shadow: 0 4px 24px rgba(255, 149, 0, 0.35);
}

.btn-primary:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 12px 32px rgba(255, 149, 0, 0.15);
}

.btn-primary:active {
  transform: translateY(-1px) scale(1);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Secondary Button */
.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-tertiary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

/* Outline Button */
.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-outline:hover {
  border-color: var(--accent-orange);
  color: var(--accent-orange);
}

/* Button Sizes - 统一尺寸 */
.btn-sm {
  padding: 10px 18px;
  font-size: 13px;
  border-radius: 10px;
}

.btn-lg {
  padding: 16px 32px;
  font-size: 16px;
  border-radius: 14px;
}

.btn-block {
  width: 100%;
}

/* ========================================
   Card Components - 统一卡片规范
   ======================================== */

/* 基础卡片 */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-orange);
  box-shadow: var(--shadow-hover);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card-body {
  flex: 1;
}

/* Feature Card */
.feature-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 32px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.feature-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 80px;
  height: 80px;
  background: radial-gradient(circle at top left, rgba(255, 149, 0, 0.15), transparent 70%);
  border-radius: 20px 0 100% 0;
  transition: all 0.4s;
}

.feature-card:hover {
  transform: translateY(-8px);
  border-color: var(--accent-orange);
  box-shadow: 0 20px 40px rgba(255, 149, 0, 0.15);
}

.feature-card:hover::before {
  width: 120px;
  height: 120px;
}

.feature-icon {
  width: 48px;
  height: 48px;
  background: var(--gradient-brand);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 20px;
}

/* Agent Card */
.agent-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.agent-card:hover {
  border-color: var(--accent-orange);
  transform: translateX(8px) scale(1.02);
  box-shadow: 0 8px 32px rgba(255, 149, 0, 0.2);
}

.agent-card.active {
  border-color: var(--accent-green);
  background: rgba(52, 199, 89, 0.05);
}

/* Pricing Card */
.pricing-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.pricing-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 20px;
  padding: 1px;
  background: linear-gradient(135deg, transparent 40%, var(--accent-orange), transparent 60%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity var(--transition-base);
}

.pricing-card:hover {
  transform: translateY(-8px);
  border-color: var(--accent-orange);
  box-shadow: 0 20px 40px rgba(255, 149, 0, 0.15);
}

.pricing-card:hover::before {
  opacity: 1;
}

.pricing-card.featured {
  border-color: var(--accent-purple);
  background: linear-gradient(180deg, rgba(135, 90, 249, 0.08) 0%, var(--bg-secondary) 100%);
}

.pricing-card.featured::before {
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-pink), var(--accent-orange));
  opacity: 1;
}

.pricing-card.featured:hover {
  border-color: var(--accent-purple);
  box-shadow: 0 20px 40px rgba(135, 90, 249, 0.25), 0 0 60px rgba(135, 90, 249, 0.1);
  transform: translateY(-12px) scale(1.02);
}

/* ========================================
   Form Components - 统一表单规范
   ======================================== */

.form-group {
  margin-bottom: var(--space-md);
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.form-label .optional {
  color: var(--text-muted);
  font-weight: 400;
}

.form-input,
.form-textarea {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 15px;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.form-input:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(50, 211, 235, 0.1);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
}

.form-error {
  color: #ef4444;
  font-size: 12px;
  margin-top: var(--space-xs);
  display: none;
}

.form-group.error .form-input,
.form-group.error .form-textarea {
  border-color: #ef4444;
}

.form-group.error .form-error {
  display: block;
}

/* ========================================
   Badge Components - 统一徽章规范
   ======================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
}

.badge-live {
  background: rgba(52, 199, 89, 0.15);
  border: 1px solid rgba(52, 199, 89, 0.3);
  color: var(--accent-green);
}

.badge-live .dot {
  width: 6px;
  height: 6px;
  background: var(--accent-green);
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

.badge-featured {
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-pink));
  color: white;
}

.badge-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

/* ========================================
   Status Indicators - 统一状态指示器
   ======================================== */

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot.online {
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
}

.status-dot.busy {
  background: var(--accent-orange);
}

.status-dot.idle {
  background: var(--text-muted);
}

.status-dot.thinking {
  background: var(--accent-purple);
  animation: thinking 1.5s infinite;
}

/* ========================================
   Navigation Components - 统一导航规范
   ======================================== */

.nav-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 8px;
  transition: all 0.2s;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

/* Mobile Navigation */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(10, 10, 10, 0.95);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-color);
  padding: 8px 16px;
  justify-content: space-around;
  z-index: 1000;
}

.mobile-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  font-size: 10px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.2s;
}

.mobile-nav a.active {
  color: var(--accent-orange);
}

.mobile-nav a span {
  font-size: 20px;
}

/* Hamburger Menu */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  z-index: 1001;
}

.menu-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all 0.3s ease;
}

.menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* ========================================
   Animations
   ======================================== */

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

@keyframes thinking {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

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

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.animate-slide-up {
  animation: slideUp 0.6s ease-out;
}

.animate-fade-in {
  animation: fadeIn 0.3s ease-out;
}

/* ========================================
   Mobile Optimizations - 统一移动端适配
   ======================================== */

@media (max-width: 768px) {
  /* Buttons */
  .btn-primary,
  .btn-secondary,
  .btn-outline {
    padding: 12px 20px;
    font-size: 14px;
    min-height: 48px;
  }
  
  .btn-lg {
    padding: 16px 28px;
    font-size: 16px;
  }
  
  /* Cards */
  .card,
  .feature-card,
  .pricing-card {
    padding: 16px;
  }
  
  /* Forms */
  .form-input,
  .form-textarea {
    font-size: 16px; /* Prevent zoom on iOS */
    padding: 14px 16px;
  }
  
  /* Mobile Navigation */
  .menu-toggle {
    display: flex;
  }
  
  .mobile-nav {
    display: flex;
  }
  
  /* Touch targets */
  .nav-link,
  .badge,
  .status-dot {
    min-height: 44px;
    min-width: 44px;
  }
}

@media (max-width: 480px) {
  .btn-primary,
  .btn-secondary,
  .btn-outline {
    width: 100%;
  }
  
  .feature-card:hover,
  .pricing-card:hover {
    transform: translateY(-4px);
  }
}

/* Touch device optimizations */
@media (hover: none) {
  .card:hover,
  .feature-card:hover,
  .pricing-card:hover,
  .agent-card:hover {
    transform: none;
  }
  
  .card:active,
  .feature-card:active,
  .pricing-card:active,
  .agent-card:active {
    transform: scale(0.98);
  }
}
