/* ============================
   仪表盘布局样式
   ============================ */

.dashboard-layout {
  display: flex;
  min-height: 100vh;
  background: #f0f2f5;
}

/* 侧边栏 */
.sidebar {
  width: 260px;
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: width 0.3s ease;
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
}

.sidebar.collapsed {
  width: 72px;
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 72px;
}

.sidebar-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.sidebar-logo img {
  width: 100%;
  height: 100%;
  border-radius: 10px;
  object-fit: cover;
}

.sidebar-brand {
  font-size: 16px;
  font-weight: 700;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar.collapsed .sidebar-brand {
  display: none;
}

/* 导航菜单 */
.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  color: #94a3b8;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 2px;
  text-decoration: none;
  white-space: nowrap;
  position: relative;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.15));
  color: #a78bfa;
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, #6366f1, #8b5cf6);
}

.nav-item-icon {
  font-size: 20px;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
}

.nav-item-text {
  overflow: hidden;
}

.sidebar.collapsed .nav-item-text {
  display: none;
}

.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 12px;
}

/* 侧边栏底部 */
.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  border-radius: 8px;
  border: none;
  background: rgba(255, 255, 255, 0.05);
  color: #64748b;
  cursor: pointer;
  width: 100%;
  font-size: 13px;
  transition: all 0.2s ease;
}

.sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #94a3b8;
}

/* 主内容区 */
.main-content {
  flex: 1;
  margin-left: 260px;
  transition: margin-left 0.3s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.sidebar.collapsed ~ .main-content,
.main-content.collapsed {
  margin-left: 72px;
}

/* 顶部导航 */
.top-header {
  height: 64px;
  background: white;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-title {
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
  font-weight: 600;
}

.user-name {
  font-size: 14px;
  font-weight: 500;
  color: #1e293b;
}

.user-role {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 12px;
  background: #eef2ff;
  color: #6366f1;
  font-weight: 500;
}

.logout-btn {
  padding: 8px 16px;
  font-size: 13px;
  color: #64748b;
  background: #f1f5f9;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-sans);
}

.logout-btn:hover {
  background: #fee2e2;
  color: #ef4444;
}

/* 内容区域 */
.page-content {
  flex: 1;
  padding: 28px;
}

/* 页面标题 */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  color: #1e293b;
}

.page-subtitle {
  font-size: 14px;
  color: #64748b;
  margin-top: 4px;
}

/* 统计卡片 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: white;
  border-radius: 16px;
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  border: 1px solid #f1f5f9;
  transition: all 0.3s ease;
  animation: slideUp 0.5s ease forwards;
  opacity: 0;
}

.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.2s; }
.stat-card:nth-child(3) { animation-delay: 0.3s; }
.stat-card:nth-child(4) { animation-delay: 0.4s; }

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

.stat-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  flex-shrink: 0;
}

.stat-icon.blue { background: linear-gradient(135deg, #dbeafe, #bfdbfe); }
.stat-icon.orange { background: linear-gradient(135deg, #fef3c7, #fde68a); }
.stat-icon.green { background: linear-gradient(135deg, #d1fae5, #a7f3d0); }
.stat-icon.red { background: linear-gradient(135deg, #fee2e2, #fecaca); }
.stat-icon.purple { background: linear-gradient(135deg, #ede9fe, #ddd6fe); }

.stat-value {
  font-size: 28px;
  font-weight: 800;
  color: #1e293b;
  line-height: 1;
}

.stat-label {
  font-size: 13px;
  color: #64748b;
  margin-top: 4px;
}

/* 筛选栏 */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
  padding: 16px 20px;
  background: white;
  border-radius: 12px;
  border: 1px solid #f1f5f9;
}

.filter-bar .form-input,
.filter-bar .form-select {
  width: auto;
  min-width: 160px;
  padding: 8px 12px;
  font-size: 13px;
}

.filter-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

/* 审批流程时间线 */
.approval-timeline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 32px 20px;
  margin: 24px 0;
}

