/* UI UX Pro Max - Unified Shared Styles v2.0 */
/* 四大模块统一设计系统 */

/* ================================
   CSS Variables / Design Tokens
   ================================ */
:root {
  /* Colors - Dark Theme Base */
  --bg: #0a0a0c;
  --bg-secondary: #111114;
  --bg-tertiary: #1a1a1f;
  --surface: rgba(255, 255, 255, 0.05);
  --surface-hover: rgba(255, 255, 255, 0.1);
  --surface-active: rgba(255, 255, 255, 0.15);
  --border: rgba(255, 255, 255, 0.1);
  --border-hover: rgba(255, 255, 255, 0.2);
  --border-active: rgba(94, 106, 210, 0.5);

  /* Text */
  --text: #EDEDEF;
  --text-secondary: #A1A1AA;
  --text-muted: #71717A;
  --text-disabled: #52525B;

  /* Accent Colors */
  --accent: #5E6AD2;
  --accent-hover: #4F5AA3;
  --accent-light: rgba(94, 106, 210, 0.15);

  /* Module-specific Gradients */
  --gradient-styles: linear-gradient(135deg, #5E6AD2 0%, #8B5CF6 50%, #EC4899 100%);
  --gradient-colors: linear-gradient(135deg, #10B981 0%, #3B82F6 50%, #8B5CF6 100%);
  --gradient-charts: linear-gradient(135deg, #3B82F6 0%, #8B5CF6 50%, #EC4899 100%);
  --gradient-typography: linear-gradient(135deg, #F59E0B 0%, #EC4899 50%, #8B5CF6 100%);

  /* Category Colors */
  --cat-design: #3B82F6;
  --cat-landing: #10B981;
  --cat-dashboard: #F59E0B;
  --cat-trends: #EC4899;
  --cat-mobile: #8B5CF6;

  /* Spacing Scale */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --space-2xl: 32px;
  --space-3xl: 48px;
  --space-4xl: 64px;

  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px rgba(94, 106, 210, 0.2);
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.3);

  /* Transitions */
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);

  /* Layout */
  --max-width: 1600px;
  --content-width: 1200px;
  --nav-height: 64px;
}

/* ================================
   Reset & Base
   ================================ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

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

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

/* ================================
   Typography
   ================================ */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.text-gradient {
  background: var(--gradient-styles);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-gradient-colors {
  background: var(--gradient-colors);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-gradient-charts {
  background: var(--gradient-charts);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-gradient-typography {
  background: var(--gradient-typography);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ================================
   Layout Components
   ================================ */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-xl);
}

.section {
  padding: var(--space-3xl) 0;
}

/* ================================
   Navigation - Unified
   ================================ */
.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: var(--nav-height);
  padding: 0 var(--space-xl);
  border-bottom: 1px solid var(--border);
  background: rgba(10, 10, 12, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.nav-brand {
  font-size: 18px;
  font-weight: 800;
  background: var(--gradient-styles);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.nav-links {
  display: flex;
  gap: var(--space-xs);
  align-items: center;
}

.nav-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-full);
  transition: all var(--transition-fast);
  position: relative;
}

.nav-link:hover {
  color: var(--text);
  background: var(--surface);
}

.nav-link.active {
  color: var(--text);
  background: var(--accent-light);
}

.nav-link.active::before {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  background: var(--accent);
  border-radius: 50%;
}

.mobile-nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 24px;
  cursor: pointer;
  padding: var(--space-sm);
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
}

.mobile-nav-toggle:hover {
  background: var(--surface);
}

/* ================================
   Hero Section - Unified
   ================================ */
.hero {
  min-height: 50vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: var(--space-3xl) var(--space-xl);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 30%, rgba(94, 106, 210, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 70%, rgba(139, 92, 246, 0.08) 0%, transparent 50%);
  pointer-events: none;
}

.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.02'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.4;
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 800px;
}

.hero h1 {
  font-size: clamp(32px, 5vw, 56px);
  font-weight: 800;
  margin-bottom: var(--space-md);
  letter-spacing: -0.03em;
}

.hero p {
  font-size: clamp(15px, 2vw, 18px);
  color: var(--text-secondary);
  margin-bottom: var(--space-2xl);
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.hero-stats {
  display: flex;
  gap: var(--space-3xl);
  justify-content: center;
  flex-wrap: wrap;
}

.stat {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.stat-value {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 500;
}

/* ================================
   Controls (Search & Filter)
   ================================ */
.controls {
  padding: var(--space-2xl) 0 var(--space-xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.search-wrapper {
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  transition: all var(--transition-fast);
}

.search-bar:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.search-bar svg {
  flex-shrink: 0;
  color: var(--text-muted);
}

.search-bar input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
}

.search-bar input::placeholder {
  color: var(--text-muted);
}

.filter-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  align-items: center;
  justify-content: center;
}

.filter-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-right: var(--space-sm);
}

.filter-btn {
  padding: var(--space-sm) var(--space-lg);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-full);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
}

.filter-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--border-hover);
}

