/* ============================================
   Layout - 左侧悬浮胶囊导航 + 主内容区
   ============================================ */

.app-container {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ===== 左侧悬浮胶囊导航 ===== */
.side-nav {
  position: fixed;
  inset-inline-start: 22px;
  top: 50%;
  transform: translateY(-50%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  overflow-x: hidden;
  width: var(--side-nav-width);
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  border-radius: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 0;
  gap: 4px;
  z-index: 1000;
  animation: slideInLeft 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
  transition: width 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.side-nav:hover { width: var(--side-nav-expanded); }

.side-nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0 10px;
  width: 100%;
  justify-content: center;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 2px;
  overflow: hidden;
  flex-shrink: 0;
}

.side-nav-brand .logo-dot {
  width: 30px; height: 30px;
  border-radius: 10px;
  background: var(--gradient-primary);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 14px;
  flex-shrink: 0;
  box-shadow: 0 6px 14px rgba(29, 78, 216, 0.35);
}

.side-nav-brand .brand-text {
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s 0.05s;
  letter-spacing: -0.01em;
}
.side-nav:hover .side-nav-brand .brand-text { opacity: 1; }

.side-nav-item {
  width: 60px;
  height: 50px;
  border-radius: 15px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.side-nav:hover .side-nav-item {
  width: 100%;
  flex-direction: row;
  justify-content: flex-start;
  padding: 0 18px;
  gap: 12px;
  height: 46px;
}

.side-nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }

.side-nav-item .nav-label {
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 1;
  transition: opacity 0.2s;
}
.side-nav:hover .side-nav-item .nav-label { font-size: 13px; }

.side-nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.side-nav-item.active {
  background: var(--gradient-primary);
  color: #fff;
  box-shadow: 0 8px 20px rgba(29, 78, 216, 0.32);
}

.side-nav-item.active:hover { background: var(--gradient-primary); color: #fff; }

/* 角标 */
.nav-badge {
  position: absolute;
  top: 6px; right: 8px;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  border-radius: var(--radius-full);
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.side-nav:hover .nav-badge { top: 4px; right: 12px; }

.side-nav-spacer { flex: 1; }

/* ===== 主内容区 ===== */
.main-content {
  flex: 1;
  margin-left: calc(var(--side-nav-width) + 56px);
  padding: 34px 48px 56px 8px;
  max-width: 1500px;
  overflow-y: auto;
  overflow-x: hidden;
  height: 100vh;
  scroll-behavior: smooth;
}

.page { animation: fadeUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) both; }
.page[hidden] { display: none; }

/* 页头 */
.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.page-heading h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.03em;
  position: relative;
  padding-bottom: 8px;
  display: inline-block;
}

.page-heading h1::after {
  content: '';
  position: absolute;
  left: 0; bottom: 0;
  width: 56px; height: 3px;
  border-radius: var(--radius-full);
  background: var(--gradient-primary);
}

.page-heading .subtitle {
  color: var(--text-secondary);
  font-size: 13px;
  margin-top: 4px;
}

.page-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* 胶囊 */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.pill-emphasis {
  background: linear-gradient(135deg, rgba(29, 78, 216, 0.15), rgba(14, 165, 165, 0.2));
  color: var(--text-primary);
  border-color: rgba(29, 78, 216, 0.25);
}

.pill-soft {
  background: linear-gradient(135deg, rgba(14, 165, 165, 0.18), rgba(56, 189, 248, 0.18));
  color: #0f766e;
  border-color: rgba(14, 165, 165, 0.3);
}

[data-theme="dark"] .pill-soft { color: #5eead4; }

.pill .led {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
}
.pill .led.off { background: var(--text-muted); box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.15); }
.pill .led.warn { background: var(--warning); box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18); }
.pill .led.bad { background: var(--danger); box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18); }

/* 响应式 */
@media (max-width: 1100px) {
  .main-content { padding: 24px 24px 40px 16px; }
  .side-nav { inset-inline-start: 12px; }
  :root { --side-nav-width: 72px; }
}

@media (max-width: 760px) {
  .app-container { flex-direction: column; }
  .side-nav {
    position: fixed;
    inset-inline-start: 0; left: 0; right: 0;
    top: auto; bottom: 0;
    transform: none;
    width: 100%;
    height: 68px;
    min-height: 0;
    border-radius: 20px 20px 0 0;
    flex-direction: row;
    justify-content: space-around;
    padding: 0 8px;
    gap: 0;
  }
  .side-nav:hover { width: 100%; }
  .side-nav-brand, .side-nav-spacer { display: none; }
  .side-nav-item, .side-nav:hover .side-nav-item {
    width: auto; flex: 1; height: 54px;
    flex-direction: column; gap: 2px;
    padding: 0;
  }
  .side-nav-item .nav-label, .side-nav:hover .side-nav-item .nav-label {
    font-size: 10px; opacity: 1;
  }
  .main-content {
    margin-left: 0;
    padding: 20px 16px 88px;
    height: 100vh;
  }
  .page-heading h1 { font-size: 21px; }
}

