/**
 * 天偌装修平台 - 我的装修 Dashboard 样式
 * 基于 design-system.css v3.0 + page-transitions.css
 */

/* =============================================
   Section 1: 页面基础
   ============================================= */
body {
  background: var(--bg-page);
}

/* =============================================
   Section 2: Profile Header (用户头部)
   ============================================= */
.profile-header {
  background: linear-gradient(135deg, var(--dark) 0%, #0d1b33 50%, #132744 100%);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  color: var(--white);
  position: relative;
  overflow: hidden;
  margin-bottom: var(--space-xl);
}

.profile-header::before {
  content: '';
  position: absolute;
  top: -30%;
  right: -10%;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(224, 123, 57, .2) 0%, transparent 70%);
  border-radius: 50%;
}

.profile-header .profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 3px solid rgba(255, 255, 255, .3);
  position: relative;
  z-index: 1;
  background: var(--primary-bg);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 700;
}

.profile-header .profile-info {
  position: relative;
  z-index: 1;
}

.profile-header .profile-name {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.profile-header .profile-phone {
  font-size: .85rem;
  opacity: .75;
}

.profile-header .profile-actions {
  margin-left: auto;
  position: relative;
  z-index: 1;
}

.profile-header .btn-outline {
  color: var(--white);
  border-color: rgba(255, 255, 255, .3);
}

.profile-header .btn-outline:hover {
  background: rgba(255, 255, 255, .1);
}

/* =============================================
   Section 3: Stats Grid (统计卡片)
   ============================================= */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  transition: all var(--transition);
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-bg);
}

.stat-card-icon {
  font-size: 1.5rem;
  color: var(--primary);
  margin-bottom: var(--space-xs);
  line-height: 1;
}

.stat-card-value {
  font-size: var(--text-2xl);
  font-weight: var(--font-extrabold);
  color: var(--text);
  line-height: 1.3;
}

.stat-card-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-2xs);
}

/* =============================================
   Section 4: Tab Panels (面板)
   ============================================= */
.tabs {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 6px;
  margin-bottom: var(--space-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  display: flex;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab {
  flex: 1;
  padding: 10px 14px;
  text-align: center;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-secondary);
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: var(--radius);
  transition: all .2s ease;
  white-space: nowrap;
  min-width: fit-content;
}

.tab:hover {
  background: var(--bg-page);
  color: var(--text);
}

.tab.active {
  background: var(--primary);
  color: var(--white);
  box-shadow: 0 2px 8px rgba(224, 123, 57, .3);
}

/* =============================================
   Section 4: Panel (面板内容)
   ============================================= */
.tab-panel {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-light);
}

.panel-title {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  color: var(--text);
  margin: 0;
}

/* =============================================
   Section 5: Diary Card (装修日记)
   ============================================= */
.diary-card {
  border-left: 4px solid var(--primary);
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  box-shadow: var(--shadow-xs);
  transition: transform .2s ease, box-shadow .2s ease;
  cursor: pointer;
}

.diary-card:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}

.diary-phase {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--primary-bg);
  color: var(--primary);
  font-weight: 500;
  display: inline-block;
}

/* =============================================
   Section 6: Budget Progress (预算进度)
   ============================================= */
.budget-progress {
  height: 8px;
  border-radius: 4px;
  background: var(--border);
  overflow: hidden;
}

.budget-progress-bar {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  transition: width .6s ease;
}

/* =============================================
   Section 7: Contract Card (合同卡片)
   ============================================= */
.contract-card {
  border-left: 4px solid var(--dark);
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  box-shadow: var(--shadow-xs);
  transition: transform .2s ease;
  cursor: pointer;
}

.contract-card:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}

/* =============================================
   Section 8: Checklist (验收清单)
   ============================================= */
.checklist-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-card);
  border-radius: var(--radius);
  margin-bottom: var(--space-sm);
  border: 1px solid var(--border-light);
  transition: all .2s ease;
}

.checklist-item.pass {
  border-color: var(--success);
  background: rgba(76, 175, 80, .05);
}

.checklist-item.fail {
  border-color: var(--danger);
  background: rgba(244, 67, 54, .05);
}

/* =============================================
   Section 9: Material Row (材料行)
   ============================================= */
.material-row {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  background: var(--bg-card);
  border-radius: var(--radius);
  margin-bottom: var(--space-sm);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease;
}

.material-row:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}

.material-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 8px;
  flex-shrink: 0;
}

.status-planning {
  background: #9e9e9e;
}

.status-shopping {
  background: #2196f3;
}

.status-ordered {
  background: #ff9800;
}

