/* 
  顶级UI设计规范 · superdesign + awwwards-design
  OKLCH 色彩系统 | Inter 现代字体 | 流畅微动画
*/

:root {
  /* ====================== 背景系统 ====================== */
  --bg: oklch(0.98 0.005 270);
  --bg-secondary: oklch(0.95 0.008 270);

  /* ====================== 卡片/容器 ====================== */
  --card: oklch(1 0 0);

  /* ====================== 文字颜色 ====================== */
  --fg: oklch(0.15 0.02 270);
  --fg-secondary: oklch(0.45 0.02 270);
  --fg-muted: oklch(0.6 0.01 270);

  /* ====================== 主色（蓝色） ====================== */
  --primary: oklch(0.55 0.22 255);
  --primary-hover: oklch(0.50 0.24 255);
  --primary-light: oklch(0.92 0.05 255);

  /* ====================== 状态色 ====================== */
  --success: oklch(0.65 0.20 145);
  --warning: oklch(0.70 0.18 70);
  --danger: oklch(0.60 0.22 25);

  /* ====================== 边框 ====================== */
  --border: oklch(0.90 0.01 270);
  --border-light: oklch(0.94 0.005 270);

  /* ====================== 圆角 ====================== */
  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* ====================== 阴影 ====================== */
  --shadow: 0 2px 12px oklch(0 0 0 / 0.06);
  --shadow-lg: 0 8px 32px oklch(0 0 0 / 0.12);
  --shadow-xl: 0 20px 60px oklch(0 0 0 / 0.15);

  /* ====================== 字体 ====================== */
  --font-sans: 'Inter', -apple-system, 'Microsoft YaHei', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* ====================== 动画曲线 ====================== */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 400ms;

  /* ====================== 间距系统 ====================== */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;

  /* ====================== 响应式断点 ====================== */
  --breakpoint-sm: 640px;
  --breakpoint-md: 768px;
  --breakpoint-lg: 1024px;

  /* 注意：图纸标注 drawing.html 有独立的变量定义，不受此文件影响 */
}

/* ====================== 暗色模式 ====================== */
[data-theme="dark"] {
  --bg: oklch(0.13 0.02 270);
  --bg-secondary: oklch(0.18 0.02 270);
  --card: oklch(0.20 0.02 270);
  --fg: oklch(0.95 0.01 270);
  --fg-secondary: oklch(0.75 0.01 270);
  --fg-muted: oklch(0.55 0.01 270);
  --border: oklch(0.30 0.02 270);
  --border-light: oklch(0.25 0.02 270);
  --primary-light: oklch(0.25 0.08 255);
}

/* ====================== 基础全局样式 ====================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  width: 100%;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  line-height: 1.6;
  min-height: 100vh;
}

/* ====================== 字体排版规范 ====================== */
h1 { font-size: 32px; font-weight: 700; line-height: 1.2; }
h2 { font-size: 24px; font-weight: 600; line-height: 1.3; }
h3 { font-size: 18px; font-weight: 600; line-height: 1.4; }
p, .body { font-size: 14px; font-weight: 400; line-height: 1.6; }
small, .muted { font-size: 12px; font-weight: 400; line-height: 1.5; color: var(--fg-muted); }

/* ====================== 按钮样式 ====================== */
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px oklch(0.55 0.22 255 / 0.3);
}

.btn-secondary {
  background: var(--card);
  color: var(--fg);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-secondary);
}

.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ====================== 卡片样式 ====================== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow);
  transition: box-shadow var(--duration-normal) var(--ease-out), 
              transform var(--duration-fast) var(--ease-out);
}

.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

/* ====================== 输入框样式 ====================== */
input, select, textarea {
  width: 100%;
  padding: 10px 14px;
  font-family: var(--font-sans);
  font-size: 14px;
  background: var(--card);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color var(--duration-fast) ease,
              box-shadow var(--duration-fast) ease;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

input::placeholder { color: var(--fg-muted); }

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2386909c' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* ====================== 表格样式 ====================== */
table {
  width: 100%;
  border-collapse: collapse;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card);
  box-shadow: var(--shadow);
}

thead th {
  background: var(--bg-secondary);
  color: var(--fg-secondary);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
}

tbody tr:last-child td { border-bottom: none; }

tbody tr:hover {
  background: var(--primary-light);
}

[data-theme="dark"] tbody tr:hover {
  background: oklch(0.25 0.08 255);
}

/* ====================== 弹窗样式 ====================== */
.modal {
  position: fixed;
  inset: 0;
  background: oklch(0 0 0 / 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--duration-normal) var(--ease-out);
}

.modal.active,
.modal.show {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: #FFFFFF;
  border-radius: 16px;
  box-shadow: 0 10px 40px 0 rgba(0, 0, 0, 0.08), 0 2px 10px 0 rgba(0, 0, 0, 0.05);
  width: calc(100% - 32px);
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 32px 28px;
  position: relative;
  font-family: "Inter", "Source Han Sans SC", "Noto Sans SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif;
  animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal.active .modal-content,
.modal.show .modal-content {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding: 0;
  border-bottom: none;
  align-items: center;
  justify-content: space-between;
}

.modal-body { padding: 28px; }

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* ====================== 动画预设 ====================== */
.hover-lift {
  transition: transform var(--duration-normal) var(--ease-out);
}

.hover-lift:hover {
  transform: translateY(-3px);
}

.fade-in {
  animation: fadeIn var(--duration-slow) var(--ease-out) forwards;
}

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

/* ====================== 工具类 ====================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--fg-muted); }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }

.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

.hidden { display: none !important; }

/* ====================== 响应式 ====================== */
@media (max-width: 768px) {
  .modal-content {
    max-width: 95%;
    margin: 16px;
  }
  
  .card { padding: 16px; }
  
  table { font-size: 13px; }
  thead th, tbody td { padding: 10px 12px; }
}

/* ====================== 无障碍 ====================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ===== 紧凑弹窗样式 ===== */
.modal-content-compact {
  max-width: 520px;
}

.modal-content-compact .modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-content-compact .modal-title {
  font-size: 16px;
  font-weight: 600;
}

.modal-content-compact form {
  padding: 16px 20px 20px;
}

/* 2 列网格布局 */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

/* 紧凑输入框 - 统一高度 */
.input-compact {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  box-sizing: border-box;
  transition: border-color 0.2s;
}

.input-compact:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* 紧凑按钮 */
.btn-compact {
  height: 38px;
  padding: 0 24px;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-sm);
}

