/* =========================================
   1. Font Definitions (修复版)
   ========================================= */

/* 1. 英文字体: Outfit (可变字体) */
@font-face {
  font-family: "Outfit";
  src: url("../fonts/Outfit-VariableFont_wght.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* 2. 中文字体: 阿里巴巴普惠体 (Alibaba PuHuiTi) */
@font-face {
  font-family: "Alibaba PuHuiTi";
  src: url("../fonts/Alibaba-PuHuiTi-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Alibaba PuHuiTi";
  src: url("../fonts/Alibaba-PuHuiTi-Bold.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Alibaba PuHuiTi";
  src: url("../fonts/Alibaba-PuHuiTi-Bold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Alibaba PuHuiTi";
  src: url("../fonts/Alibaba-PuHuiTi-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Alibaba PuHuiTi";
  src: url("../fonts/Alibaba-PuHuiTi-Heavy.woff2") format("woff2");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

/* =========================================
   2. Global Variables & Themes
   ========================================= */
:root {
  --sidebar-bg: #fff8f8;
  --bg-color: #fffafa;
  --theme-color: #f05756;
  --text-main: #2d2626;
  --text-secondary: #b09b9b;
  --card-border: rgba(0, 0, 0, 0.04);
  --btn-hover-bg: rgba(0, 0, 0, 0.05);
  --sidebar-width: 260px;
  --sidebar-width-collapsed: 88px;
  --header-height-mobile: 70px;
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

body.dark-mode {
  --sidebar-bg: #0e1116;
  --bg-color: #0e1014;
  --theme-color: #f05756;
  --text-main: #a89c9c;
  --text-secondary: #a89c9c;
  --card-border: #b09b9b;
  --btn-hover-bg: #b09b9b;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: "Outfit", "Alibaba PuHuiTi", -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
}

::selection {
  background-color: var(--theme-color);
  color: #ffffff;
}

/* 针对 Firefox 浏览器的兼容写法 */
::-moz-selection {
  background-color: var(--theme-color);
  color: #ffffff;
}

button,
input,
optgroup,
select,
textarea {
  font-family: inherit !important;
  font-size: 100%;
  line-height: 1.15;
  margin: 0;
}
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* =========================================
   3. Sidebar Structure
   ========================================= */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  background-color: var(--sidebar-bg);
  padding: 32px 16px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--card-border);
  z-index: 100;
  transition: width 0.4s var(--ease-smooth), padding 0.4s var(--ease-smooth),
    background-color 0.3s ease, border-color 0.3s ease;
  position: relative;
  flex-shrink: 0;
}

.sidebar-header {
  margin-bottom: 24px;
  padding: 0 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
  white-space: nowrap;
  transition: all 0.4s var(--ease-smooth);
}

.brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  position: relative;
  height: 100%;
  width: 160px;
}

.brand-logo {
  background-color: var(--text-main);
  transition: opacity 0.3s var(--ease-smooth), background-color 0.3s ease;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: left center;
  mask-position: left center;
  -webkit-mask-size: contain;
  mask-size: contain;
  position: relative;
  height: 48px;
  width: 100%;
}

.brand-logo.full {
  display: block;
}

.brand-logo.icon {
  position: absolute;
  left: 0;
  top: 0;
  width: 32px;
  height: 100%;
  -webkit-mask-position: center;
  mask-position: center;
  opacity: 0;
  pointer-events: none;
}

.toggle-btn {
  background: transparent;
  border: none;
  box-shadow: none;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: background-color 0.3s ease, color 0.3s ease, transform 0.1s ease;
}

.toggle-btn:hover {
  background-color: var(--btn-hover-bg);
  color: var(--text-main);
}

.sidebar-content-wrapper {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 4px;
  scrollbar-width: none;
}
.sidebar-content-wrapper::-webkit-scrollbar {
  display: none;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* =========================================
   4. Icon System
   ========================================= */
.ui-icon {
  width: 24px;
  height: 24px;
  background-color: currentColor;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  transition: background-color 0.3s ease;
}

.toggle-btn .ui-icon {
  width: 22px;
  height: 22px;
}

/* =========================================
   5. Navigation Items
   ========================================= */
.nav-icon {
  width: 24px;
  height: 24px;
  min-width: 24px;
  background-color: var(--text-secondary);
  -webkit-mask-size: cover;
  mask-size: cover;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  transition: background-color 0.3s var(--ease-smooth);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  color: var(--text-secondary);
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.3s var(--ease-smooth),
    color 0.3s var(--ease-smooth), box-shadow 0.3s var(--ease-smooth);
  position: relative;
  white-space: nowrap;
  width: 100%;
}

.nav-text,
.lang-text {
  opacity: 1;
  transition: opacity 0.2s var(--ease-smooth);
}

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

.nav-item.active {
  background-color: var(--theme-color);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(240, 87, 86, 0.3);
}
.nav-item.active .nav-icon {
  background-color: #ffffff;
}
.nav-item.active .nav-text {
  color: #ffffff;
}

body.dark-mode .nav-item.active {
  background-color: #f05756;
  color: #181b21;
  box-shadow: 0 4px 12px rgba(240, 87, 86, 0.4);
}
body.dark-mode .nav-item.active .nav-icon {
  background-color: #181b21;
}
body.dark-mode .nav-item.active .nav-text {
  color: #181b21;
}

/* =========================================
   6. Footer & Buttons
   ========================================= */
.sidebar-footer {
  margin-top: auto;
  padding-top: 24px;
  border-top: 1px solid var(--card-border);
  padding-left: 4px;
  padding-bottom: 16px;
  transition: border-color 0.3s ease;
  position: relative;
  z-index: 20;
}

.toggles {
  display: flex;
  gap: 12px;
  align-items: center;
}

.icon-btn,
.text-btn {
  background: transparent;
  border: 1px solid var(--card-border);
  color: var(--text-secondary);
  padding: 8px;
  border-radius: 999px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s ease, border-color 0.3s ease,
    color 0.3s ease, transform 0.1s ease;
  width: 40px;
  height: 40px;
}

.icon-btn:hover,
.text-btn:hover {
  background-color: var(--btn-hover-bg);
  color: var(--text-main);
}

/* =========================================
   7. Language Dropdown
   ========================================= */
.lang-dropdown-container {
  position: relative;
  display: flex;
  align-items: center;
}

.lang-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  width: auto;
  min-width: 120px;
  justify-content: space-between;
}

.lang-trigger .btn-icon {
  width: 22px;
  height: 22px;
  background-color: var(--text-secondary);
}
.lang-trigger:hover .btn-icon {
  background-color: var(--text-main);
}

.lang-trigger .arrow-icon {
  width: 14px;
  height: 14px;
  background-color: var(--text-secondary);
  transition: transform 0.3s ease, background-color 0.3s ease;
}
.lang-trigger:hover .arrow-icon {
  background-color: var(--text-main);
}
.lang-dropdown-container.open .arrow-icon {
  transform: rotate(180deg);
}

.lang-menu {
  position: absolute;
  bottom: calc(100% + 12px);
  left: -54px;
  width: 220px;
  background-color: #ffffff;
  border-radius: 16px;
  padding: 8px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05),
    0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 0 0 1px rgba(0, 0, 0, 0.05);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px) scale(0.98);
  transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
  z-index: 1000;
}
.lang-dropdown-container.open .lang-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  position: relative;
}
.lang-option:hover {
  background-color: var(--btn-hover-bg);
}

.option-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.option-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
}
.option-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 400;
}
.check-icon {
  margin-left: auto;
  width: 18px;
  height: 18px;
  background-color: var(--theme-color);
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.2s ease;
}
.lang-option.active .check-icon {
  opacity: 1;
  transform: scale(1);
}
.lang-option.active {
  background-color: rgba(240, 87, 86, 0.08);
}

