/* ==========================================================================
 * peiste-cabinets.cn 驾驶舱 v3.0 CSS
 * - 通知抽屉
 * - 环图 tab + 中心数字
 * - Hero 天气组件
 * 加载: theme-cream → mobile → cockpit → cockpit-v2 → cockpit-v3
 * ========================================================================== */

/* ==========================================================================
 * 1. 通知抽屉 (右侧滑出)
 * ========================================================================== */
.notif-drawer-mask {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 2998;
  animation: fadeIn 0.2s;
}
.notif-drawer-mask.show { display: block; }

.notif-drawer {
  position: fixed;
  top: 0;
  right: -420px;
  width: 400px;
  max-width: 90vw;
  height: 100vh;
  background: var(--cream-bg);
  z-index: 2999;
  box-shadow: -8px 0 32px rgba(0,0,0,0.15);
  transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

.notif-drawer.open { right: 0; }

.notif-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.notif-drawer-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
}

.notif-drawer-close {
  background: transparent;
  border: none;
  font-size: 24px;
  color: var(--text-light);
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  transition: all 0.2s;
}
.notif-drawer-close:hover {
  background: var(--cream-bg-2);
  color: var(--text-main);
}

.notif-drawer-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.notif-drawer-item {
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-left: 3px solid var(--primary);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.2s;
}
.notif-drawer-item:hover {
  background: var(--primary-soft);
  transform: translateX(-2px);
  box-shadow: 0 4px 12px rgba(196,149,106,0.15);
}
.notif-drawer-item.type-urgent { border-left-color: var(--danger); }
.notif-drawer-item.type-info   { border-left-color: var(--success); }
.notif-drawer-item.type-normal { border-left-color: var(--primary); }

.notif-drawer-item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.notif-drawer-item-head .tag {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}
.notif-drawer-item-head .tag.urgent { background: rgba(196, 123, 107, 0.15); color: var(--danger); }
.notif-drawer-item-head .tag.normal { background: rgba(196, 149, 106, 0.15); color: var(--primary-dark); }
.notif-drawer-item-head .tag.info   { background: rgba(125, 155, 118, 0.15); color: var(--success); }
.notif-drawer-item-head .time {
  font-size: 11px;
  color: var(--text-light);
}

.notif-drawer-item-title {
  font-size: 14px;
  color: var(--text-main);
  font-weight: 500;
  line-height: 1.5;
}

.notif-drawer-item-desc {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
}

.notif-drawer-list .empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
  font-size: 14px;
}

/* 通知条内的"查看全部"链接 */
.notif-more {
  padding: 0 16px;
  font-size: 12px;
  color: var(--primary-dark);
  cursor: pointer;
  flex-shrink: 0;
  font-weight: 500;
  white-space: nowrap;
  border-left: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  transition: color 0.2s;
}
.notif-more:hover { color: var(--primary); }

/* 通知条内计数 */
.cockpit-notifications-label .count {
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 8px;
  margin-left: 4px;
  min-width: 18px;
  text-align: center;
}

/* ==========================================================================
 * 2. 环图 tab + 中心数字 + 重新布局
 * ========================================================================== */
.cockpit-donut {
  padding: 0 !important;
  display: block !important;
  gap: 0 !important;
  align-items: stretch !important;
}

.cockpit-donut-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: linear-gradient(180deg, #FAF6E9 0%, #FFFFFF 100%);
  border-bottom: 1px solid var(--border-light);
}

.cockpit-donut-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}
.cockpit-donut-title::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 14px;
  background: var(--cockpit-grad-2);
  border-radius: 2px;
}

.cockpit-donut-tabs {
  display: flex;
  background: var(--cream-bg-2);
  border-radius: 8px;
  padding: 2px;
  gap: 0;
}

.cockpit-donut-tabs button {
  background: transparent;
  border: none;
  padding: 5px 12px;
  font-size: 12px;
  color: var(--text-sub);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}

