/* ═══════════════════════════════════════════
   益选 OCR — shadcn/ui Theme
   Clean · Minimal · Zinc palette
   ═══════════════════════════════════════════ */

/* Use system fonts with fallbacks — avoids blocking render on Google Fonts */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: local('Inter'), local('InterVariable'),
       url('https://fonts.gstatic.com/s/inter/v18/UcCO3FwrK3iLTeHuS_nVMrMxCp50SjIw2boKoduKmMEVuLyfAZ9hiA.woff2') format('woff2');
}

:root {
  /* ── Backgrounds ── */
  --bg-page: #fafafa;
  --bg-card: #ffffff;
  --bg-sidebar: #09090b;
  --bg-hover: #f4f4f5;
  --bg-dark: #09090b;

  /* ── Semantic colors (shadcn zinc) ── */
  --primary: #18181b;
  --primary-hover: #27272a;
  --primary-active: #09090b;
  --primary-light: #f5f5f5;
  --success: #22c55e;
  --success-light: #f0fdf4;
  --warning: #f97316;
  --warning-light: #fff7ed;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --info: #18181b;

  /* ── Extended palette ── */
  --indigo-500: #6366f1;
  --indigo-400: #818cf8;
  --indigo-100: rgba(99,102,241,0.1);
  --emerald-500: #10b981;
  --emerald-100: rgba(16,185,129,0.1);
  --amber-400: #fbbf24;
  --amber-500: #f59e0b;
  --amber-600: #d97706;
  --amber-100: rgba(245,158,11,0.1);
  --red-500: #ef4444;
  --red-100: rgba(239,68,68,0.1);

  /* ── Text ── */
  --text-primary: #18181b;
  --text-secondary: #525252;
  --text-muted: #a1a1aa;
  --text-inverse: #ffffff;
  --text-sidebar: #a1a1aa;
  --text-sidebar-active: #fafafa;

  /* ── Borders ── */
  --border-light: #e4e4e7;
  --border-subtle: #f4f4f5;
  --border-focus: #18181b;

  /* ── Shadows ── */
  --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.05);
  --shadow-md: 0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px -1px rgba(0,0,0,0.1);
  --shadow-lg: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);

  /* ── Radius ── */
  --radius: 10px;
  --radius-lg: 14px;
  --radius-sm: 6px;

  /* ── Typography ── */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

  /* ── Transitions ── */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 0.15s;
  --duration-normal: 0.2s;
  --duration-slow: 0.3s;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-page);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ═══════════════════════════════════════════
   Element Plus — shadcn Overrides
   ═══════════════════════════════════════════ */

/* ── Card ── */
.el-card {
  border: 1px solid var(--border-light) !important;
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow-sm) !important;
  background: var(--bg-card) !important;
  transition: box-shadow 0.2s, border-color 0.2s !important;
}

.el-card:hover {
  box-shadow: var(--shadow-md) !important;
  border-color: #d4d4d8 !important;
}

/* ── Buttons ── */
.el-button {
  border-radius: var(--radius-sm) !important;
  font-weight: 500 !important;
  letter-spacing: 0;
  transition: all 0.15s ease !important;
  box-shadow: none !important;
}

.el-button--default {
  border: 1px solid #e4e4e7 !important;
  box-shadow: none !important;
  background: #ffffff !important;
  color: #18181b !important;
}

.el-button--default:hover {
  background: #f4f4f5 !important;
  border-color: #d4d4d8 !important;
  color: #18181b !important;
}

.el-button--default:active {
  background: #e4e4e7 !important;
}

.el-button--primary {
  background: #18181b !important;
  border: 1px solid #18181b !important;
  box-shadow: none !important;
  color: #fff !important;
}

.el-button--primary:hover {
  background: #27272a !important;
  border-color: #27272a !important;
}

.el-button--primary:active {
  background: #09090b !important;
}

.el-button--danger {
  background: #ef4444 !important;
  border: 1px solid #ef4444 !important;
  box-shadow: none !important;
  color: #fff !important;
}

.el-button--danger:hover {
  background: #dc2626 !important;
  border-color: #dc2626 !important;
}

.el-button--warning {
  border: 1px solid #f97316 !important;
  box-shadow: none !important;
}

.el-button--success {
  border: 1px solid #22c55e !important;
  box-shadow: none !important;
}

/* Link buttons — no border/shadow */
.el-button--primary.is-link,
.el-button--danger.is-link,
.el-button--default.is-link {
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
}

.el-button--primary.is-link {
  color: #18181b !important;
}

.el-button--primary.is-link:hover {
  background: transparent !important;
  color: #27272a !important;
}

.el-button--danger.is-link {
  color: #ef4444 !important;
}

.el-button--danger.is-link:hover {
  color: #dc2626 !important;
}

/* Small buttons */
.el-button--small {
  border-radius: var(--radius-sm) !important;
}

/* ── Input / Select ── */
.el-input__wrapper,
.el-select .el-input__wrapper {
  border: 1px solid #e4e4e7 !important;
  border-radius: var(--radius-sm) !important;
  box-shadow: none !important;
  background: #ffffff !important;
  transition: border-color 0.15s ease !important;
}