body.dark-mode .lang-menu {
  background-color: #191616;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05);
}
body.dark-mode .lang-option.active {
  background-color: rgba(255, 255, 255, 0.05);
}

body.desktop-collapsed .lang-trigger {
  min-width: 0;
  width: 32px;
  height: 32px;
  padding: 0;
  justify-content: center;
}
body.desktop-collapsed .lang-text,
body.desktop-collapsed .arrow-icon {
  display: none;
}
body.desktop-collapsed .lang-menu {
  left: 60px;
  bottom: 0;
  width: 220px;
}

/* =========================================
   8. Main Content
   ========================================= */
.main-content {
  flex: 1;
  height: 100vh;
  background-color: var(--bg-color);
  overflow-y: auto;
  transition: background-color 0.3s ease;

  /* 新增：让内部元素纵向排列，保证 Footer 在底部 */
  display: flex;
  flex-direction: column;
}

/* 确保内容区域占满剩余空间，把 Footer 挤下去 */
.content-section {
  flex: 1;
  /* 原有的样式保持不变 */
  display: none;
  padding: 40px;
  max-width: 1200px; /* 注意：原代码有 max-width，如果要Footer全宽背景，这里不用动，Footer在Section外面 */
  margin: 0 auto; /* 这里会让内容居中 */
  width: 100%; /* 确保宽度 */
  animation: fadeIn 0.4s var(--ease-smooth) forwards;
}