.status-delivered {
  background: var(--success);
}

.status-installed {
  background: #8bc34a;
}

.status-cancelled {
  background: var(--danger);
}

/* =============================================
   Section 10: Order Card (订单卡片)
   ============================================= */
.order-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-md);
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--border-light);
  transition: transform .2s ease, box-shadow .2s ease;
}

.order-card:hover {
  box-shadow: var(--shadow-sm);
}

.order-card-header {
  padding: var(--space-md) var(--space-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-light);
}

.order-card-body {
  padding: var(--space-md) var(--space-lg);
}

/* =============================================
   Section 11: Filter Buttons (筛选按钮)
   ============================================= */
.filter-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: var(--space-md);
}

.filter-btn {
  padding: 6px 14px;
  font-size: var(--text-xs);
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--white);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all .2s ease;
  white-space: nowrap;
}

.filter-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-bg);
}

.filter-btn.active {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
  box-shadow: 0 2px 6px rgba(224, 123, 57, .25);
}

/* =============================================
   Section 12: Empty State (空状态)
   ============================================= */
.empty-state {
  text-align: center;
  padding: var(--space-4xl) var(--space-lg);
  color: var(--text-muted);
}

.empty-state i,
.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: var(--space-md);
  color: var(--border);
  display: block;
}

.empty-state p {
  margin: 0;
  font-size: var(--text-sm);
}

.empty-state small {
  display: block;
  margin-top: var(--space-sm);
}

/* =============================================
   Section 13: Nav User Dropdown (导航用户菜单)
   ============================================= */
.nav-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.nav-user {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 4px 0;
}

.nav-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  font-weight: 600;
  flex-shrink: 0;
}

.nav-user-name {
  font-size: .85rem;
  color: var(--text);
  font-weight: 500;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-user-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 160px;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border-light);
  padding: 6px 0;
  z-index: 1000;
}

.nav-user-dropdown::after {
  content: '';
  position: absolute;
  top: -6px;
  left: 0;
  right: 0;
  height: 6px;
}

.nav-user-dropdown a {
  display: block;
  padding: 8px 16px;
  font-size: .85rem;
  color: var(--text);
  transition: background .15s ease;
  white-space: nowrap;
}

.nav-user-dropdown a:hover {
  background: var(--bg-page);
  color: var(--primary);
}

.nav-user-dropdown .divider {
  height: 1px;
  background: var(--border-light);
  margin: 4px 0;
}

/* =============================================
   Section 14: Modal Overlay (弹窗)
   ============================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: var(--space-xl) var(--space-md);
  overflow-y: auto;
}

.modal-overlay.active {
  display: flex;
}

.modal-container {
  background: var(--white);
  border-radius: var(--radius-xl);
  width: 100%;
  box-shadow: var(--shadow-xl);
  animation: modalSlideUp .3s var(--ease-spring);
  position: relative;
  margin-top: var(--space-2xl);
}

.modal-container.modal-lg {
  max-width: 700px;
}

.modal-container.modal-md {
  max-width: 520px;
}

.modal-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-lg) var(--space-xl);
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-page);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.modal-header-bar h5 {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  color: var(--dark);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  transition: all var(--transition-fast);
  line-height: 1;
}

.modal-close:hover {
  background: var(--bg-page);
  color: var(--text);
}

.modal-body {
  padding: var(--space-xl);
  max-height: 60vh;
  overflow-y: auto;
}

.modal-footer-bar {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
  padding: var(--space-lg) var(--space-xl);
  border-top: 1px solid var(--border-light);
  background: var(--bg-page);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

.modal-footer-bar .btn-danger {
  margin-right: auto;
}

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

/* =============================================
   Section 15: Form Controls (表单控件)
   ============================================= */
.form-group {
  margin-bottom: var(--space-md);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text);
  margin-bottom: var(--space-xs);
}

.form-control {
  display: block;
  width: 100%;
  padding: 10px 14px;
  font-size: .9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--text);
  transition: border-color .2s ease, box-shadow .2s ease;
  box-sizing: border-box;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(224, 123, 57, .15);
}

.form-control::placeholder {
  color: var(--text-muted);
}

.form-select {
  display: block;
  width: 100%;
  padding: 10px 14px;
  font-size: .9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--text);
  transition: border-color .2s ease, box-shadow .2s ease;
  box-sizing: border-box;
  cursor: pointer;
  appearance: auto;
}

.form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(224, 123, 57, .15);
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

