/* shadcn/ui 核心样式系统 */
/* 基于 Radix UI + Tailwind CSS */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  /* 颜色系统 - Apple 风格（更克制） */
  --background: 0 0% 100%;
  --foreground: 0 0% 9%;

  --card: 0 0% 100%;
  --card-foreground: 0 0% 9%;

  --popover: 0 0% 100%;
  --popover-foreground: 0 0% 9%;

  --primary: 211 100% 50%;
  --primary-foreground: 0 0% 100%;

  --secondary: 0 0% 96%;
  --secondary-foreground: 0 0% 9%;

  --muted: 0 0% 96%;
  --muted-foreground: 0 0% 40%;

  --accent: 0 0% 96%;
  --accent-foreground: 0 0% 9%;

  --destructive: 0 100% 59%;
  --destructive-foreground: 0 0% 100%;

  --border: 0 0% 90%;
  --input: 0 0% 90%;
  --ring: 211 100% 50%;

  --radius: 0.5rem;

  /* 阴影系统 - Apple 轻量风格 */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.10);
  --shadow-xl: 0 8px 24px rgba(0, 0, 0, 0.12);
  --shadow-2xl: 0 12px 32px rgba(0, 0, 0, 0.14);
}

/* 深色模式 */
.dark {
  --background: 222.2 84% 4.9%;
  --foreground: 210 40% 98%;

  --card: 222.2 84% 4.9%;
  --card-foreground: 210 40% 98%;

  --popover: 222.2 84% 4.9%;
  --popover-foreground: 210 40% 98%;

  --primary: 217.2 91.2% 59.8%;
  --primary-foreground: 222.2 47.4% 11.2%;

  --secondary: 217.2 32.6% 17.5%;
  --secondary-foreground: 210 40% 98%;

  --muted: 217.2 32.6% 17.5%;
  --muted-foreground: 215 20.2% 65.1%;

  --accent: 217.2 32.6% 17.5%;
  --accent-foreground: 210 40% 98%;

  --destructive: 0 62.8% 30.6%;
  --destructive-foreground: 210 40% 98%;

  --border: 217.2 32.6% 17.5%;
  --input: 217.2 32.6% 17.5%;
  --ring: 224.3 76.3% 48%;
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 按钮组件 */
.shadcn-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
  cursor: pointer;
  white-space: nowrap;
  border: 1px solid transparent;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.shadcn-button:disabled {
  pointer-events: none;
  opacity: 0.5;
}

.shadcn-button:focus-visible {
  outline: none;
  ring: 2px;
  ring-color: hsl(var(--ring));
  ring-offset: 2px;
}

/* 按钮变体 - Default (Apple 风格) */
.shadcn-button-default {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  box-shadow: none;
}

.shadcn-button-default:hover {
  background: hsl(var(--primary) / 0.85);
  box-shadow: var(--shadow-sm);
}

.shadcn-button-default:active {
  background: hsl(var(--primary) / 0.75);
  box-shadow: none;
}

/* 按钮变体 - Destructive (Apple 风格) */
.shadcn-button-destructive {
  background: hsl(var(--destructive));
  color: hsl(var(--destructive-foreground));
  box-shadow: none;
}

.shadcn-button-destructive:hover {
  background: hsl(var(--destructive) / 0.85);
  box-shadow: var(--shadow-sm);
}

/* 按钮变体 - Outline (Apple 风格) */
.shadcn-button-outline {
  border: 1px solid hsl(var(--border));
  background: hsl(var(--background));
  color: hsl(var(--foreground));
}

.shadcn-button-outline:hover {
  background: hsl(var(--secondary));
  border-color: hsl(var(--foreground) / 0.2);
}

/* 按钮变体 - Secondary */
.shadcn-button-secondary {
  background: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
}

.shadcn-button-secondary:hover {
  background: hsl(var(--secondary) / 0.8);
}

/* 按钮变体 - Ghost */
.shadcn-button-ghost {
  background: transparent;
  color: hsl(var(--foreground));
}

.shadcn-button-ghost:hover {
  background: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

/* 按钮变体 - Link */
.shadcn-button-link {
  background: transparent;
  color: hsl(var(--primary));
  text-decoration: underline;
  text-underline-offset: 4px;
}

.shadcn-button-link:hover {
  text-decoration: none;
}

/* 按钮尺寸 */
.shadcn-button-sm {
  height: 2.25rem;
  padding: 0 0.75rem;
  font-size: 0.8125rem;
}

.shadcn-button-default-size {
  height: 2.5rem;
  padding: 0 1rem;
}

.shadcn-button-lg {
  height: 2.75rem;
  padding: 0 2rem;
  font-size: 0.9375rem;
}

.shadcn-button-icon {
  height: 2.5rem;
  width: 2.5rem;
  padding: 0;
}

/* 输入框组件 */
.shadcn-input {
  display: flex;
  height: 2.5rem;
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid hsl(var(--input));
  background: hsl(var(--background));
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
  color: hsl(var(--foreground));
}

.shadcn-input::placeholder {
  color: hsl(var(--muted-foreground));
}

.shadcn-input:focus {
  border-color: hsl(var(--ring));
  ring: 2px;
  ring-color: hsl(var(--ring) / 0.2);
}

.shadcn-input:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* Label 标签 */
.shadcn-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: hsl(var(--foreground));
  line-height: 1;
}

/* 卡片组件 */
.shadcn-card {
  border-radius: calc(var(--radius) + 2px);
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  color: hsl(var(--card-foreground));
  box-shadow: var(--shadow-sm);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.shadcn-card:hover {
  box-shadow: var(--shadow-md);
}

.shadcn-card-header {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  padding: 1.5rem;
}

.shadcn-card-title {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.025em;
}

.shadcn-card-description {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

.shadcn-card-content {
  padding: 1.5rem;
  padding-top: 0;
}

.shadcn-card-footer {
  display: flex;
  align-items: center;
  padding: 1.5rem;
  padding-top: 0;
}

/* Badge 徽章 */
.shadcn-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 9999px;
  padding: 0.125rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.5;
  transition: all 0.15s;
  letter-spacing: 0.01em;
}

.shadcn-badge-default {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

.shadcn-badge-secondary {
  background: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
}

.shadcn-badge-destructive {
  background: hsl(var(--destructive));
  color: hsl(var(--destructive-foreground));
}

.shadcn-badge-outline {
  border: 1px solid hsl(var(--input));
  color: hsl(var(--foreground));
  background: transparent;
}

/* Alert 警告框 */
.shadcn-alert {
  position: relative;
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid hsl(var(--border));
  padding: 1rem;
  background: hsl(var(--background));
}

.shadcn-alert-destructive {
  border-color: hsl(var(--destructive) / 0.5);
  color: hsl(var(--destructive));
  background: hsl(var(--destructive) / 0.1);
}

.shadcn-alert-title {
  font-weight: 500;
  line-height: 1;
  margin-bottom: 0.25rem;
}

.shadcn-alert-description {
  font-size: 0.875rem;
  line-height: 1.5;
  color: hsl(var(--muted-foreground));
}

/* Separator 分隔线 */
.shadcn-separator {
  flex-shrink: 0;
  background: hsl(var(--border));
}

.shadcn-separator-horizontal {
  height: 1px;
  width: 100%;
}

.shadcn-separator-vertical {
  width: 1px;
  height: 100%;
}

/* Checkbox 复选框 */
.shadcn-checkbox {
  height: 1rem;
  width: 1rem;
  flex-shrink: 0;
  border-radius: 0.25rem;
  border: 1px solid hsl(var(--primary));
  background: hsl(var(--background));
  cursor: pointer;
  transition: all 0.15s;
  appearance: none;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.shadcn-checkbox:checked {
  background: hsl(var(--primary));
  border-color: hsl(var(--primary));
}

.shadcn-checkbox:checked::after {
  content: '✓';
  color: hsl(var(--primary-foreground));
  font-size: 0.75rem;
  font-weight: 700;
}

.shadcn-checkbox:focus-visible {
  outline: none;
  ring: 2px;
  ring-color: hsl(var(--ring));
  ring-offset: 2px;
}

/* Switch 开关 */
.shadcn-switch {
  position: relative;
  display: inline-flex;
  height: 1.5rem;
  width: 2.75rem;
  flex-shrink: 0;
  cursor: pointer;
  appearance: none;
  border: 2px solid transparent;
  border-radius: 9999px;
  background: hsl(var(--input));
  transition: all 0.2s;
  outline: none;
}

.shadcn-switch::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 1.25rem;
  width: 1.25rem;
  border-radius: 9999px;
  background: hsl(var(--background));
  box-shadow: var(--shadow-sm);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.shadcn-switch:checked {
  background: hsl(var(--primary));
}

.shadcn-switch:checked::after {
  left: 1.25rem;
}

.shadcn-switch:focus-visible {
  ring: 2px;
  ring-color: hsl(var(--ring));
  ring-offset: 2px;
}

/* Table 表格 */
.shadcn-table {
  width: 100%;
  caption-side: bottom;
  font-size: 0.875rem;
  border-collapse: collapse;
}

.shadcn-table-header {
  border-bottom: 1px solid hsl(var(--border));
}

.shadcn-table-header th {
  height: 3rem;
  padding: 0 1rem;
  text-align: left;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
}

.shadcn-table-body tr {
  border-bottom: 1px solid hsl(var(--border));
  transition: background 0.15s;
}

.shadcn-table-body tr:hover {
  background: hsl(var(--muted) / 0.5);
}

.shadcn-table-body td {
  padding: 1rem;
}

/* Progress 进度条 */
.shadcn-progress {
  position: relative;
  height: 0.5rem;
  width: 100%;
  overflow: hidden;
  border-radius: 9999px;
  background: hsl(var(--secondary));
}

.shadcn-progress-indicator {
  height: 100%;
  background: hsl(var(--primary));
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Skeleton 骨架屏 */
.shadcn-skeleton {
  animation: shadcn-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  border-radius: var(--radius);
  background: hsl(var(--muted));
}

@keyframes shadcn-pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Avatar 头像 */
.shadcn-avatar {
  position: relative;
  display: flex;
  height: 2.5rem;
  width: 2.5rem;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 9999px;
}

.shadcn-avatar-image {
  aspect-ratio: 1 / 1;
  height: 100%;
  width: 100%;
  object-fit: cover;
}

.shadcn-avatar-fallback {
  display: flex;
  height: 100%;
  width: 100%;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
  font-size: 0.875rem;
  font-weight: 500;
}

/* Tooltip 工具提示 */
.shadcn-tooltip {
  z-index: 50;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid hsl(var(--border));
  background: hsl(var(--popover));
  padding: 0.375rem 0.75rem;
  color: hsl(var(--popover-foreground));
  box-shadow: var(--shadow-md);
  font-size: 0.875rem;
  animation: shadcn-fade-in 0.15s;
}

@keyframes shadcn-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* 辅助类 */
.shadcn-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* 响应式间距 */
.shadcn-container {
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

@media (min-width: 640px) {
  .shadcn-container {
    max-width: 640px;
  }
}

@media (min-width: 768px) {
  .shadcn-container {
    max-width: 768px;
  }
}

@media (min-width: 1024px) {
  .shadcn-container {
    max-width: 1024px;
  }
}

@media (min-width: 1280px) {
  .shadcn-container {
    max-width: 1280px;
  }
}

@media (min-width: 1536px) {
  .shadcn-container {
    max-width: 1536px;
  }
}

/* 滚动条美化 */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

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

::-webkit-scrollbar-thumb {
  background: hsl(var(--muted-foreground) / 0.3);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: hsl(var(--muted-foreground) / 0.5);
}
