/* ========================================
   紧固件报价系统 - 样式表
   ======================================== */

/* ===== CSS 变量 ===== */
:root {
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-primary-light: #dbeafe;
  --color-primary-bg: #eff6ff;
  --color-gray: #6b7280;
  --color-gray-light: #f3f4f6;
  --color-gray-border: #e2e8f0;
  --color-green: #16a34a;
  --color-green-light: #dcfce7;
  --color-red: #dc2626;
  --color-red-light: #fee2e2;
  --color-blue: #2563eb;
  --color-blue-light: #dbeafe;
  --color-orange: #ea580c;
  --color-orange-light: #fed7aa;
  --color-bg: #f0f2f5;
  --color-card: #ffffff;
  --color-text: #1e293b;
  --color-text-secondary: #64748b;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
  --radius: 12px;
  --radius-sm: 8px;
  --font: "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
}

/* ===== 基础重置 ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

a {
  text-decoration: none;
  color: inherit;
}

/* ===== 工具类 ===== */
.hidden {
  display: none !important;
}

.mt-16 {
  margin-top: 16px;
}

.mt-20 {
  margin-top: 20px;
}

.loading {
  padding: 40px;
  text-align: center;
  color: var(--color-text-secondary);
}

.error-msg {
  padding: 24px;
  text-align: center;
  color: var(--color-red);
}

.empty-state {
  padding: 40px;
  text-align: center;
  color: var(--color-text-secondary);
}

/* ===== 导航栏 ===== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 24px;
  z-index: 1000;
  box-shadow: var(--shadow-md);
}

.nav-brand {
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
  margin-right: 32px;
}

.nav-menu {
  flex: 1;
  display: flex;
  gap: 4px;
}

.nav-link {
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, 0.85);
  font-size: 14px;
  transition: all 0.2s;
  cursor: pointer;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.nav-link.active {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
  font-weight: 600;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-username {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.9);
}

/* ===== 主容器 ===== */
.app-container {
  padding: 76px 24px 40px;
  max-width: 1280px;
  margin: 0 auto;
}

.page {
  width: 100%;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--color-text);
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.page-header .page-title {
  margin-bottom: 0;
}

/* ===== 按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  line-height: 1.4;
}

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

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

.btn-primary:hover:not(:disabled) {
  background: var(--color-primary-hover);
}

.btn-outline {
  background: #fff;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
}

.btn-outline:hover:not(:disabled) {
  background: var(--color-primary-bg);
}

.btn-outline-danger {
  background: transparent;
  color: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.btn-outline-danger:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.15);
}

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

.btn-danger:hover:not(:disabled) {
  background: #b91c1c;
}

.btn-sm {
  padding: 5px 12px;
  font-size: 13px;
}

.btn-lg {
  padding: 12px 32px;
  font-size: 16px;
}

.btn-block {
  width: 100%;
}

/* ===== 表单 ===== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group > label {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.form-input {
  padding: 8px 12px;
  border: 1px solid var(--color-gray-border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  color: var(--color-text);
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  width: 100%;
}

.form-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

.form-input:readonly {
  background: var(--color-gray-light);
  cursor: not-allowed;
}

textarea.form-input {
  resize: vertical;
  min-height: 38px;
}

select.form-input {
  cursor: pointer;
  appearance: auto;
}

.form-row {
  display: flex;
  gap: 16px;
}

.form-row .form-group {
  flex: 1;
}

.filter-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.filter-row .form-group {
  min-width: 140px;
}

.form-group-keyword {
  flex: 1;
  min-width: 200px;
}

.form-group-btns {
  display: flex;
  gap: 8px;
  flex-direction: row;
  align-items: flex-end;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group-full {
  grid-column: 1 / -1;
}

.form-actions {
  margin-top: 20px;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.inline-form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.qty-input {
  width: 80px;
  padding: 5px 8px;
  font-size: 13px;
}

/* ===== 卡片 ===== */
.card {
  background: var(--color-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  border: 1px solid var(--color-gray-border);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-gray-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body {
  padding: 20px;
}

.count-badge {
  display: inline-block;
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-size: 12px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 20px;
}

/* ===== 表格 ===== */
.table-wrapper {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead th {
  background: var(--color-gray-light);
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  color: var(--color-text-secondary);
  white-space: nowrap;
  border-bottom: 1px solid var(--color-gray-border);
}

.data-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-gray-border);
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background: var(--color-primary-bg);
}

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

.tiers-cell {
  white-space: nowrap;
  font-size: 12px;
  color: var(--color-text-secondary);
}

.action-btns {
  display: flex;
  gap: 6px;
  align-items: center;
}

.status-select {
  width: auto;
  padding: 4px 8px;
  font-size: 12px;
  min-width: 90px;
}

/* ===== 状态标签 ===== */
.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.tag-gray {
  background: var(--color-gray-light);
  color: var(--color-gray);
}

.tag-blue {
  background: var(--color-blue-light);
  color: var(--color-blue);
}

.tag-green {
  background: var(--color-green-light);
  color: var(--color-green);
}

.tag-red {
  background: var(--color-red-light);
  color: var(--color-red);
}

/* ===== 统计卡片 ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--color-card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-gray-border);
  text-align: center;
  transition: transform 0.2s, box-shadow 0.2s;
}

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

.stat-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 4px;
}

.stat-label {
  font-size: 13px;
  color: var(--color-text-secondary);
}

/* ===== 登录页 ===== */
.login-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 76px);
  padding: 20px;
}