.form-row {
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.form-col-8 {
  flex: 8;
}

.form-col-6 {
  flex: 6;
}

.form-col-5 {
  flex: 5;
}

.form-col-4 {
  flex: 4;
}

.form-col-3 {
  flex: 3;
}

.text-danger {
  color: var(--danger);
}

/* =============================================
   Section 16: Tags & Badges (标签和徽章)
   ============================================= */
.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
}

.tag-design {
  background: #e3f2fd;
  color: #1976d2;
}

.tag-demolition {
  background: #fbe9e7;
  color: #d84315;
}

.tag-electrical {
  background: #fff8e1;
  color: #f57f17;
}

.tag-masonry {
  background: #f3e5f5;
  color: #7b1fa2;
}

.tag-paint {
  background: #e8f5e9;
  color: #2e7d32;
}

.tag-install {
  background: #fce4ec;
  color: #c2185b;
}

.tag-inspect {
  background: #e0f7fa;
  color: #00838f;
}

.tag-other {
  background: #e0f2f1;
  color: #00695c;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-secondary {
  background: var(--bg-page);
  color: var(--text-secondary);
}

.badge-success {
  background: rgba(76, 175, 80, .12);
  color: var(--success);
}

.badge-warning {
  background: rgba(255, 152, 0, .12);
  color: #f57c00;
}

.badge-danger {
  background: rgba(244, 67, 54, .12);
  color: var(--danger);
}

.badge-info {
  background: rgba(33, 150, 243, .12);
  color: #1976d2;
}

.badge-primary {
  background: var(--primary-bg);
  color: var(--primary);
}

.badge-dark {
  background: rgba(26, 26, 46, .08);
  color: var(--dark);
}

.badge-orange {
  background: var(--primary-bg);
  color: var(--primary);
}

/* =============================================
   Section 17: Toast Notification (通知提示)
   ============================================= */
.toast {
  position: fixed;
  bottom: var(--space-xl);
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  display: flex;
  align-items: center;
  animation: modalSlideUp .3s ease;
}

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

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

.btn-xs {
  padding: 2px 8px;
  font-size: 11px;
  border-radius: var(--radius-sm);
}

/* =============================================
   Section 18: 布局辅助
   ============================================= */
.gap-2 {
  gap: var(--space-sm);
}

.gap-3 {
  gap: var(--space-md);
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* =============================================
   Section 19: Responsive (响应式)
   ============================================= */
@media (max-width: 900px) {
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-sm);
  }
  .stat-card {
    padding: var(--space-md);
  }
  .stat-card-value {
    font-size: var(--text-xl);
  }
  .profile-header {
    flex-wrap: wrap;
    justify-content: center;
    text-align: center;
    gap: var(--space-md);
  }
  .profile-header .profile-actions {
    margin-left: 0;
    width: 100%;
    text-align: center;
  }
  .tab {
    padding: 8px 12px;
    font-size: .8rem;
  }
  .panel-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-md);
  }
}

@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-sm);
  }
  .profile-header {
    flex-direction: column;
    text-align: center;
    padding: var(--space-lg);
    border-radius: var(--radius);
  }
  .profile-header .profile-avatar {
    margin: 0 auto;
  }
  .profile-header .profile-actions {
    margin: var(--space-md) auto 0;
  }
  .tab-panel {
    padding: var(--space-md);
  }
  .tab {
    font-size: .78rem;
    padding: 8px 10px;
  }
  .modal-container {
    margin: var(--space-md);
    max-width: none;
  }
  .modal-container.modal-lg,
  .modal-container.modal-md {
    max-width: none;
  }
  .modal-body {
    padding: var(--space-md);
  }
  .modal-header-bar,
  .modal-footer-bar {
    padding: var(--space-md);
  }
  .form-row {
    flex-direction: column;
    gap: var(--space-sm);
  }
  .empty-state {
    padding: var(--space-2xl) var(--space-md);
  }
  .empty-state i,
  .empty-state .empty-icon {
    font-size: 36px;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .stat-card {
    padding: var(--space-sm);
  }
  .stat-card-value {
    font-size: var(--text-lg);
  }
  .stat-card-label {
    font-size: 10px;
  }
  .tabs {
    padding: 4px;
    gap: 2px;
  }
  .tab {
    padding: 8px 6px;
    font-size: .72rem;
  }
  .profile-header {
    padding: var(--space-md);
  }
  .diary-card,
  .contract-card,
  .material-row {
    padding: var(--space-md);
  }
  .filter-btns {
    gap: 4px;
  }
  .filter-btn {
    padding: 4px 10px;
    font-size: 11px;
  }
  .modal-overlay {
    padding: var(--space-sm);
  }
  .modal-body {
    max-height: 55vh;
  }
}