.content-section.active {
  display: block;
}
/* =========================================
   9. Desktop Collapsed State
   ========================================= */
body.desktop-collapsed .sidebar {
  width: var(--sidebar-width-collapsed);
  padding: 32px 12px;
}
body.desktop-collapsed .nav-text,
body.desktop-collapsed .text-btn {
  opacity: 0;
  pointer-events: none;
  display: none;
}
body.desktop-collapsed .sidebar-header {
  flex-direction: column;
  justify-content: center;
  height: auto;
  gap: 20px;
  margin-bottom: 24px;
  padding: 0;
}
body.desktop-collapsed .toggle-btn {
  margin: 0 auto;
}
body.desktop-collapsed .brand {
  width: 100%;
  height: 42px;
  justify-content: center;
}
body.desktop-collapsed .brand-logo.full {
  display: none;
}
body.desktop-collapsed .brand-logo.icon {
  opacity: 1;
  pointer-events: auto;
  position: relative;
  left: auto;
  top: auto;
  transform: none;
  width: 32px;
  margin: 0 auto;
  display: block;
}
body.desktop-collapsed .nav-item {
  justify-content: center;
  padding: 12px 0;
  width: 100%;
}
body.desktop-collapsed .sidebar-footer .toggles {
  flex-direction: column;
}

/* =========================================
   10. Mobile Responsive
   ========================================= */
@media (max-width: 900px) {
  .app-container {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    height: auto;
    min-height: var(--header-height-mobile);
    padding: 0 24px;
    border-right: none;
    border-bottom: 1px solid var(--card-border);
    display: block;
  }
  .sidebar-header {
    height: var(--header-height-mobile);
    margin-bottom: 0;
    flex-direction: row;
    padding: 0;
  }
  .brand-logo {
    height: 42px;
  }
  .brand-logo.full {
    opacity: 1;
  }
  .brand-logo.icon {
    opacity: 0;
  }
  .sidebar-content-wrapper {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.4s var(--ease-smooth),
      opacity 0.3s var(--ease-smooth), margin 0.3s ease;
    margin-top: 0;
    padding: 0 4px;
    display: block;
  }
  .sidebar.mobile-open .sidebar-content-wrapper {
    max-height: 600px;
    opacity: 1;
    margin-bottom: 24px;
    overflow: visible;
    display: flex;
  }
  .sidebar-footer {
    margin-top: 24px;
    border-top: 1px solid var(--card-border);
  }
  .nav-item {
    padding: 16px;
  }
  .toggles {
    justify-content: flex-start;
  }
  .sidebar.mobile-open #sidebar-toggle .ui-icon {
    transform: rotate(180deg);
    transition: transform 0.3s;
  }
  .lang-menu {
    bottom: auto;
    top: 100%;
    margin-top: 12px;
    transform: translateY(-10px) scale(0.98);
    left: 0;
  }
  .lang-dropdown-container.open .lang-menu {
    transform: translateY(0) scale(1);
  }
}

/* =========================================
   11. Cookie Banner
   ========================================= */
.cookie-banner {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 400px;
  max-width: calc(100vw - 48px);
  background-color: #ffffff;
  padding: 24px;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1), 0 4px 10px rgba(0, 0, 0, 0.05),
    0 0 0 1px rgba(0, 0, 0, 0.05);
  z-index: 9999;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  animation: cookieSlideIn 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
  animation-delay: 0.5s;
}
@keyframes cookieSlideIn {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.cookie-banner.closing {
  animation: cookieSlideOut 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
@keyframes cookieSlideOut {
  to {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
  }
}
.cookie-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-main);
}
.cookie-text {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 24px;
}
.cookie-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.cookie-main-btns {
  display: flex;
  gap: 8px;
}
.cookie-btn {
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}
.cookie-btn.primary {
  background-color: var(--theme-color);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(240, 87, 86, 0.25);
}
.cookie-btn.primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}
.cookie-btn.secondary {
  background-color: transparent;
  border: 1px solid var(--card-border);
  color: var(--text-main);
}
.cookie-btn.secondary:hover {
  background-color: var(--btn-hover-bg);
}
.cookie-btn.text-only {
  background-color: transparent;
  color: var(--text-secondary);
  padding: 10px 8px;
}
.cookie-btn.text-only:hover {
  color: var(--text-main);
}
body.dark-mode .cookie-banner {
  background-color: #191c23;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.1);
}
body.dark-mode .cookie-btn.primary {
  background-color: var(--theme-color);
  color: #181b21;
}
@media (max-width: 500px) {
  .cookie-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }
  .cookie-main-btns {
    flex-direction: column;
  }
  .cookie-btn {
    width: 100%;
    text-align: center;
  }
}