.el-input__wrapper:hover,
.el-select .el-input__wrapper:hover {
  border-color: #a1a1aa !important;
}

.el-input__wrapper.is-focus,
.el-select .el-input__wrapper.is-focus {
  border-color: #18181b !important;
  box-shadow: 0 0 0 1px #18181b !important;
}

/* ── Table ── */
.el-table {
  --el-table-border-color: #e4e4e7;
  --el-table-header-bg-color: #fafafa;
  border: 1px solid #e4e4e7 !important;
  border-radius: var(--radius) !important;
  overflow: hidden;
  box-shadow: none !important;
}

.el-table th.el-table__cell {
  font-weight: 600 !important;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #525252 !important;
  background: #fafafa !important;
}

.el-table td.el-table__cell {
  border-bottom: 1px solid #f4f4f5 !important;
}

.el-table--striped .el-table__body tr.el-table__row--striped td.el-table__cell {
  background: #fafafa !important;
}

/* ── Dialog ── */
.el-dialog {
  border: 1px solid #e4e4e7 !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-lg) !important;
  overflow: hidden;
}

.el-dialog__header {
  border-bottom: 1px solid #e4e4e7;
  padding: 16px 20px !important;
}

.el-dialog__footer {
  border-top: 1px solid #e4e4e7;
  padding: 12px 20px !important;
}

/* ── Tag ── */
.el-tag {
  border: 1px solid transparent !important;
  border-radius: var(--radius-sm) !important;
  font-weight: 500 !important;
  font-size: 11px;
  letter-spacing: 0.2px;
}

.el-tag--success {
  background: #f0fdf4 !important;
  color: #16a34a !important;
  border-color: #bbf7d0 !important;
}

.el-tag--warning {
  background: #fff7ed !important;
  color: #ea580c !important;
  border-color: #fed7aa !important;
}

.el-tag--danger {
  background: #fef2f2 !important;
  color: #dc2626 !important;
  border-color: #fecaca !important;
}

.el-tag--info {
  background: #f5f5f5 !important;
  color: #525252 !important;
  border-color: #e4e4e7 !important;
}

/* ── Progress ── */
.el-progress-bar__outer {
  border: none !important;
  border-radius: 999px !important;
  box-shadow: none !important;
  background: #f4f4f5 !important;
  height: 8px !important;
}

.el-progress-bar__inner {
  border-radius: 999px !important;
  transition: width 0.4s ease;
  border: none !important;
}

/* ── Dropdown / Popover ── */
.el-dropdown-menu,
.el-popover.el-popper {
  border: 1px solid #e4e4e7 !important;
  border-radius: var(--radius-sm) !important;
  box-shadow: var(--shadow-lg) !important;
}

/* ── Menu (sidebar sub-menu) ── */
.el-menu {
  border-right: none !important;
}

.el-sub-menu .el-menu {
  background: rgba(255,255,255,0.03) !important;
}

.el-sub-menu .el-menu-item {
  padding-left: 52px !important;
  font-size: 13px;
}

.el-menu-item.is-active {
  color: var(--primary) !important;
}

/* ── Breadcrumb ── */
.el-breadcrumb__inner {
  font-weight: 500;
}

/* ── Message / Notification ── */
.el-message {
  border: 1px solid #e4e4e7 !important;
  border-radius: var(--radius-sm) !important;
  box-shadow: var(--shadow-lg) !important;
}

/* ── Tooltip ── */
.el-tooltip__popper.is-dark {
  border: none !important;
  border-radius: var(--radius-sm) !important;
}

/* ═══════════════════════════════════════════
   Scrollbar
   ═══════════════════════════════════════════ */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #d4d4d8;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a1a1aa;
}

/* ═══════════════════════════════════════════
   Animations
   ═══════════════════════════════════════════ */

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.animate-in {
  animation: fadeInUp 0.3s var(--ease-out) both;
}

.animate-in-delay-1 { animation-delay: 0.05s; }
.animate-in-delay-2 { animation-delay: 0.1s; }
.animate-in-delay-3 { animation-delay: 0.15s; }
.animate-in-delay-4 { animation-delay: 0.2s; }

/* ═══════════════════════════════════════════
   Skeleton Loading
   ═══════════════════════════════════════════ */

.skeleton {
  background: linear-gradient(90deg, #f4f4f5 25%, #e4e4e7 50%, #f4f4f5 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
  width: 100%;
}

.skeleton-text.short {
  width: 60%;
}

.skeleton-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.skeleton-card {
  height: 80px;
  border-radius: var(--radius);
}

/* ═══════════════════════════════════════════
   Loading Overlay
   ═══════════════════════════════════════════ */

.loading-overlay {
  position: relative;
  pointer-events: none;
  opacity: 0.7;
}

.loading-overlay::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.5);
  border-radius: inherit;
  z-index: 1;
}

/* ═══════════════════════════════════════════
   Toast / Notification Transitions
   ═══════════════════════════════════════════ */

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

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

.pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
