/* ============================================
   PetJoy - Three Theme System
   1. Apple Style (苹果风) - Clean, minimal, glassmorphism
   2. Instagram Style (Ins风) - Gradient, vibrant, stories-like
   3. Cartoon Style (卡通风) - Rounded, playful, colorful
   ============================================ */

/* ========== APPLE STYLE ========== */
[data-theme="apple"] {
  --bg-primary: #fbfbfd;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f5f5f7;
  --bg-card: rgba(255, 255, 255, 0.72);
  --bg-overlay: rgba(0, 0, 0, 0.4);
  
  --text-primary: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #86868b;
  --text-inverse: #ffffff;
  
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-light: #2997ff;
  --accent-bg: rgba(0, 113, 227, 0.08);
  
  --success: #34c759;
  --success-bg: rgba(52, 199, 89, 0.12);
  --warning: #ff9500;
  --warning-bg: rgba(255, 149, 0, 0.12);
  --danger: #ff3b30;
  --danger-bg: rgba(255, 59, 48, 0.12);
  
  --border: rgba(0, 0, 0, 0.1);
  --border-strong: rgba(0, 0, 0, 0.15);
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.12);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  
  --font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', monospace;
  
  --header-height: 64px;
  --max-width: 1280px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  
  --glass-blur: blur(20px) saturate(180%);
  --glass-bg: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(255, 255, 255, 0.18);
  
  --gradient-hero: linear-gradient(180deg, #f5f5f7 0%, #fbfbfd 100%);
  --gradient-price: linear-gradient(135deg, #0071e3 0%, #2997ff 100%);

  /* 酷炫光效 & 背景遮罩 */
  --glow-1: rgba(41, 151, 255, 0.35);
  --glow-2: rgba(94, 92, 230, 0.25);
  --glow-3: rgba(0, 113, 227, 0.18);
  --bg-veil: rgba(251, 251, 253, 0.72);
  --accent-glow: rgba(0, 113, 227, 0.35);
}

/* ========== INSTAGRAM STYLE ========== */
[data-theme="instagram"] {
  --bg-primary: #fafafa;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f0f0f0;
  --bg-card: #ffffff;
  --bg-overlay: rgba(0, 0, 0, 0.65);
  
  --text-primary: #262626;
  --text-secondary: #8e8e8e;
  --text-tertiary: #c7c7c7;
  --text-inverse: #ffffff;
  
  --accent: #e1306c;
  --accent-hover: #d11f5b;
  --accent-light: #f56040;
  --accent-bg: rgba(225, 48, 108, 0.08);
  
  --gradient-accent: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
  --gradient-story: linear-gradient(45deg, #feda75, #fa7e1e, #d62976, #962fbf, #4f5bd5);
  
  --success: #2ecc71;
  --success-bg: rgba(46, 204, 113, 0.12);
  --warning: #f39c12;
  --warning-bg: rgba(243, 156, 18, 0.12);
  --danger: #e74c3c;
  --danger-bg: rgba(231, 76, 60, 0.12);
  
  --border: rgba(0, 0, 0, 0.1);
  --border-strong: rgba(0, 0, 0, 0.2);
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 2px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
  
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  
  --font-family: -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --font-mono: 'Courier New', monospace;
  
  --header-height: 60px;
  --max-width: 935px;
  --transition: 0.2s ease;
  
  --glass-blur: blur(12px);
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(255, 255, 255, 0.3);
  
  --gradient-hero: linear-gradient(180deg, #fafafa 0%, #ffffff 100%);
  --gradient-price: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
  
  --badge-live: #3897f0;
  --badge-sale: #e1306c;

  /* 酷炫光效 & 背景遮罩 */
  --glow-1: rgba(214, 41, 118, 0.28);
  --glow-2: rgba(240, 148, 51, 0.30);
  --glow-3: rgba(79, 91, 213, 0.22);
  --bg-veil: rgba(250, 250, 250, 0.70);
  --accent-glow: rgba(225, 48, 108, 0.35);
}

/* ========== CARTOON STYLE ========== */
[data-theme="cartoon"] {
  --bg-primary: #fff9f0;
  --bg-secondary: #fffef9;
  --bg-tertiary: #fff4e0;
  --bg-card: #ffffff;
  --bg-overlay: rgba(64, 44, 16, 0.5);
  
  --text-primary: #3d2914;
  --text-secondary: #8b6f47;
  --text-tertiary: #c4a77d;
  --text-inverse: #ffffff;
  
  --accent: #ff6b6b;
  --accent-hover: #ff5252;
  --accent-light: #ff8a80;
  --accent-bg: rgba(255, 107, 107, 0.1);
  --accent-secondary: #4ecdc4;
  --accent-tertiary: #ffd93d;
  
  --success: #6bcb77;
  --success-bg: rgba(107, 203, 119, 0.15);
  --warning: #ffd93d;
  --warning-bg: rgba(255, 217, 61, 0.15);
  --danger: #ff6b6b;
  --danger-bg: rgba(255, 107, 107, 0.15);
  
  --border: #f0d0a0;
  --border-strong: #e0b070;
  
  --shadow-sm: 0 2px 4px rgba(64, 44, 16, 0.08);
  --shadow-md: 0 4px 15px rgba(64, 44, 16, 0.12);
  --shadow-lg: 0 8px 30px rgba(64, 44, 16, 0.15);
  --shadow-cartoon: 0 6px 0 rgba(64, 44, 16, 0.15);
  
  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 28px;
  --radius-xl: 36px;
  
  --font-family: 'Comic Sans MS', 'Marker Felt', 'Chalkboard SE', -apple-system, sans-serif;
  --font-mono: 'Courier New', monospace;
  
  --header-height: 72px;
  --max-width: 1200px;
  --transition: 0.25s ease;
  
  --glass-blur: blur(10px);
  --glass-bg: rgba(255, 254, 249, 0.8);
  --glass-border: #f0d0a0;
  
  --gradient-hero: linear-gradient(180deg, #fff9f0 0%, #fffef9 100%);
  --gradient-price: linear-gradient(135deg, #ff6b6b 0%, #ff8a80 100%);
  --gradient-rainbow: linear-gradient(90deg, #ff6b6b, #ffd93d, #6bcb77, #4ecdc4, #a78bfa);
  
  --pattern-dots: radial-gradient(circle, rgba(255, 217, 61, 0.15) 1.5px, transparent 1.5px);
  --pattern-size: 20px 20px;

  /* 酷炫光效 & 背景遮罩 */
  --glow-1: rgba(255, 107, 107, 0.28);
  --glow-2: rgba(255, 217, 61, 0.32);
  --glow-3: rgba(78, 205, 196, 0.25);
  --bg-veil: rgba(255, 249, 240, 0.72);
  --accent-glow: rgba(255, 107, 107, 0.35);
}

/* ========== Theme-specific component overrides ========== */

/* Apple theme: glassmorphism header */
[data-theme="apple"] .site-header {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border);
}

/* Instagram theme: clean white header */
[data-theme="instagram"] .site-header {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
}

/* Cartoon theme: colorful header with bottom shadow */
[data-theme="cartoon"] .site-header {
  background: linear-gradient(135deg, #fff9f0, #ffe8c0);
  border-bottom: 3px solid #ffd93d;
  box-shadow: var(--shadow-cartoon);
}

/* Cartoon: playful card borders */
[data-theme="cartoon"] .product-card {
  border: 3px solid var(--border);
  box-shadow: var(--shadow-cartoon);
}

[data-theme="cartoon"] .product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 0 rgba(64, 44, 16, 0.15), var(--shadow-lg);
}

/* Instagram: story-ring on featured products */
[data-theme="instagram"] .product-card.is-featured .card-media-wrapper {
  padding: 4px;
  border-radius: var(--radius-md);
  background: var(--gradient-story);
}

/* Apple: frosted card */
[data-theme="apple"] .product-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
}

/* Cartoon: extra rounded buttons */
[data-theme="cartoon"] .btn-primary {
  border-radius: var(--radius-md);
  font-weight: 700;
  border: 3px solid rgba(64, 44, 16, 0.1);
  box-shadow: var(--shadow-cartoon);
}

[data-theme="cartoon"] .btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 0 rgba(64, 44, 16, 0.15);
}

[data-theme="cartoon"] .btn-primary:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 rgba(64, 44, 16, 0.15);
}

/* Instagram: gradient buttons */
[data-theme="instagram"] .btn-primary {
  background: var(--gradient-accent);
  color: #fff;
  border: none;
}

/* Apple: clean blue button */
[data-theme="apple"] .btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
}

/* Admin: theme option selector cards */
.theme-select-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.theme-option {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 20px;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border);
  background: var(--bg-secondary);
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  text-align: left;
}

