/**
 * CoserBox 基础样式表
 * 包含前台设计令牌（Design Tokens）、全局重置、通用工具类
 * 设计风格：小红书极简风 - 纯色、无渐变、内容优先
 * 注：后台专用变量（--admin-*）已移至 admin.css
 * @author ike
 * @date 2025-12-19
 */

/* ============================================
   前台设计令牌 - 颜色系统（浅色模式）
   ============================================ */
:root {
  --bg-primary: #FFFFFF;
  --bg-secondary: #FAFAFA;
  --bg-tertiary: #F5F5F5;
  --bg-card: #FFFFFF;
  --bg-input: #FFFFFF;
  --bg-hover: #F5F5F5;

  --text-primary: #222222;
  --text-secondary: #666666;
  --text-tertiary: #5E5E5E;
  --text-muted: #757575;

  --border-color: #EEEEEE;
  --border-focus: #FF2442;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.12);

  --color-primary: #FF2442;
  --color-primary-dark: #E6203B;
  --color-primary-light: #FF6B81;
  --color-secondary: #333333;

  --color-success: #00C853;
  --color-warning: #FF9500;
  --color-error: #FF3B30;
  --color-info: #007AFF;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ============================================
   前台设计令牌 - 深色模式
   ============================================ */
html.dark {
  --bg-primary: #000000;
  --bg-secondary: #000000;            /* 页面背景 */
  --bg-tertiary: #141414;             /* 分区背景 */
  --bg-card: #0A0A0A;                 /* 卡片背景 */
  --bg-input: #141414;
  --bg-hover: #1A1A1A;

  --text-primary: #FFFFFF;
  --text-secondary: #C0C0C0;
  --text-tertiary: #909090;
  --text-muted: #808080;

  --border-color: #1A1A1A;
  --border-focus: #FF2442;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.7);
  --shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.8);

  --color-primary: #FF2442;
  --color-primary-dark: #FF4D6A;
  --color-primary-light: #FF6B81;
}

/* ============================================
   全局重置样式
   ============================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.3s ease, color 0.3s ease;
  line-height: 1.6;
  margin: 0;
  padding: 0;
}

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

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--color-primary-dark);
}

/* ============================================
   自定义滚动条样式
   ============================================ */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 4px;
  transition: background 0.3s;
}

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

/* Firefox 滚动条 */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--text-muted) var(--bg-tertiary);
}

/* 通用滚动条类 */
.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 3px;
  opacity: 0.5;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

.custom-scrollbar {
  scrollbar-width: thin;
  scrollbar-color: var(--text-muted) transparent;
}

/* 隐藏滚动条但保持功能 */
.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

.scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* ============================================
   Alpine.js
   ============================================ */
[x-cloak] {
  display: none !important;
}

/* Theme toggle icons */
.theme-toggle-icon {
  display: none;
}

.theme-toggle-icon--dark {
  display: inline-flex;
}

html.light .theme-toggle-icon--dark {
  display: none;
}

html.light .theme-toggle-icon--light {
  display: inline-flex;
}

/* ============================================
   动画
   ============================================ */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

.loading {
  animation: spin 1s linear infinite;
}

/* ============================================
   纯色背景（替代渐变）
   ============================================ */
.gradient-bg {
  background: var(--color-primary);
}

.gradient-primary {
  background: var(--color-primary);
}

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

.gradient-warning {
  background: var(--color-warning);
}

.gradient-danger {
  background: var(--color-error);
}

/* ============================================
   玻璃效果
   ============================================ */
.glass {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
}