/* 表单操作区 */
.form-actions {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.form-actions .btn-compact {
  min-width: 100px;
}

/* 移动端适配 */
@media (max-width: 640px) {
  .form-grid-2 {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  .modal-content-compact {
    width: 96%;
    max-width: none;
  }
  
  .form-actions {
    justify-content: stretch;
  }
  
  .form-actions .btn-compact {
    width: 100%;
  }
}

/* ===== 新建付款申请弹窗 - 企业级B端设计 ===== */

.pay-modal .modal-content {
  background: #FFFFFF;
  border-radius: 16px;
  box-shadow: 0 10px 40px 0 rgba(0, 0, 0, 0.08), 0 2px 10px 0 rgba(0, 0, 0, 0.05);
  max-width: 560px;
  width: calc(100% - 32px);
  padding: 32px 28px;
  font-family: "Inter", "Source Han Sans SC", "Noto Sans SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  animation: payModalIn 0.3s ease-out;
}

@keyframes payModalIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.pay-modal .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding: 0;
  border-bottom: none;
}

.pay-modal .modal-title {
  font-size: 19px;
  font-weight: 700;
  color: #1D2129;
  letter-spacing: 0.5px;
  margin: 0;
  padding: 0;
}

.pay-modal .modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #86909C;
  transition: all 0.2s ease;
  padding: 0;
  line-height: 1;
}

.pay-modal .modal-close:hover {
  background: #F2F3F5;
  color: #1D2129;
}

.pay-modal .form-group {
  margin-bottom: 24px;
}

.pay-modal .form-group:last-child {
  margin-bottom: 0;
}

.pay-modal .form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: #4E5969;
  margin-bottom: 8px;
  text-align: left;
}

.pay-modal .form-group label .required-star {
  color: #F53F3F;
  margin-left: 2px;
}

.pay-modal .form-group input,
.pay-modal .form-group select,
.pay-modal .form-group textarea {
  width: 100%;
  height: 48px;
  border-radius: 8px;
  border: 1px solid #E5E6EB;
  padding: 12px 16px;
  font-size: 14px;
  color: #1D2129;
  background: #FFFFFF;
  font-family: inherit;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.pay-modal .form-group input::placeholder,
.pay-modal .form-group textarea::placeholder {
  color: #86909C;
}

.pay-modal .form-group input:focus,
.pay-modal .form-group select:focus,
.pay-modal .form-group textarea:focus {
  outline: none;
  border-color: #165DFF;
  box-shadow: 0 0 0 3px rgba(22, 93, 255, 0.1);
}

.pay-modal .form-group textarea {
  height: auto;
  min-height: 80px;
  resize: vertical;
}

.pay-modal .form-group .order-select {
  background: #F0F7FF;
  border: 1px solid #165DFF;
  font-weight: 500;
  color: #1D2129;
}

.pay-modal .form-group .order-select:focus {
  background: #F0F7FF;
}

.pay-modal .form-group .order-select option {
  background: #FFFFFF;
  color: #1D2129;
}

.pay-modal .form-group select.pay-mode-default {
  background: #F7F8FA;
}

.pay-modal .submit-btn {
  width: 100%;
  height: 48px;
  border-radius: 8px;
  background: #165DFF;
  color: #FFFFFF;
  font-size: 16px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 32px;
  box-shadow: 0 2px 6px 0 rgba(22, 93, 255, 0.4);
}

.pay-modal .submit-btn:hover {
  background: #0E42C2;
  box-shadow: 0 4px 12px 0 rgba(22, 93, 255, 0.4);
}

@media (max-width: 560px) {
  .pay-modal .modal-content {
    width: 100%;
    padding: 20px;
    border-radius: 12px;
    max-height: 95vh;
  }
  .pay-modal .submit-btn {
    margin-top: 24px;
  }
}


/* ===== 操作列按钮统一 ===== */
.td-actions {
  white-space: nowrap;
  display: flex;
  gap: 6px;
  align-items: center;
}

.td-actions .action-btn {
  height: 32px;
  padding: 0 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* 比价 - 蓝色实心 */
.action-btn-compare {
  background: #165DFF;
  color: #FFFFFF;
}
.action-btn-compare:hover {
  background: #0E42C2;
}

/* 核对 - 橙色实心（区分于比价） */
.action-btn-check {
  background: #FF7D00;
  color: #FFFFFF;
}
.action-btn-check:hover {
  background: #E06A00;
}

/* 删除 - 红色文字，浅底 */
.action-btn-delete {
  background: #FFECE8;
  color: #F53F3F;
  font-weight: 500;
}
.action-btn-delete:hover {
  background: #FDDDD8;
}

/* 批准 - 绿色 */
.action-btn-approve {
  background: #00B42A;
  color: #FFFFFF;
}
.action-btn-approve:hover {
  background: #009A22;
}

/* 拒绝 - 红色实心 */
.action-btn-reject {
  background: #F53F3F;
  color: #FFFFFF;
}
.action-btn-reject:hover {
  background: #CF1322;
}