/* =========================================
   12. Content Switching Logic
   ========================================= */
.content-section {
  display: none;
  padding: 40px;
  max-width: 1200px;
  margin: 0 auto;
  animation: fadeIn 0.4s var(--ease-smooth) forwards;
}
.content-section.active {
  display: block;
}
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@media (max-width: 900px) {
  .content-section {
    padding: 24px;
  }
}

/* =========================================
   13. Empty State (404) Styles - Updated Layout
   ========================================= */
.empty-state {
  display: flex; /* 开启 Flexbox */
  flex-direction: row; /* 横向排列 */
  align-items: center; /* 垂直居中 */
  justify-content: center; /* 水平居中 */
  gap: 96px; /* 图片和文字的间距 */
  margin-top: 60px;
  padding: 20px;
  max-width: 900px; /* 限制最大宽度，防止太宽 */
  margin-left: auto;
  margin-right: auto;
  font-family: inherit !important;
}

.empty-img-container {
  flex: 0 0 auto; /* 图片容器不伸缩 */
  width: 45%; /* 大概占据左半边 */
  max-width: 250px;
  display: flex;
  justify-content: flex-end; /* 图片靠右对齐中线 */
}

.empty-image {
  width: 100%;
  height: auto;
  opacity: 0.9;
}

.empty-text {
  flex: 1; /* 文字区域占据剩余空间 */
  text-align: left; /* 文字左对齐 */
  max-width: 600px;
}

.empty-title {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-secondary);
  line-height: 1.2;
}

.empty-desc {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* 响应式：在窄屏幕下变回上下布局 */
@media (max-width: 900px) {
  .empty-state {
    flex-direction: column; /* 变回垂直排列 */
    gap: 32px;
    margin-top: 32px;
    text-align: center;
  }

  .empty-img-container {
    width: 100%;
    max-width: 250px;
    justify-content: center;
  }

  .empty-text {
    text-align: center; /* 移动端文字居中 */
    max-width: 100%;
  }
}
/* =========================================
   14. Main Footer Styles (New)
   ========================================= */
.main-footer {
  background-color: var(--sidebar-bg);
  border-top: 1px solid var(--card-border);
  padding: 40px 48px;
  margin-top: auto; /* 关键：如果内容很少，Footer会自动沉底 */

  display: flex;
  justify-content: space-between;
  align-items: flex-end; /* 底部对齐 */
  gap: 24px;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* --- Left Side --- */
.footer-left {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Social Matrix */
.social-matrix {
  display: flex;
  gap: 16px;
  margin-bottom: 8px;
}

.social-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background-color: transparent;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.social-item:hover {
  background-color: var(--btn-hover-bg);
  transform: translateY(-2px);
}
.social-item .ui-icon {
  width: 22px;
  height: 22px;
}

/* Links */
.footer-links {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.footer-links a {
  text-decoration: none;
  color: inherit;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--text-main);
  text-decoration: underline;
}

.footer-links .divider {
  opacity: 0.5;
}

/* Copyright */
.footer-copyright {
  font-size: 0.85rem;
  color: var(--text-secondary);
  opacity: 0.8;
}

/* --- Right Side (Credits) --- */
.footer-right {
  /* 允许内部元素右对齐 */
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
}

.credits-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.credits-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.8;
}

.credits-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px; /* 名单之间的行距 */
}

.credits-list li {
  font-size: 0.9rem;
  color: var(--text-secondary);
  /* font-weight: 500; */
  transition: color 0.2s ease;
}

/* Mobile Responsive for Footer */
@media (max-width: 768px) {
  /* 保持原有的 footer 响应式代码，增加针对 right 的调整 */
  .main-footer {
    flex-direction: column;
    align-items: flex-start;
    padding: 32px 24px;
    gap: 32px;
  }

  /* 针对 right 的调整 */
  .footer-right {
    width: 100%;
    align-items: flex-start; /* 移动端改为左对齐 */
    text-align: left;
    padding-top: 24px;
    border-top: 1px solid var(--card-border);
  }
}