.timeline-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  flex: 0 0 auto;
}

.timeline-dot {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  position: relative;
  z-index: 1;
  transition: all 0.3s ease;
}

.timeline-dot.completed {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.timeline-dot.current {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: white;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
  animation: pulse 2s ease-in-out infinite;
}

.timeline-dot.rejected {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.timeline-dot.pending {
  background: #e5e7eb;
  color: #9ca3af;
}

.timeline-label {
  font-size: 13px;
  font-weight: 500;
  margin-top: 10px;
  color: #64748b;
  white-space: nowrap;
}

.timeline-info {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 4px;
  text-align: center;
  max-width: 120px;
}

.timeline-line {
  width: 80px;
  height: 3px;
  background: #e5e7eb;
  margin: 0 -1px;
  margin-bottom: 40px;
}

.timeline-line.completed {
  background: linear-gradient(90deg, #10b981, #10b981);
}

.timeline-line.active {
  background: linear-gradient(90deg, #10b981, #6366f1);
}

/* Toast */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* 文件上传区域 */
.upload-area {
  border: 2px dashed #d1d5db;
  border-radius: 12px;
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: #fafbfc;
}

.upload-area:hover {
  border-color: #6366f1;
  background: #f5f3ff;
}

.upload-area.dragging {
  border-color: #6366f1;
  background: #eef2ff;
}

.upload-icon {
  font-size: 40px;
  margin-bottom: 8px;
}

.upload-text {
  font-size: 14px;
  color: #64748b;
}

.upload-hint {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 4px;
}

.file-list {
  margin-top: 12px;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #f8fafc;
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 13px;
}

.file-item-name {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #374151;
}

.file-item-remove {
  color: #ef4444;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  border: none;
  background: transparent;
  font-size: 16px;
}

.file-item-remove:hover {
  background: #fee2e2;
}

/* 合同详情区域 */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.detail-item {
  padding: 12px 0;
  border-bottom: 1px solid #f1f5f9;
}

.detail-label {
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-value {
  font-size: 15px;
  color: #1e293b;
  font-weight: 500;
}

.detail-item.full {
  grid-column: 1 / -1;
}

/* 搜索下拉框 */
.search-select {
  position: relative;
}

.search-select-input {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  outline: none;
  transition: all 0.2s ease;
  font-family: var(--font-sans);
}

.search-select-input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px #e0e7ff;
}

.search-select-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  max-height: 200px;
  overflow-y: auto;
  z-index: 10;
  margin-top: 4px;
}

.search-select-option {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.15s ease;
}

.search-select-option:hover {
  background: #f0f0ff;
}

.search-select-option.selected {
  background: #eef2ff;
  color: #4f46e5;
  font-weight: 500;
}

.search-select-empty {
  padding: 16px;
  text-align: center;
  color: #94a3b8;
  font-size: 13px;
}

.search-select-empty a {
  color: #6366f1;
  font-weight: 500;
}

/* 权限矩阵表格 */
.permission-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.permission-table th,
.permission-table td {
  padding: 12px 16px;
  text-align: center;
  border-bottom: 1px solid #f1f5f9;
}

.permission-table th {
  background: #f8fafc;
  font-weight: 600;
  font-size: 13px;
  color: #475569;
}

.permission-table th:first-child,
.permission-table td:first-child {
  text-align: left;
  font-weight: 500;
}

.permission-checkbox {
  width: 18px;
  height: 18px;
  accent-color: #6366f1;
  cursor: pointer;
}

/* 响应式 */
@media (max-width: 768px) {
  .sidebar {
    width: 72px;
  }
  .sidebar .nav-item-text,
  .sidebar .sidebar-brand {
    display: none;
  }
  .main-content {
    margin-left: 72px;
  }
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .filter-bar .form-input,
  .filter-bar .form-select {
    width: 100%;
  }
  .approval-timeline {
    flex-wrap: wrap;
  }
}
