/*
 * 木易星球（muyischool.cn）V4.5 全宽流体外壳
 * 桌面端：固定 240px 左侧栏 + 右侧 100% 全宽流体工作区（完美适配 1440px / 1920px / 2560px 超宽屏，彻底消除右侧空洞）
 * 移动端：极简顶栏 + 底部 4 栏
 */

.app-shell {
  display: flex;
  min-height: 100dvh;
  width: 100%;
}

/* === Left Sidebar (Desktop >= 1024px) === */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px 14px 18px;
  z-index: 40;
}

.sidebar-top {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 6px 8px;
  border-radius: var(--r-mid);
  transition: background var(--dur-fast) var(--ease-ui);
}

@media (hover: hover) and (pointer: fine) {
  .brand-lockup:hover {
    background: var(--border-subtle);
  }
}

.brand-avatar-wrap {
  width: 36px;
  height: 36px;
  border-radius: var(--r-mid);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-darkroom);
  outline: 1px solid var(--img-outline);
  outline-offset: -1px;
}

.brand-avatar-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--ink-primary);
  line-height: 1.25;
}

.brand-domain {
  font-size: 11.5px;
  font-family: var(--font-mono);
  color: var(--ink-muted);
  letter-spacing: 0.01em;
}

/* Main 4-Pillar Navigation */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px 10px 10px;
  border-radius: var(--r-mid);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-secondary);
  transition: background var(--dur-fast) var(--ease-ui), color var(--dur-fast) var(--ease-ui), transform var(--dur-press) var(--ease-ui);
}

.nav-item svg {
  flex-shrink: 0;
  opacity: 0.72;
  transition: opacity var(--dur-fast) var(--ease-ui), color var(--dur-fast) var(--ease-ui);
}

@media (hover: hover) and (pointer: fine) {
  .nav-item:hover {
    background: var(--border-subtle);
    color: var(--ink-primary);
  }
  .nav-item:hover svg {
    opacity: 1;
  }
}

.nav-item:active {
  transform: scale(0.98);
}

.nav-item.active {
  background: var(--bg-surface);
  color: var(--ink-primary);
  font-weight: 600;
  box-shadow: var(--shadow-card);
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent-solid);
}

.nav-item.active svg {
  color: var(--accent-solid);
  opacity: 1;
}

/* Bottom Quiet Utilities */
.sidebar-bottom {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

.rail-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 10px 8px 8px;
  border-radius: var(--r-inner);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-secondary);
  transition: background var(--dur-fast) var(--ease-ui), color var(--dur-fast) var(--ease-ui), transform var(--dur-press) var(--ease-ui);
}

@media (hover: hover) and (pointer: fine) {
  .rail-btn:hover {
    background: var(--border-subtle);
    color: var(--ink-primary);
  }
}

.rail-btn:not(:disabled):active {
  transform: scale(0.97);
}

.rail-btn-left {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.rail-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.72;
}

.keycap {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-muted);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 2px 6px;
  border-radius: 5px;
  line-height: 1.2;
}

.rail-badge {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-solid);
  background: var(--accent-soft);
  padding: 1px 7px;
  border-radius: var(--r-pill);
}

.rail-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--status-success);
}

/* === Main Full-Bleed Right Workspace (Fluid Across 1440px -> 2560px+) === */
.workspace {
  margin-left: var(--sidebar-w);
  width: calc(100% - var(--sidebar-w));
  min-width: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.section-wrap {
  width: 100%;
  padding: 48px clamp(28px, 3.4vw, 60px);
}

.section-wrap.compact-top {
  padding-top: 32px;
}

.section-divider {
  border-top: 1px solid var(--border-subtle);
}

.site-footer {
  margin-top: auto;
  width: 100%;
  padding: 26px clamp(28px, 3.4vw, 60px) 34px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 13px;
  color: var(--ink-muted);
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 20px;
}

@media (hover: hover) and (pointer: fine) {
  .footer-links a:hover,
  .footer-links button:hover {
    color: var(--ink-primary);
  }
}

/* === Mobile Shell (< 1024px) === */
.mobile-topbar,
.mobile-tabbar {
  display: none;
}

@media (max-width: 1023px) {
  .sidebar {
    display: none;
  }

  .mobile-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--mobile-topbar-h);
    background: color-mix(in srgb, var(--bg-canvas) 88%, transparent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border-subtle);
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 45;
  }

  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .mobile-avatar-wrap {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-darkroom);
    outline: 1px solid var(--img-outline);
    outline-offset: -1px;
  }

  .mobile-avatar-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .mobile-brand-name {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.015em;
  }

  .mobile-actions {
    display: flex;
    align-items: center;
    gap: 4px;
  }

  .icon-only-btn {
    width: 38px;
    height: 38px;
    border-radius: var(--r-inner);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-secondary);
  }

  .icon-only-btn:active {
    transform: scale(0.94);
    background: var(--border-subtle);
  }

  .workspace {
    margin-left: 0;
    width: 100%;
    padding-top: var(--mobile-topbar-h);
    padding-bottom: calc(var(--mobile-tabbar-h) + env(safe-area-inset-bottom, 0px));
  }

  .section-wrap {
    padding: 28px 18px;
  }

  .site-footer {
    padding: 22px 18px 28px;
    flex-direction: column;
    align-items: flex-start;
  }

  .mobile-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(var(--mobile-tabbar-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: color-mix(in srgb, var(--bg-surface) 92%, transparent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--border-subtle);
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    z-index: 45;
  }

  .mobile-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    font-size: 11px;
    font-weight: 500;
    color: var(--ink-muted);
  }

  .mobile-tab.active {
    color: var(--accent-solid);
    font-weight: 600;
  }
}
