/* ========================================
   全局公共样式
   ======================================== */

/* ========================================
   导航栏专属样式 - 简洁现代化设计
   ======================================== */

/* ===== 导航栏基础 ===== */
.navbar {
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 1000;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.nav-container {
  /* max-width: 1400px; */
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between; /* 这个很重要 */
  height: 64px;
  position: relative;
}

/* ===== Logo 区域 ===== */
.nav-brand-container {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-shrink: 0;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-icon::before {
  content: '📊';
  font-size: 18px;
  line-height: 1;
}

.nav-brand {
  font-size: 20px;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
  letter-spacing: -0.3px;
  white-space: nowrap;
}

/* ===== 桌面端导航 ===== */
.nav-desktop {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-right: auto; /* 确保普通导航链接靠左 */
  margin-left: 24px;
}

.nav-link {
  color: #64748b;
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  white-space: nowrap;
  position: relative;
}

.nav-link:hover {
  color: #1e293b;
  background: #f1f5f9;
}

.nav-link.active {
  color: #1e293b;
  background: #f1f5f9;
  font-weight: 600;
}

/* ===== 登录按钮（右侧） ===== */
.nav-login {
  margin-left: auto; /* 推到右侧 */
  display: flex;
  align-items: center;
}

.nav-login .nav-link {
  background-color: #007bff;
  color: white;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.nav-login .nav-link:hover {
  background-color: #0056b3;
  color: white;
}

.nav-login .nav-link.active {
  background-color: #0056b3;
  color: white;
}

/* 移动端菜单中的登录链接保持原有样式 */
.nav-mobile .nav-login {
  margin-left: 0;
  width: 100%;
}

.nav-mobile .nav-login .nav-link {
  background-color: transparent;
  color: #64748b;
  padding: 12px 16px;
  text-align: center;
  border-radius: 8px;
}

.nav-mobile .nav-login .nav-link:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.nav-mobile .nav-login .nav-link.active {
  background: #f1f5f9;
  color: #1e293b;
  font-weight: 600;
}

/* ===== 汉堡按钮（移动端） ===== */
.hamburger-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 40px;
  height: 40px;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 0;
  gap: 5px;
}

.hamburger-btn:hover {
  background: #f1f5f9;
}

.hamburger-line {
  display: block;
  width: 20px;
  height: 2px;
  background: #1e293b;
  transition: all 0.3s ease;
  position: relative;
}

.hamburger-line::before,
.hamburger-line::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 2px;
  background: #1e293b;
  transition: all 0.3s ease;
  left: 0;
}

.hamburger-line::before {
  top: -6px;
}

.hamburger-line::after {
  top: 6px;
}

/* 汉堡按钮激活状态（X形） */
.hamburger-btn.active .hamburger-line {
  background: transparent;
}

.hamburger-btn.active .hamburger-line::before {
  top: 0;
  transform: rotate(45deg);
}

.hamburger-btn.active .hamburger-line::after {
  top: 0;
  transform: rotate(-45deg);
}

/* ===== 移动端菜单 ===== */
.nav-mobile {
  display: none;
  position: absolute;
  top: 64px;
  left: 0;
  right: 0;
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  padding: 16px;
  flex-direction: column;
  gap: 4px;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  pointer-events: none;
  border-top: 1px solid #e2e8f0;
}

.nav-mobile.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

.nav-mobile .nav-link {
  padding: 12px 16px;
  text-align: center;
  background: transparent;
  border-radius: 8px;
  color: #64748b;
}

.nav-mobile .nav-link:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.nav-mobile .nav-link.active {
  background: #f1f5f9;
  color: #1e293b;
  font-weight: 600;
}

/* ===== 响应式适配 ===== */

/* 平板 (≤1024px) */
@media (max-width: 1024px) {
  .nav-brand {
    font-size: 18px;
  }
  
  .nav-link {
    padding: 8px 12px;
    font-size: 13px;
  }
}

/* 手机 (≤768px) */
@media (max-width: 768px) {
  .nav-container {
    height: 56px;
    padding: 0 16px;
  }
  
  .nav-brand {
    font-size: 16px;
  }
  
  .logo-icon {
    width: 28px;
    height: 28px;
  }
  
  .logo-icon::before {
    font-size: 16px;
  }
  
  /* 隐藏桌面导航 */
  .nav-desktop,
  .nav-login {
    display: none;
  }
  
  /* 显示汉堡按钮 */
  .hamburger-btn {
    display: flex;
  }
  
  /* 显示移动端菜单 */
  .nav-mobile {
    display: flex;
  }
}

/* 小手机 (≤480px) */
@media (max-width: 480px) {
  .nav-container {
    height: 52px;
  }
  
  .nav-brand {
    font-size: 15px;
  }
  
  .nav-mobile .nav-link {
    padding: 10px 12px;
    font-size: 14px;
  }
}


/* ===== 字体导入 ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ===== 全局重置 ===== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ===== 基础 body 样式 ===== */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    color: #2d3748;
    line-height: 1.5;
}

/* ===== 通用工具类 ===== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

/* ===== 响应式框架（基础） ===== */
@media screen and (max-width: 768px) {
    .hide-mobile { display: none !important; }
    .show-mobile { display: block !important; }
}

@media screen and (max-width: 480px) {
    .hide-small { display: none !important; }
    .show-small { display: block !important; }
}

/* ===== 滚动条美化 ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ===== Dash 组件样式覆盖（全局）===== */

/* Dropdown 通用样式 */
.Select-control {
    border-radius: 6px !important;
    border-color: #d9d9d9 !important;
    box-shadow: none !important;
    font-family: 'Inter', sans-serif !important;
}

.Select-control:hover {
    border-color: #40a9ff !important;
}