.theme-option:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}

.theme-option.selected {
  border-color: var(--accent);
  background: var(--accent-bg);
  box-shadow: 0 0 0 4px var(--accent-bg);
}

.theme-option-icon {
  font-size: 32px;
  line-height: 1;
  margin-bottom: 6px;
}

.theme-option-name {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
}

.theme-option-desc {
  font-size: 12px;
  color: var(--text-tertiary);
}

.theme-option-check {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
}

.theme-option.selected .theme-option-check {
  display: flex;
}

/* Cartoon: rainbow divider */
[data-theme="cartoon"] .section-divider {
  height: 4px;
  background: var(--gradient-rainbow);
  border-radius: 2px;
}

/* Instagram: gradient text */
[data-theme="instagram"] .gradient-text {
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Apple: clean section title */
[data-theme="apple"] .section-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Cartoon: fun section title */
[data-theme="cartoon"] .section-title {
  font-size: 32px;
  font-weight: 800;
  text-shadow: 2px 2px 0 rgba(64, 44, 16, 0.1);
}

/* Instagram: section title */
[data-theme="instagram"] .section-title {
  font-size: 26px;
  font-weight: 700;
}

/* Pattern backgrounds */
[data-theme="cartoon"] body {
  background-image: var(--pattern-dots);
  background-size: var(--pattern-size);
}

/* Tags styling per theme */
[data-theme="apple"] .tag {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

[data-theme="instagram"] .tag {
  background: var(--accent-bg);
  color: var(--accent);
  border: 1px solid transparent;
}

[data-theme="cartoon"] .tag {
  background: var(--accent-bg);
  color: var(--text-primary);
  border: 2px solid var(--border);
  font-weight: 600;
}
