/* ============================================
   物资全过程管理系统 - 公共样式
   ============================================ */

/* 侧边栏样式 */
.sidebar {
  width: 260px;
  min-height: 100vh;
  background: linear-gradient(180deg, var(--primary-800) 0%, var(--primary-900) 100%);
  color: white;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 40;
  transition: transform 0.3s ease;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 1.5rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-logo svg {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.sidebar-logo span {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.025em;
}

.sidebar-nav {
  padding: 1rem 0;
}

.nav-group-title {
  padding: 0.5rem 1.25rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.4);
  margin-top: 0.5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: rgba(255,255,255,0.08);
  color: white;
}

.nav-item.active {
  background: rgba(255,255,255,0.12);
  color: white;
  border-left-color: var(--primary-400);
}

.nav-item svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* 子菜单 */
.nav-sub {
  display: none;
  padding-left: 1rem;
}

.nav-sub.open {
  display: block;
}

.nav-sub .nav-item {
  padding: 0.5rem 1.25rem 0.5rem 2rem;
  font-size: 0.8125rem;
}

/* 主内容区 */
.main-content {
  margin-left: 260px;
  min-height: 100vh;
  background: var(--neutral-100);
}

/* 顶部栏 */
.topbar {
  height: 64px;
  background: white;
  border-bottom: 1px solid var(--neutral-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--neutral-500);
}

.topbar-breadcrumb a {
  color: var(--neutral-500);
  text-decoration: none;
}

.topbar-breadcrumb a:hover {
  color: var(--primary-600);
}

.topbar-breadcrumb .current {
  color: var(--neutral-800);
  font-weight: 500;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.topbar-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--neutral-500);
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  border: none;
  background: none;
}

.topbar-icon-btn:hover {
  background: var(--neutral-100);
  color: var(--neutral-700);
}

.topbar-icon-btn .badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid white;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-500);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

/* 页面内容区 */
.page-content {
  padding: 1.5rem;
}

/* 页面标题 */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--neutral-800);
}

.page-subtitle {
  font-size: 0.875rem;
  color: var(--neutral-500);
  margin-top: 0.25rem;
}

/* 统计卡片 */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  transition: all 0.2s;
  border: 1px solid var(--neutral-200);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon.green { background: var(--primary-100); color: var(--primary-600); }
