/* 天偌装修平台 - 预算管理样式 v2 (桌面优化) */

/* =============================================
   页面布局 - 桌面端双栏
   ============================================= */
.budget-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 24px;
  align-items: start;
}

.budget-sidebar {
  position: sticky;
  top: 80px;
}

.budget-main {
  min-width: 0;
}

/* =============================================
   项目选择器
   ============================================= */
.project-selector {
  background: var(--white, #fff);
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.project-selector h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
}

.project-selector select {
  max-width: 240px;
}

/* =============================================
   预算概览卡片
   ============================================= */
.budget-overview-card {
  background: linear-gradient(135deg, #e07b39, #f0a060);
  border-radius: 14px;
  padding: 24px;
  color: #fff;
  margin-bottom: 16px;
}

.budget-overview-card .card-title {
  font-size: 13px;
  opacity: .8;
  margin-bottom: 4px;
}

.budget-overview-card .card-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.budget-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.budget-stat-item {
  background: var(--white, #fff);
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: 0 2px 6px rgba(0,0,0,.05);
  border: 1px solid #f0f0f0;
}

.budget-stat-item .stat-label {
  font-size: 12px;
  color: #888;
  margin-bottom: 2px;
}

.budget-stat-item .stat-value {
  font-size: 18px;
  font-weight: 700;
}

.budget-stat-item.success .stat-value { color: #22c55e; }
.budget-stat-item.warning .stat-value { color: #f59e0b; }

/* 进度条 */
.budget-progress-card {
  background: var(--white, #fff);
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 2px 6px rgba(0,0,0,.05);
  border: 1px solid #f0f0f0;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 8px;
}

.progress-bar {
  height: 8px;
  background: #f0f0f0;
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, #e07b39, #f0a060);
  transition: width .5s ease;
}

.progress-fill.over {
  background: linear-gradient(90deg, #f59e0b, #ef4444);
}

/* =============================================
   操作栏
   ============================================= */
.action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.action-bar h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.action-bar .filters {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* =============================================
   材料表格
   ============================================= */
.material-table-wrapper {
  background: var(--white, #fff);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  border: 1px solid #f0f0f0;
  overflow: hidden;
}

.material-table {
  width: 100%;
  border-collapse: collapse;
}

.material-table thead {
  background: #fafafa;
}

.material-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: .5px;
  border-bottom: 1px solid #eee;
  white-space: nowrap;
}

.material-table td {
  padding: 12px 16px;
  font-size: 14px;
  border-bottom: 1px solid #f5f5f5;
  vertical-align: middle;
}

.material-table tbody tr:hover {
  background: #fafafa;
}

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

.material-table .text-right {
  text-align: right;
}

.material-table .text-center {
  text-align: center;
}

/* 分类标签 */
.category-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.category-badge.cat-rough {
  background: #fef3c7;
  color: #92400e;
}

.category-badge.cat-finish {
  background: #dbeafe;
  color: #1e40af;
}

.category-badge.cat-appliance {
  background: #d1fae5;
  color: #065f46;
}

.category-badge.cat-other {
  background: #f3f4f6;
  color: #6b7280;
}

/* 操作按钮 */
.action-btns {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.btn-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #666;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: all .2s;
}

.btn-icon:hover {
  border-color: #e07b39;
  color: #e07b39;
  background: #fff7ed;
}

.btn-icon.danger:hover {
  border-color: #ef4444;
  color: #ef4444;
  background: #fef2f2;
}

/* =============================================
   统计区域
   ============================================= */
.stats-section {
  margin-top: 24px;
}

.stats-section h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.stats-card {
  background: var(--white, #fff);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  border: 1px solid #f0f0f0;
}

.stats-card h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  color: #333;
}

/* 分类列表 */
.category-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.category-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #f5f5f5;
  font-size: 13px;
}

.category-item:last-child {
  border-bottom: none;
}

.category-item .cat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 8px;
  flex-shrink: 0;
}

.category-item .cat-name {
  flex: 1;
  display: flex;
  align-items: center;
}

.category-item .cat-amount {
  font-weight: 600;
  color: #333;
}

/* =============================================
   空状态
   ============================================= */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #999;
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: .3;
}

.empty-state p {
  font-size: 14px;
  margin-bottom: 16px;
}

/* =============================================
   弹窗优化
   ============================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.modal {
  background: #fff;
  border-radius: 16px;
  width: 480px;
  max-width: 90vw;
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #f0f0f0;
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: #f5f5f5;
  color: #666;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
}

.modal-close:hover {
  background: #e5e7eb;
  color: #333;
}

.modal-body {
  padding: 24px;
}

/* 表单 */
.material-form .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.material-form .form-group {
  margin-bottom: 16px;
}

.material-form .form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #333;
  margin-bottom: 6px;
}

.material-form .form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  transition: border-color .2s;
  box-sizing: border-box;
}

.material-form .form-control:focus {
  outline: none;
  border-color: #e07b39;
  box-shadow: 0 0 0 3px rgba(224,123,57,.1);
}

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

/* =============================================
   按钮
   ============================================= */
.btn {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  border: none;
}

.btn-primary {
  background: #e07b39;
  color: #fff;
}

.btn-primary:hover {
  background: #c96a2d;
}

.btn-secondary {
  background: #f3f4f6;
  color: #333;
}

.btn-secondary:hover {
  background: #e5e7eb;
}

.btn-danger {
  background: #ef4444;
  color: #fff;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-sm {
  padding: 7px 14px;
  font-size: 13px;
}

/* =============================================
   响应式
   ============================================= */
@media (max-width: 1024px) {
  .budget-layout {
    grid-template-columns: 1fr;
  }
  
  .budget-sidebar {
    position: static;
  }
}

@media (max-width: 768px) {
  .project-selector {
    flex-direction: column;
    align-items: stretch;
  }
  
  .project-selector select {
    max-width: 100%;
  }
  
  .budget-stats-grid {
    grid-template-columns: 1fr 1fr;
  }
  
  .material-table-wrapper {
    overflow-x: auto;
  }
  
  .material-form .form-row {
    grid-template-columns: 1fr;
  }
}