.cockpit-donut-tabs button:hover {
  color: var(--primary-dark);
}

.cockpit-donut-tabs button.active {
  background: var(--cockpit-grad-2);
  color: white;
  box-shadow: 0 2px 6px rgba(196, 149, 106, 0.3);
}

.cockpit-donut-body {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 24px;
}

.cockpit-donut-chart {
  position: relative;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex !important;
  align-items: center;
  justify-content: center;
  animation: donutSpin 0.6s ease-out;
}

.cockpit-donut-chart::before {
  content: '';
  position: absolute;
  inset: 18px;
  background: var(--card-bg);
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px var(--border-light);
}

.cockpit-donut-center {
  position: relative;
  z-index: 1;
  text-align: center;
}

.cockpit-donut-center .num {
  font-size: 30px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1;
  letter-spacing: -0.5px;
  font-family: -apple-system, 'SF Pro Display', sans-serif;
}

.cockpit-donut-center .lbl {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 4px;
  letter-spacing: 0.3px;
}

.cockpit-donut-center .amt {
  font-size: 12px;
  color: var(--primary-dark);
  font-weight: 600;
  margin-top: 4px;
}

.cockpit-donut-legend {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cockpit-donut-legend .item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-sub);
  padding: 4px 0;
}

.cockpit-donut-legend .dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.cockpit-donut-legend .name {
  flex: 1;
  color: var(--text-sub);
}

.cockpit-donut-legend .count {
  font-weight: 700;
  color: var(--text-main);
  font-size: 14px;
  min-width: 30px;
  text-align: right;
}

.cockpit-donut-legend .pct {
  font-size: 12px;
  color: var(--text-light);
  min-width: 36px;
  text-align: right;
}

/* ==========================================================================
 * 3. Hero 天气组件
 * ========================================================================== */
.cockpit-hero-clock .weather {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: rgba(250, 246, 233, 0.12);
  border: 1px solid rgba(250, 246, 233, 0.2);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 13px;
  color: #FAF6E9;
}

.cockpit-hero-clock .weather:hover {
  background: rgba(250, 246, 233, 0.2);
  border-color: rgba(250, 246, 233, 0.4);
}

.cockpit-hero-clock .weather .w-icon {
  font-size: 16px;
  line-height: 1;
}

.cockpit-hero-clock .weather .w-text {
  font-weight: 500;
  letter-spacing: 0.3px;
}

/* ==========================================================================
 * 4. 数字卡 SVG 折线容器修正 (用 !important 覆盖 cockpit.css)
 * ========================================================================== */
.stat-card .stat-info::after {
  content: '';
  display: block;
  margin-top: 10px;
  height: 32px !important;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  background-position: left center;
  opacity: 0.9;
}

/* ==========================================================================
 * 5. 移动端适配
 * ========================================================================== */
@media (max-width: 1024px) {
  .cockpit-donut-body {
    padding: 16px;
    gap: 16px;
  }
  .cockpit-donut-chart {
    width: 130px;
    height: 130px;
  }
  .cockpit-donut-center .num {
    font-size: 24px;
  }
}

@media (max-width: 768px) {
  .notif-drawer {
    width: 100% !important;
    max-width: 100vw;
    right: -100%;
  }
  .notif-drawer.open { right: 0; }

  .cockpit-donut-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
  }
  .cockpit-donut-tabs button {
    padding: 4px 10px;
    font-size: 11px;
  }
  .cockpit-donut-body {
    flex-direction: column;
    align-items: stretch;
    padding: 14px;
    gap: 14px;
  }
  .cockpit-donut-chart {
    margin: 0 auto;
    width: 140px;
    height: 140px;
  }
  .cockpit-donut-legend {
    gap: 4px;
  }

  .cockpit-hero-clock .weather {
    font-size: 11px;
    padding: 3px 8px;
  }
  .cockpit-hero-clock .weather .w-icon {
    font-size: 14px;
  }
}