.stat-icon.blue { background: #dbeafe; color: var(--secondary-blue); }
.stat-icon.amber { background: #fef3c7; color: var(--warning); }
.stat-icon.red { background: #fee2e2; color: var(--danger); }
.stat-icon.teal { background: #ccfbf1; color: var(--secondary-teal); }
.stat-icon.indigo { background: #e0e7ff; color: var(--secondary-indigo); }

.stat-info h3 {
  font-size: 0.8125rem;
  color: var(--neutral-500);
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.stat-info .value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--neutral-800);
  line-height: 1.2;
}

.stat-info .trend {
  font-size: 0.75rem;
  margin-top: 0.25rem;
}

.trend.up { color: var(--success); }
.trend.down { color: var(--danger); }

/* 筛选栏 */
.filter-bar {
  background: white;
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  border: 1px solid var(--neutral-200);
}

.filter-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-item label {
  font-size: 0.8125rem;
  color: var(--neutral-600);
  white-space: nowrap;
}

.filter-item select,
.filter-item input {
  height: 36px;
  border: 1px solid var(--neutral-300);
  border-radius: var(--radius-sm);
  padding: 0 0.75rem;
  font-size: 0.8125rem;
  color: var(--neutral-700);
  background: white;
  min-width: 140px;
  outline: none;
  transition: border-color 0.2s;
}

.filter-item select:focus,
.filter-item input:focus {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(34,197,94,0.1);
}

/* 操作按钮组 */
.action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.action-group {
  display: flex;
  gap: 0.5rem;
}

/* 按钮样式 */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
}

.btn svg { width: 16px; height: 16px; }

.btn-primary {
  background: var(--primary-500);
  color: white;
}
.btn-primary:hover { background: var(--primary-600); }

.btn-secondary {
  background: white;
  color: var(--neutral-700);
  border-color: var(--neutral-300);
}
.btn-secondary:hover { background: var(--neutral-50); border-color: var(--neutral-400); }

.btn-danger {
  background: white;
  color: var(--danger);
  border-color: var(--danger);
}
.btn-danger:hover { background: #fef2f2; }

.btn-success {
  background: var(--success);
  color: white;
}
.btn-success:hover { background: var(--primary-600); }

.btn-warning {
  background: var(--warning);
  color: white;
}
.btn-warning:hover { background: #d97706; }

.btn-sm {
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
}

.btn-lg {
  padding: 0.625rem 1.5rem;
  font-size: 0.9375rem;
}

/* 表格样式 */
.table-container {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  border: 1px solid var(--neutral-200);
}

.table-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--neutral-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.table-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--neutral-800);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.data-table thead {
  background: var(--primary-50);
}

.data-table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--neutral-700);
  border-bottom: 2px solid var(--primary-200);
  white-space: nowrap;
}

.data-table td {
  padding: 0.75rem 1rem;
  color: var(--neutral-600);
  border-bottom: 1px solid var(--neutral-100);
}

.data-table tbody tr {
  transition: background 0.15s;
}

.data-table tbody tr:hover {
  background: var(--primary-50);
}

/* 状态标签 */
.status-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.status-tag.green { background: #dcfce7; color: #15803d; }
.status-tag.blue { background: #dbeafe; color: #1d4ed8; }
.status-tag.amber { background: #fef3c7; color: #b45309; }
.status-tag.red { background: #fee2e2; color: #dc2626; }
.status-tag.gray { background: #f3f4f6; color: #4b5563; }
.status-tag.teal { background: #ccfbf1; color: #0f766e; }

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.green { background: #22c55e; }
.status-dot.blue { background: #3b82f6; }
.status-dot.amber { background: #f59e0b; }
.status-dot.red { background: #ef4444; }
.status-dot.gray { background: #9ca3af; }

/* 分页 */
.pagination {
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--neutral-200);
  font-size: 0.8125rem;
  color: var(--neutral-500);
}

.pagination-btns {
  display: flex;
  gap: 0.25rem;
}

.page-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--neutral-300);
  background: white;
  color: var(--neutral-600);
  cursor: pointer;
  font-size: 0.8125rem;
  transition: all 0.2s;
}

.page-btn:hover { border-color: var(--primary-500); color: var(--primary-600); }
.page-btn.active { background: var(--primary-500); color: white; border-color: var(--primary-500); }

/* 模态框 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal-overlay.show {
  display: flex;
}

.modal {
  background: white;
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 720px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--neutral-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--neutral-800);
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--neutral-400);
  transition: all 0.2s;
  border: none;
  background: none;
}

.modal-close:hover { background: var(--neutral-100); color: var(--neutral-600); }

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--neutral-200);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* 表单样式 */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--neutral-700);
}

.form-label .required {
  color: var(--danger);
  margin-left: 2px;
}

.form-input,
.form-select,
.form-textarea {
  height: 40px;
  border: 1px solid var(--neutral-300);
  border-radius: var(--radius-sm);
  padding: 0 0.75rem;
  font-size: 0.875rem;
  color: var(--neutral-700);
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
  box-sizing: border-box;
}

.form-textarea {
  height: auto;
  min-height: 80px;
  padding: 0.5rem 0.75rem;
  resize: vertical;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(34,197,94,0.1);
}

/* 标签页 */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--neutral-200);
  margin-bottom: 1.5rem;
}

.tab-item {
  padding: 0.75rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--neutral-500);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.tab-item:hover { color: var(--primary-600); }
.tab-item.active {
  color: var(--primary-600);
  border-bottom-color: var(--primary-500);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* 时间轴 */
.timeline {
  position: relative;
  padding-left: 2rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0.5rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--neutral-200);
}

.timeline-item {
  position: relative;
  padding-bottom: 1.5rem;
}

.timeline-dot {
  position: absolute;
  left: -1.625rem;
  top: 0.25rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid white;
}

.timeline-dot.green { background: var(--success); }
.timeline-dot.amber { background: var(--warning); }
.timeline-dot.red { background: var(--danger); }
.timeline-dot.gray { background: var(--neutral-300); }

.timeline-content h4 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--neutral-800);
}

.timeline-content p {
  font-size: 0.8125rem;
  color: var(--neutral-500);
  margin-top: 0.25rem;
}

/* 响应式 */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .stat-cards { grid-template-columns: 1fr; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .action-bar { flex-direction: column; gap: 0.75rem; }
}

/* 搜索框 */
.search-box {
  position: relative;
}

.search-box input {
  height: 40px;
  width: 280px;
  border: 1px solid var(--neutral-300);
  border-radius: var(--radius-lg);
  padding: 0 1rem 0 2.5rem;
  font-size: 0.875rem;
  outline: none;
  transition: all 0.2s;
  background: var(--neutral-50);
}

.search-box input:focus {
  border-color: var(--primary-500);
  background: white;
  box-shadow: 0 0 0 3px rgba(34,197,94,0.1);
}

.search-box svg {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--neutral-400);
}

/* 进度条 */
.progress-bar {
  height: 8px;
  background: var(--neutral-200);
  border-radius: 9999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 9999px;
  transition: width 0.5s ease;
}

.progress-fill.green { background: var(--success); }
.progress-fill.blue { background: var(--secondary-blue); }
.progress-fill.amber { background: var(--warning); }

/* 横向滚动条美化 - 确保表格可横向滚动 */
.table-container [style*="overflow-x"],
.table-container .table-scroll {
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--neutral-300) var(--neutral-100);
}

.table-container [style*="overflow-x"]::-webkit-scrollbar,
.table-container .table-scroll::-webkit-scrollbar {
  height: 10px;
}

.table-container [style*="overflow-x"]::-webkit-scrollbar-track,
.table-container .table-scroll::-webkit-scrollbar-track {
  background: var(--neutral-100);
  border-radius: 5px;
}

.table-container [style*="overflow-x"]::-webkit-scrollbar-thumb,
.table-container .table-scroll::-webkit-scrollbar-thumb {
  background: var(--neutral-300);
  border-radius: 5px;
}

.table-container [style*="overflow-x"]::-webkit-scrollbar-thumb:hover,
.table-container .table-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--neutral-400);
}

/* 文字省略号 + 悬浮显示全部内容 */
.cell-ellipsis {
  max-width: 160px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: default;
  position: relative;
}

.cell-ellipsis:hover::after {
  content: attr(data-full);
  position: absolute;
  left: 0;
  top: 100%;
  z-index: 100;
  background: var(--neutral-800);
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  white-space: normal;
  max-width: 360px;
  min-width: 200px;
  word-break: break-all;
  line-height: 1.5;
  box-shadow: var(--shadow-lg);
  pointer-events: none;
}

/* 物资清单弹窗 */
.material-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
}

.material-modal-overlay.show {
  display: flex;
}

.material-modal {
  background: white;
  border-radius: var(--radius-xl);
  width: 95%;
  max-width: 1200px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