.Select-menu-outer {
    border-radius: 6px !important;
    border-color: #d9d9d9 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    font-family: 'Inter', sans-serif !important;
}

/* DatePickerRange 通用样式 */
.DateRangePickerInput {
    border-radius: 6px !important;
    border-color: #d9d9d9 !important;
    background: white !important;
}

.DateInput_input {
    border-radius: 4px !important;
    border-color: #d9d9d9 !important;
    font-size: 14px !important;
    padding: 8px 12px !important;
    font-family: 'Inter', sans-serif !important;
}

.DateInput_input::placeholder {
    color: #bfbfbf !important;
}

.DateInput_input:focus {
    border-color: #40a9ff !important;
}

/* DataTable 通用样式 */
.dash-table-container {
    border-radius: 8px !important;
    overflow: hidden !important;
    font-family: 'Inter', sans-serif !important;
}

.dash-table-container .dash-spreadsheet {
    font-family: 'Inter', sans-serif !important;
}

/* Loading 动画通用样式 */
._dash-loading {
    margin: 40px auto !important;
}

._dash-loading::after {
    border-color: #1890ff !important;
    border-width: 3px !important;
}

/* ===== 通用输入框样式 ===== */
.input-base {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: all 0.3s ease;
}

.input-base:focus {
    border-color: #40a9ff;
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
}

.input-base::placeholder {
    color: #bfbfbf;
}

/* ===== 通用按钮样式 ===== */
.btn-base {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
}

.btn-base:active {
    transform: translateY(1px);
}

/* ===== 通用卡片样式 ===== */
.card-base {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 24px;
}

/* ===== 通用标题样式 ===== */
.title-base {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    color: #2d3748;
}

/* ===== 动画效果（通用）===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.4s ease-out;
}

/* ===== 响应式工具类 ===== */
@media screen and (max-width: 768px) {
    .card-base {
        padding: 16px;
    }
    
    .title-base {
        font-size: 18px;
    }
}

@media screen and (max-width: 480px) {
    .card-base {
        padding: 12px;
    }
    
    .title-base {
        font-size: 16px;
    }
}


/* ========================================
   导航下拉菜单（桌面端 hover 展开）
   ======================================== */
.nav-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.nav-dropdown-trigger {
  color: #64748b;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  white-space: nowrap;
  user-select: none;
}

.nav-dropdown-trigger:hover,
.nav-dropdown-trigger.active {
  color: #1e293b;
  background: #f1f5f9;
}

.nav-dropdown-trigger.active {
  font-weight: 600;
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 140px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  padding: 6px;
  z-index: 1000;
  margin-top: 0;                /* 去掉间隙 */
}

.nav-dropdown-menu::before {
  content: '';
  position: absolute;
  top: -12px;                   /* 向上延伸到触发词区域 */
  left: 0;
  right: 0;
  height: 12px;                 /* 桥接高度 */
  background: transparent;
}

.nav-dropdown:hover .nav-dropdown-menu {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-dropdown-item {
  color: #64748b;
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.nav-dropdown-item:hover {
  color: #1e293b;
  background: #f1f5f9;
}

.nav-dropdown-item.active {
  color: #1e293b;
  background: #f1f5f9;
  font-weight: 600;
}


.mt-xs {
  margin-top: 4px !important;
}
.mt-sm {
  margin-top: 8px !important;
}
.mt-md {
  margin-top: 16px !important;
}
.mt-lg {
  margin-top: 32px !important;
}
.mt-xl {
  margin-top: 64px !important;
}
.mt-2xl {
  margin-top: 128px !important;
}
.mt-3xl {
  margin-top: 256px !important;
}


/* ===== 图表说明文字 ===== */
.chart-description {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin: -4px 0 var(--space-md) 0;
  line-height: 1.6;
}

.chart-note {
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
  margin: var(--space-sm) 0 0 0;
  line-height: 1.5;
  padding: var(--space-sm) var(--space-md);
  background: var(--color-bg-page);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--color-primary);
}

/* 深色/强调型注释（用于图表下方更重要的结论提示） */
.chart-note strong {
  color: var(--color-text-primary);
  font-weight: var(--font-weight-medium);
}


/* ========================================
   ABC 分析 — 左 bar(1/4) + 右 table(3/4)
   ======================================== */
.abc-row {
  display: flex;
  flex-direction: row;
  gap: 16px;
  align-items: stretch;
}

.abc-bar-col {
  flex: 1;                     /* 1/4 */
  min-width: 0;                /* 防止 flex 溢出 */
  max-width: 25%;
}

.abc-table-col {
  flex: 3;                     /* 3/4 */
  min-width: 0;
}

/* 小屏时自动堆叠回上下布局 */
@media (max-width: 768px) {
  .abc-row {
    flex-direction: column;
  }
  .abc-bar-col,
  .abc-table-col {
    max-width: 100%;
    flex: none;
    width: 100%;
  }
}


/* ===== ★★★ 退出按钮（右侧，红色） ★★★ ===== */
.nav-logout {
  background-color: #ff4d4f !important;
  color: white !important;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 500;
  transition: all 0.2s ease;
  text-decoration: none;
  cursor: pointer;
}

.nav-logout:hover {
  background-color: #ff7875 !important;
  color: white !important;
}

/* 移动端菜单中的退出按钮 */
.nav-mobile .nav-logout {
  background-color: transparent !important;
  color: #ff4d4f !important;
  border-top: 1px solid #f0f0f0;
  margin-top: 8px;
  padding-top: 12px;
  font-weight: 600;
}

.nav-mobile .nav-logout:hover {
  background: #fff1f0 !important;
  color: #ff4d4f !important;
}