/* ========================================
   医院网站设计系统 - Design System v1.0
   包含: CSS变量 | Tailwind配置 | 统一组件样式
   ======================================== */

/* ---------- 1. CSS 变量 (设计Tokens) ---------- */
:root {
  /* 主色调 */
  --color-primary: #0056b3;
  --color-primary-light: #1976d2;
  --color-primary-dark: #004494;
  --color-medical-blue: #e6f0fa;
  
  /* 中性色 */
  --color-bg-light: #f8fafc;
  --color-bg-white: #ffffff;
  --color-text-primary: #1e293b;
  --color-text-secondary: #64748b;
  --color-text-muted: #94a3b8;
  --color-border: #e2e8f0;
  
  /* 功能色 */
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-error: #ef4444;
  
  /* 间距系统 (基于4px) */
  --space-1: 0.25rem;   /* 4px */
  --space-2: 0.5rem;    /* 8px */
  --space-3: 0.75rem;   /* 12px */
  --space-4: 1rem;      /* 16px */
  --space-5: 1.25rem;   /* 20px */
  --space-6: 1.5rem;    /* 24px */
  --space-8: 2rem;      /* 32px */
  --space-10: 2.5rem;   /* 40px */
  --space-12: 3rem;     /* 48px */
  --space-16: 4rem;     /* 64px */
  
  /* 圆角 */
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;
  
  /* 阴影 */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  
  /* 字体 */
  --font-sans: 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
  --font-lexend: 'Lexend', sans-serif;
  
  /* 容器最大宽度 */
  --container-max: 1280px;
  
  /* 过渡 */
  --transition-fast: 150ms ease;
  --transition-normal: 300ms ease;
  --transition-slow: 500ms ease;
}

/* ---------- 2. Tailwind 配置 ---------- */
/* Tailwind 配置移至 tailwind.config.js，由 CLI 构建时使用 */

/* ---------- 3. 统一组件样式 ---------- */

/* 卡片组件 */
.card {
  background-color: #fff;
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  transition: all 300ms ease;
}
.card:hover {
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  transform: translateY(-0.25rem);
}

/* 按钮组件 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  font-weight: 500;
  transition: all 300ms ease;
}
.btn-primary {
  background-color: var(--color-primary);
  color: #fff;
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}
.btn-primary:hover {
  background-color: var(--color-primary-dark);
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}
.btn-secondary {
  background-color: #fff;
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
}
.btn-secondary:hover {
  background-color: var(--color-primary);
  color: #fff;
}
.btn-ghost {
  color: var(--color-text-secondary, #64748b);
}
.btn-ghost:hover {
  color: var(--color-primary);
  background-color: #f1f5f9;
}

/* 标签组件 */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
}
.tag-primary {
  background-color: color-mix(in srgb, var(--color-primary) 10%, transparent);
  color: var(--color-primary);
}
.tag-success {
  background-color: #dcfce7;
  color: #15803d;
}
.tag-warning {
  background-color: #fef3c7;
  color: #d97706;
}

/* 输入框组件 */
.input {
  width: 100%;
  padding: 0.5rem 1rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  transition: all 300ms ease;
}
.input:focus {
  outline: none;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-primary) 50%, transparent);
  border-color: var(--color-primary);
}

/* 标题层级 */
h5, .h5 {
  font-size: 1.125rem;
  font-weight: 500;
  color: #1e293b;
}
p, .body {
  font-size: 1rem;
  color: #334155;
  line-height: 1.625;
}
.caption {
  font-size: 0.875rem;
  color: #64748b;
}

/* ---------- 4. 实用工具类 ---------- */

/* 分隔线 */
.divider {
  width: 100%;
  height: 1px;
  background-color: #e2e8f0;
  margin: 2rem 0;
}
.divider-vertical {
  width: 1px;
  height: 100%;
  background-color: #e2e8f0;
  margin: 0 1rem;
}

/* 文字截断 */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- 5. 响应式图片优化 ---------- */
.img-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.img-contain {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.img-lazy {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* 图片懒加载占位符 */
.lazy-loading {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---------- 6. 滚动条美化 ---------- */
/* 隐藏滚动条但保持功能 */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* ---------- 7. 打印样式 ---------- */
@media print {
  .no-print { display: none !important; }
  body { background: white !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd !important; }
}

/* ---------- 8. 页面加载动画 ---------- */
/* 页面淡入动画 */
.animate-fade-in {
  animation: pageFadeIn 0.5s ease-out forwards;
}
@keyframes pageFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* 元素入场动画 - 从下方淡入 */
.animate-slide-up {
  opacity: 0;
  animation: slideUp 0.6s ease-out forwards;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 元素入场动画 - 缩放淡入 */
.animate-scale-in {
  opacity: 0;
  animation: scaleIn 0.5s ease-out forwards;
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

/* 延迟动画 - 用于错开动画顺序 */
.delay-100 { animation-delay: 100ms; }
.delay-200 { animation-delay: 200ms; }
.delay-300 { animation-delay: 300ms; }
.delay-400 { animation-delay: 400ms; }
.delay-500 { animation-delay: 500ms; }
.delay-600 { animation-delay: 600ms; }
.delay-700 { animation-delay: 700ms; }
.delay-800 { animation-delay: 800ms; }

/* 骨架屏加载效果 */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* 页面加载遮罩 */
.page-loader {
  position: fixed;
  inset: 0;
  background: #f8fafc;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.page-loader.hidden {
  opacity: 0;
  visibility: hidden;
}
.page-loader-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #e2e8f0;
  border-top-color: #0056b3;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