.login-card {
  background: var(--color-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  border: 1px solid var(--color-gray-border);
}

.login-logo {
  font-size: 24px;
  font-weight: 700;
  color: var(--color-primary);
  text-align: center;
  margin-bottom: 8px;
}

.login-subtitle {
  text-align: center;
  color: var(--color-text-secondary);
  margin-bottom: 28px;
  font-size: 14px;
}

.login-card .form-group {
  margin-bottom: 18px;
}

.login-card .btn-block {
  margin-top: 8px;
}

.login-hint {
  margin-top: 24px;
  padding: 14px;
  background: var(--color-primary-bg);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--color-text-secondary);
  text-align: center;
}

.login-hint p {
  margin: 2px 0;
}

/* ===== 报价工作台 ===== */
.product-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.product-spec {
  font-weight: 600;
}

.product-meta {
  font-size: 12px;
  color: var(--color-text-secondary);
}

.summary-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.summary-label {
  font-size: 14px;
  color: var(--color-text-secondary);
  white-space: nowrap;
}

.summary-value {
  font-size: 15px;
  font-weight: 600;
}

.summary-input {
  width: 140px;
}

.summary-textarea {
  flex: 1;
}

.summary-full {
  align-items: flex-start;
}

.summary-total {
  padding-top: 12px;
  border-top: 2px solid var(--color-gray-border);
  margin-top: 4px;
}

.summary-total .summary-label {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text);
}

.summary-total .summary-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-primary);
}

/* ===== 报价单详情 ===== */
.quote-detail {
  padding: 0;
}

.detail-header {
  text-align: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--color-primary);
}

.detail-header h2 {
  font-size: 22px;
  color: var(--color-text);
}

.detail-quoteNo {
  margin-top: 6px;
  color: var(--color-text-secondary);
  font-size: 14px;
}

.detail-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 24px;
  margin-bottom: 20px;
  font-size: 14px;
}

.detail-label {
  color: var(--color-text-secondary);
  font-weight: 600;
}

.detail-summary {
  margin-top: 20px;
  padding: 16px 20px;
  background: var(--color-gray-light);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-remark {
  margin-top: 16px;
  padding: 12px;
  background: var(--color-orange-light);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

/* ===== 弹层 ===== */
.modal-root {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
}

.modal {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 720px;
  position: relative;
  z-index: 1;
  margin: auto;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-gray-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 17px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--color-text-secondary);
  padding: 0 4px;
  line-height: 1;
  transition: color 0.2s;
}

.modal-close:hover {
  color: var(--color-red);
}

.modal-body {
  padding: 20px;
  max-height: 60vh;
  overflow-y: auto;
}

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

/* ===== Toast ===== */
.toast-root {
  position: fixed;
  top: 72px;
  right: 24px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  color: #fff;
  min-width: 200px;
  max-width: 400px;
  animation: toast-in 0.3s ease;
}

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

.toast-error {
  background: var(--color-red);
}

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

.toast-hide {
  animation: toast-out 0.3s ease forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(40px);
  }
}

/* ===== 打印区域 ===== */
.print-area {
  display: none;
}

/* ===== 响应式 ===== */
@media (max-width: 900px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .detail-info {
    grid-template-columns: 1fr;
  }

  .nav-brand {
    font-size: 15px;
    margin-right: 16px;
  }

  .nav-link {
    padding: 6px 10px;
    font-size: 13px;
  }

  .filter-row .form-group {
    min-width: 120px;
  }
}

@media (max-width: 600px) {
  .navbar {
    padding: 0 12px;
  }

  .nav-username {
    display: none;
  }

  .app-container {
    padding: 68px 12px 24px;
  }

  .form-row {
    flex-direction: column;
  }

  .filter-row {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-row .form-group {
    min-width: 100%;
  }

  .form-group-btns {
    flex-direction: row;
  }

  .summary-input {
    width: 100px;
  }
}

/* ===== 打印样式 ===== */
@media print {
  body * {
    visibility: hidden;
  }

  #print-area,
  #print-area * {
    visibility: visible;
  }

  #print-area {
    display: block;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    padding: 20px;
  }

  .no-print {
    display: none !important;
  }
}

/* ===== 分页样式 ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 0;
  flex-wrap: wrap;
}

.pagination .page-info {
  font-size: 14px;
  color: var(--color-text-secondary);
  white-space: nowrap;
}