.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.category-filter {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  justify-content: center;
}

/* ================================
   Cards - Unified Base
   ================================ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-xl);
  padding: var(--space-xl) 0 var(--space-4xl);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-normal);
  cursor: pointer;
  position: relative;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, transparent 50%);
  opacity: 0;
  transition: opacity var(--transition-normal);
  pointer-events: none;
}

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

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

.card-image {
  width: 100%;
  aspect-ratio: 16/10;
  object-fit: cover;
  background: var(--bg-secondary);
}

.card-content {
  padding: var(--space-lg);
}

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

.card-num {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--space-xs);
  line-height: 1.3;
}

.card-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.card-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: var(--space-md);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

/* ================================
   Tags & Badges
   ================================ */
.tag {
  display: inline-flex;
  align-items: center;
  padding: var(--space-xs) var(--space-sm);
  font-size: 11px;
  font-weight: 500;
  border-radius: var(--radius-full);
  background: var(--surface-hover);
  color: var(--text-secondary);
  white-space: nowrap;
}

.tag-primary {
  background: var(--accent-light);
  color: var(--accent);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-full);
  background: var(--gradient-styles);
  color: white;
}

/* Category Tags */
.tag-design { background: rgba(59, 130, 246, 0.15); color: #60A5FA; }
.tag-landing { background: rgba(16, 185, 129, 0.15); color: #34D399; }
.tag-dashboard { background: rgba(245, 158, 11, 0.15); color: #FBBF24; }
.tag-trends { background: rgba(236, 72, 153, 0.15); color: #F472B6; }
.tag-mobile { background: rgba(139, 92, 246, 0.15); color: #A78BFA; }

/* Accessibility Tags */
.tag-aaa { background: rgba(16, 185, 129, 0.15); color: #34D399; }
.tag-aa { background: rgba(59, 130, 246, 0.15); color: #60A5FA; }
.tag-a { background: rgba(139, 92, 246, 0.15); color: #A78BFA; }
.tag-b { background: rgba(245, 158, 11, 0.15); color: #FBBF24; }
.tag-c { background: rgba(239, 68, 68, 0.15); color: #F87171; }

/* ================================
   Module-specific Cards
   ================================ */

/* Color Card */
.color-card .color-preview {
  height: 100px;
  display: flex;
}

.color-swatch {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: flex var(--transition-fast);
  position: relative;
}

.color-swatch:hover {
  flex: 1.5;
}

.color-swatch::after {
  content: attr(data-color);
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  opacity: 0;
  transition: opacity var(--transition-fast);
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.color-swatch:hover::after {
  opacity: 1;
}

/* Chart Card */
.chart-card .chart-preview {
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(30,30,40,0.8) 0%, rgba(20,20,30,0.9) 100%);
  border-bottom: 1px solid var(--border);
  padding: var(--space-lg);
}

.chart-preview svg {
  width: 100%;
  height: 100%;
}

/* Font Card */
.font-card .font-preview {
  padding: var(--space-2xl);
  background: linear-gradient(135deg, rgba(94,106,210,0.05) 0%, rgba(139,92,246,0.05) 100%);
  border-bottom: 1px solid var(--border);
  min-height: 140px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.font-preview .heading-text {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 8px;
  line-height: 1.2;
}

.font-preview .subheading-text {
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 10px;
  opacity: 0.85;
}

.font-preview .body-text {
  font-size: 13px;
  line-height: 1.6;
  opacity: 0.7;
}

/* Style Card */
.style-card .card-image-wrapper {
  position: relative;
  overflow: hidden;
}

.style-card .palette {
  margin-top: auto;
  padding-top: var(--space-md);
}

/* ================================
   Color Palette Display
   ================================ */
.palette {
  display: flex;
  gap: var(--space-xs);
}

.palette-color {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.palette-color:hover {
  transform: scale(1.2);
}

/* ================================
   Empty State
   ================================ */
.empty-state {
  text-align: center;
  padding: var(--space-4xl) var(--space-xl);
  color: var(--text-muted);
  grid-column: 1/-1;
}

.empty-state-icon {
  font-size: 56px;
  margin-bottom: var(--space-lg);
  opacity: 0.6;
}

.empty-state h3 {
  font-size: 20px;
  color: var(--text);
  margin-bottom: var(--space-sm);
}

.empty-state p {
  font-size: 14px;
}

/* ================================
   Footer - Unified
   ================================ */
.footer {
  text-align: center;
  padding: var(--space-3xl) var(--space-xl);
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: var(--space-xl);
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: color var(--transition-fast);
}

.footer-links a:hover {
  color: var(--accent);
}

.footer p {
  color: var(--text-muted);
  font-size: 13px;
}

/* ================================
   Toast Notification
   ================================ */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  font-size: 14px;
  color: var(--text);
  box-shadow: var(--shadow-lg);
  z-index: 10000;
  animation: slideInUp 0.3s ease;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.toast::before {
  content: '✓';
  width: 20px;
  height: 20px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: white;
}

/* ================================
   Loading States
   ================================ */
.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-hover) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: var(--radius-md);
}

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

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

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

::-webkit-scrollbar-thumb {
  background: var(--surface-hover);
  border-radius: var(--radius-full);
}

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

/* ================================
   Animations
   ================================ */
@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

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

/* Card entrance animation */
.card-enter {
  animation: scaleIn 0.4s ease backwards;
}

/* ================================
   Responsive Design
   ================================ */
@media (max-width: 1024px) {
  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-lg);
  }
}

@media (max-width: 768px) {
  :root {
    --nav-height: 60px;
  }

  .nav {
    padding: 0 var(--space-lg);
  }

  .mobile-nav-toggle {
    display: block;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: rgba(10, 10, 12, 0.98);
    border-bottom: 1px solid var(--border);
    padding: var(--space-md);
    flex-direction: column;
    gap: var(--space-xs);
    backdrop-filter: blur(20px);
  }

  .nav-links.mobile-open {
    display: flex;
  }

  .nav-link {
    padding: var(--space-md);
    width: 100%;
    text-align: center;
  }

  .nav-link.active::before {
    display: none;
  }

  .hero {
    min-height: 40vh;
    padding: var(--space-2xl) var(--space-lg);
  }

  .hero-stats {
    gap: var(--space-xl);
  }

  .controls {
    padding: var(--space-xl) 0;
  }

  .filter-wrapper {
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: var(--space-sm);
    -webkit-overflow-scrolling: touch;
  }

  .filter-wrapper::-webkit-scrollbar {
    display: none;
  }

  .category-filter {
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: var(--space-sm);
    -webkit-overflow-scrolling: touch;
  }

  .category-filter::-webkit-scrollbar {
    display: none;
  }

  .card-grid {
    grid-template-columns: 1fr;
    padding: var(--space-lg) 0 var(--space-3xl);
  }

  .footer {
    padding: var(--space-2xl) var(--space-lg);
  }

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

@media (max-width: 480px) {
  .container {
    padding: 0 var(--space-lg);
  }

  .search-wrapper {
    padding: 0 var(--space-sm);
  }

  .stat-value {
    font-size: 28px;
  }
}

/* ================================
   Utility Classes
   ================================ */
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.mt-auto { margin-top: auto; }
.mb-auto { margin-bottom: auto; }
.text-center { text-align: center; }
.text-sm { font-size: 12px; }
.text-md { font-size: 14px; }
.text-lg { font-size: 16px; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
