/* css\navigation.css */

/* Badge Standardization Variables */
:root {
  --badge-size: 18px;
  --badge-font-size: 10px;
  --badge-margin-left: 8px;
  --badge-margin-left-compact: 4px;
  --badge-border-radius: 3px;
}

/* Base Badge Styles - Square Shape */
.badge-base {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--badge-size);
  height: var(--badge-size);
  padding: 0 4px;
  color: white;
  font-size: var(--badge-font-size);
  font-weight: bold;
  border-radius: var(--badge-border-radius);
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-sizing: border-box;
}

.strategy-nav {
  position: fixed;
  top: var(--nona-header-height);
  width: var(--nav-width-expanded);
  background: var(--nona-sidebar-bg, var(--color-bg-primary));
  backdrop-filter: var(--nona-sidebar-blur, none);
  border-right: 1px solid var(--nona-sidebar-border, var(--color-border-light));
  border-bottom: 1px solid var(--nona-sidebar-border, var(--color-border-light));
  height: calc(100vh - var(--nona-header-height) - var(--bottom-toolbar-height));
  z-index: var(--z-sticky);
  left: 0;
  margin-left: var(--spacing-0) !important;
  transition: width 0.3s ease, background-color 0.3s ease, border-color 0.3s ease, backdrop-filter 0.3s ease;
  overflow: hidden;
}

/* 🎨 PHASE 4: Unified Global Colors - Navigation */
/* Light and dark theme colors inherited from variables.css */

.strategy-nav__wrapper {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding-top: 36px;
  overflow-y: auto; /* Enable vertical scrolling */
  overflow-x: hidden; /* Prevent horizontal scrolling */
}

.strategy-nav--collapsed {
  width: var(--nav-width-collapsed);
}

.strategy-nav__toggle {
  display: none; /* 隐藏原始顶部折叠按钮 */
}

.strategy-nav__toggle--bottom {
  display: flex;
  align-items: center;
  width: 100%;
  padding: var(--padding-btn);
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--color-text-primary);
  transition: all 0.2s;
  margin-top: auto; /* 确保按钮在底部 */
}

.strategy-nav__toggle--bottom:hover {
  background-color: var(--color-bg-hover);
}

.strategy-nav__item--toggle {
  display: none !important; /* 完全隐藏折叠按钮 */
}

/* 同时隐藏折叠按钮前面的分隔符 */
.strategy-nav__divider--bottom {
  display: none !important;
}

/* 确保在折叠状态下图标旋转 */
.strategy-nav--collapsed .toggle-icon {
  transform: rotate(180deg);
}

/* 确保底部按钮在折叠状态下仍然可见 */
.strategy-nav--collapsed .strategy-nav__toggle--bottom {
  padding: 12px 0;
  justify-content: center;
}

.strategy-nav--collapsed .strategy-nav__toggle--bottom .strategy-nav__text {
  display: none;
}

/* 确保导航包装器使用flex布局，这样底部部分才能正确定位 */
.strategy-nav__wrapper {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
}

/* 确保列表占据可用空间，这样底部部分才能推到底部 */
.strategy-nav__list {
  list-style: none;
  padding: var(--spacing-0);
  margin: var(--spacing-0);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.strategy-nav__bottom-section {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--color-bg-primary);
  border-top: 1px solid var(--color-border);
  margin-top: auto;
  padding-bottom: 0;
  z-index: var(--z-base);
  width: 100%;
}

[data-user-color-scheme="dark"] .strategy-nav__bottom-section {
  background: var(--fusion-header-bg);
  backdrop-filter: var(--fusion-blur);
  border-top-color: rgba(255, 255, 255, 0.05);
}

.strategy-nav__bottom-list {
  list-style: none;
  padding: var(--spacing-0);
  margin: var(--spacing-0);
}

.strategy-nav__item {
  margin: var(--spacing-3) 0;
}

.strategy-nav__divider {
  height: 1px;
  background-color: var(--color-border);
  margin: var(--spacing-2) 16px;
  opacity: 0.6;
}

[data-user-color-scheme="dark"] .strategy-nav__divider {
  background-color: rgba(255, 255, 255, 0.15);
}

.strategy-nav__link {
  display: flex;
  align-items: center;
  padding: var(--spacing-2) var(--spacing-4);
  color: var(--color-text);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s;
}

.strategy-nav__link:hover {
  background-color: var(--color-bg-hover);
  color: var(--color-text-primary);
}

[data-user-color-scheme="dark"] .strategy-nav__link:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.strategy-nav__link-icon {
  margin-right: var(--spacing-4);
  color: var(--color-icon);
  transition: var(--fusion-transition, transform 0.2s ease, color 0.2s ease);
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 0 5px rgba(59, 130, 246, 0.2));
  flex-shrink: 0;
}

.strategy-nav__icon-wrapper {
  width: 20px;
  height: 20px;
  margin-right: var(--spacing-3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.strategy-nav__icon {
  width: 16px;
  height: 16px;
  color: var(--color-text);
}

.strategy-nav__text {
  flex-grow: 1;
  font-family: var(--font-system) !important;
  white-space: nowrap;
}

.strategy-nav__arrow {
  font-size: 10px;
  transition: transform 0.2s;
  color: var(--color-text);
  flex-shrink: 0;
}

.strategy-nav__item--bottom {
  margin: var(--spacing-0);
}

.strategy-nav__item--bottom .strategy-nav__link {
  padding: var(--padding-btn);
}

.strategy-nav__submenu {
  display: none;
  list-style: none;
  padding: var(--spacing-0);
  margin: 4px 0;
  background-color: transparent;
}

.strategy-nav__submenu--right {
  position: fixed; /* 改为fixed以确保正确定位 */
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-shadow: var(--shadow-modal);
  min-width: 200px;
  z-index: var(--z-dropdown);
  display: none;
  overflow: hidden;
}

[data-user-color-scheme="dark"] .strategy-nav__submenu--right {
  background: #111827;
  border-color: rgba(255, 255, 255, 0.15);
  backdrop-filter: var(--fusion-blur);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

.strategy-nav__item--active > .strategy-nav__submenu--right {
  display: block;
}

.strategy-nav__item--bottom .strategy-nav__submenu--right {
  top: auto;
  bottom: 0;
}

.strategy-nav__submenu-link {
  display: flex;
  align-items: center;
  padding: 10px var(--spacing-4) 10px 48px;
  color: var(--color-text-primary, rgba(255, 255, 255, 0.7));
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-system) !important;
  transition: var(--fusion-transition, all 0.2s ease);
  border-left: 2px solid transparent;
}

.strategy-nav__submenu-link:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
}

[data-user-color-scheme="dark"] .strategy-nav__submenu-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.strategy-nav__submenu-link.active {
  background: var(--color-bg-active, #e9ecef);
  color: var(--color-primary);
  border-left-color: var(--color-primary);
}

body:not(.light-theme) .strategy-nav__submenu-link.active {
  background: var(--nona-sidebar-active-glow);
  color: #ffffff;
  border-left-color: #60a5fa;
  box-shadow: inset 4px 0 10px rgba(59, 130, 246, 0.1);
}

.strategy-nav__item--active > .strategy-nav__link {
  background-color: var(--color-bg-active, #f0f7ff);
  color: var(--color-primary);
  box-shadow: inset 4px 0 0 var(--color-primary);
}

[data-user-color-scheme="dark"] .strategy-nav__item--active > .strategy-nav__link {
  background-color: var(--nona-sidebar-active-glow);
  color: #ffffff;
  box-shadow: inset 4px 0 0 #3b82f6;
}

body:not(.light-theme) .strategy-nav__item--active .strategy-nav__link-icon,
.strategy-nav__submenu-link.active .strategy-nav__link-icon {
  color: var(--color-primary);
  filter: none;
}

body:not(.light-theme) .strategy-nav__item--active .strategy-nav__link-icon,
body:not(.light-theme) .strategy-nav__submenu-link.active .strategy-nav__link-icon {
  color: #ffffff;
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.4));
}

.strategy-nav__item--active .strategy-nav__icon {
  color: var(--nona-nav-color-active);
}

.strategy-nav__item--active .strategy-nav__arrow {
  transform: rotate(180deg);
}

/* Use is-expanded class to control submenu visibility */
.strategy-nav__item.is-expanded .strategy-nav__submenu {
  display: block;
}

/* Rotate arrow when expanded */
.strategy-nav__item.is-expanded .strategy-nav__arrow {
  transform: rotate(180deg);
}

/* Keep backward compatibility - active also shows submenu */
.strategy-nav__item--active .strategy-nav__submenu {
  display: block;
}

/* Collapsed State Styles */
.strategy-nav--collapsed .strategy-nav__text,
.strategy-nav--collapsed .strategy-nav__arrow,
.strategy-nav--collapsed .strategy-nav__submenu {
  display: none;
}

.strategy-nav--collapsed .strategy-nav__link {
  position: relative;
}

.strategy-nav--collapsed .strategy-nav__link:hover::after {
  content: attr(data-title);
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: var(--spacing-1) var(--spacing-2);
  border-radius: 4px;
  font-size: 14px;
  white-space: nowrap;
  margin-left: var(--spacing-2);
  z-index: var(--z-dropdown);
}

.strategy-nav--collapsed .strategy-nav__bottom-section {
  width: var(--nav-width-collapsed);
}

@media screen and (max-width: 768px) {
  :root {
    --nav-width-expanded: 260px;
  }
}

/* Submenu Separator Styles - Cloudflare-inspired */
.strategy-nav__submenu-separator {
  pointer-events: none;
  padding: var(--spacing-2) 16px 6px 48px;
  margin-top: var(--spacing-4);
  margin-bottom: 2px;
}

.strategy-nav__submenu-separator:first-child {
  margin-top: 4px;
}

.strategy-nav__submenu-separator-text {
  font-size: 0.6875rem; /* 11px */
  font-weight: 500;
  color: #3b82f6; /* Blue color - unified */
  text-transform: none;
  letter-spacing: normal;
  display: inline-flex; /* Changed from block to inline-flex */
  align-items: center;
  gap: 6px; /* Space between icon and text */
  padding: 4px 10px; /* Inner padding */
  border: 1px solid #3b82f6; /* Blue border */
  border-radius: 6px; /* Rounded corners */
  background-color: rgba(59, 130, 246, 0.05); /* Light blue background */
  transition: all 0.2s ease;
}

/* Icon styling */
.strategy-nav__submenu-separator-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  stroke: currentColor;
}

/* Light theme separator */
.light-theme .strategy-nav__submenu-separator-text {
  color: #3b82f6;
  border-color: #3b82f6;
  background-color: rgba(59, 130, 246, 0.05);
}

/* Dark theme separator */
body:not(.light-theme) .strategy-nav__submenu-separator-text {
  color: #60a5fa;
  border-color: #60a5fa;
  background-color: rgba(96, 165, 250, 0.1);
}

/* Collapsed state - hide separators */
.strategy-nav--collapsed .strategy-nav__submenu-separator {
  display: none;
}

/* ISSUE_240 Backtest Results styling removed - migrated to ISSUE_241 floating widget */

/* ========================================
   Adaptive Signal - Special Styling
   Universal AI Tool - Highlighted Section
   Green Color Scheme
   ======================================== */

/* Special separator for Adaptive Signal - Star icon with gradient */
.strategy-nav__submenu-separator--special .strategy-nav__submenu-separator-text {
  color: #10b981;
  border-color: #10b981;
  background: linear-gradient(135deg, rgba(110, 231, 183, 0.1) 0%, rgba(16, 185, 129, 0.1) 100%);
  box-shadow: 0 2px 4px rgba(16, 185, 129, 0.15);
  font-weight: 600;
}

/* Star icon for Adaptive Signal */
.strategy-nav__submenu-separator--special .strategy-nav__submenu-separator-icon {
  stroke: #10b981;
  fill: rgba(16, 185, 129, 0.2);
  animation: pulse-star 2s ease-in-out infinite;
}

/* Star pulse animation */
@keyframes pulse-star {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.1);
  }
}

/* Special link styling for Adaptive Signal */
.strategy-nav__submenu-link--special {
  background: linear-gradient(135deg, rgba(110, 231, 183, 0.03) 0%, rgba(16, 185, 129, 0.03) 100%);
  border-left: 3px solid transparent;
  transition: all 0.3s ease;
}

.strategy-nav__submenu-link--special:hover {
  background: linear-gradient(135deg, rgba(110, 231, 183, 0.1) 0%, rgba(16, 185, 129, 0.1) 100%);
  border-left-color: #10b981;
  transform: translateX(2px);
}

/* AI Badge styling */
.badge-ai {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: var(--badge-margin-left);
  min-width: var(--badge-size);
  height: var(--badge-size);
  padding: 0 4px;
  background: linear-gradient(135deg, #6ee7b7 0%, #10b981 100%);
  color: white;
  font-size: var(--badge-font-size);
  border-radius: var(--badge-border-radius);
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1;
  box-sizing: border-box;
  box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
  animation: glow-ai 2s ease-in-out infinite;
}

/* AI badge glow animation */
@keyframes glow-ai {
  0%, 100% {
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
  }
  50% {
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.6);
  }
}

/* New Badge styling - Purple */
.badge-new {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: var(--badge-margin-left);
  min-width: var(--badge-size);
  height: var(--badge-size);
  padding: 0 4px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  font-size: var(--badge-font-size);
  border-radius: var(--badge-border-radius);
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1;
  box-sizing: border-box;
  box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

/* Red Badge - For Indicator badges */
.badge-red {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: var(--badge-margin-left);
  min-width: var(--badge-size);
  height: var(--badge-size);
  padding: 0 4px;
  background: linear-gradient(135deg, #fca5a5 0%, #ef4444 100%);
  color: white;
  font-size: var(--badge-font-size);
  border-radius: var(--badge-border-radius);
  font-weight: bold;
  text-transform: none;
  letter-spacing: 0.5px;
  line-height: 1;
  box-sizing: border-box;
}

/* Blue Badge */
.badge-blue {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: var(--badge-margin-left);
  min-width: var(--badge-size);
  height: var(--badge-size);
  padding: 0 4px;
  background: linear-gradient(135deg, #93c5fd 0%, #3b82f6 100%);
  color: white;
  font-size: var(--badge-font-size);
  border-radius: var(--badge-border-radius);
  font-weight: bold;
  text-transform: none;
  letter-spacing: 0.5px;
  line-height: 1;
  box-sizing: border-box;
}

/* Yellow Badge - For Sentinel badges */
.badge-yellow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: var(--badge-margin-left);
  min-width: var(--badge-size);
  height: var(--badge-size);
  padding: 0 4px;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: white;
  font-size: var(--badge-font-size);
  border-radius: var(--badge-border-radius);
  font-weight: bold;
  text-transform: none;
  letter-spacing: 0.5px;
  line-height: 1;
  box-sizing: border-box;
}

/* Compact margin for multiple badges */
.badge-compact {
  margin-left: var(--badge-margin-left-compact);
}

/* Outline style variants - Custom dashed border (3:1 ratio, 20 segments) */
/* Badge周长约72px, 20个虚线段, 每段3.6px (线段2.7px + 空缺0.9px) */
.badge-red.badge-outline {
  background:
    /* Top border */
    repeating-linear-gradient(90deg, #ef4444 0, #ef4444 2.7px, transparent 2.7px, transparent 3.6px) 0 0 / 100% 2px no-repeat,
    /* Bottom border */
    repeating-linear-gradient(90deg, #ef4444 0, #ef4444 2.7px, transparent 2.7px, transparent 3.6px) 0 100% / 100% 2px no-repeat,
    /* Left border */
    repeating-linear-gradient(0deg, #ef4444 0, #ef4444 2.7px, transparent 2.7px, transparent 3.6px) 0 0 / 2px 100% no-repeat,
    /* Right border */
    repeating-linear-gradient(0deg, #ef4444 0, #ef4444 2.7px, transparent 2.7px, transparent 3.6px) 100% 0 / 2px 100% no-repeat,
    /* Background */
    white;
  border: none;
  color: #ef4444;
  box-shadow: none;
}

.badge-blue.badge-outline {
  background:
    repeating-linear-gradient(90deg, #3b82f6 0, #3b82f6 2.7px, transparent 2.7px, transparent 3.6px) 0 0 / 100% 2px no-repeat,
    repeating-linear-gradient(90deg, #3b82f6 0, #3b82f6 2.7px, transparent 2.7px, transparent 3.6px) 0 100% / 100% 2px no-repeat,
    repeating-linear-gradient(0deg, #3b82f6 0, #3b82f6 2.7px, transparent 2.7px, transparent 3.6px) 0 0 / 2px 100% no-repeat,
    repeating-linear-gradient(0deg, #3b82f6 0, #3b82f6 2.7px, transparent 2.7px, transparent 3.6px) 100% 0 / 2px 100% no-repeat,
    white;
  border: none;
  color: #3b82f6;
  box-shadow: none;
}

.badge-yellow.badge-outline {
  background:
    repeating-linear-gradient(90deg, #f59e0b 0, #f59e0b 2.7px, transparent 2.7px, transparent 3.6px) 0 0 / 100% 2px no-repeat,
    repeating-linear-gradient(90deg, #f59e0b 0, #f59e0b 2.7px, transparent 2.7px, transparent 3.6px) 0 100% / 100% 2px no-repeat,
    repeating-linear-gradient(0deg, #f59e0b 0, #f59e0b 2.7px, transparent 2.7px, transparent 3.6px) 0 0 / 2px 100% no-repeat,
    repeating-linear-gradient(0deg, #f59e0b 0, #f59e0b 2.7px, transparent 2.7px, transparent 3.6px) 100% 0 / 2px 100% no-repeat,
    white;
  border: none;
  color: #f59e0b;
  box-shadow: none;
}

.badge-new.badge-outline {
  background:
    repeating-linear-gradient(90deg, #764ba2 0, #764ba2 2.7px, transparent 2.7px, transparent 3.6px) 0 0 / 100% 2px no-repeat,
    repeating-linear-gradient(90deg, #764ba2 0, #764ba2 2.7px, transparent 2.7px, transparent 3.6px) 0 100% / 100% 2px no-repeat,
    repeating-linear-gradient(0deg, #764ba2 0, #764ba2 2.7px, transparent 2.7px, transparent 3.6px) 0 0 / 2px 100% no-repeat,
    repeating-linear-gradient(0deg, #764ba2 0, #764ba2 2.7px, transparent 2.7px, transparent 3.6px) 100% 0 / 2px 100% no-repeat,
    white;
  border: none;
  color: #764ba2;
  box-shadow: none;
}

.badge-ai.badge-outline {
  background:
    repeating-linear-gradient(90deg, #10b981 0, #10b981 2.7px, transparent 2.7px, transparent 3.6px) 0 0 / 100% 2px no-repeat,
    repeating-linear-gradient(90deg, #10b981 0, #10b981 2.7px, transparent 2.7px, transparent 3.6px) 0 100% / 100% 2px no-repeat,
    repeating-linear-gradient(0deg, #10b981 0, #10b981 2.7px, transparent 2.7px, transparent 3.6px) 0 0 / 2px 100% no-repeat,
    repeating-linear-gradient(0deg, #10b981 0, #10b981 2.7px, transparent 2.7px, transparent 3.6px) 100% 0 / 2px 100% no-repeat,
    white;
  border: none;
  color: #10b981;
  box-shadow: none;
  animation: none;
}

/* Hide badge when filtered */
.badge-hidden {
  display: none !important;
}

/* Dark theme adjustments for Adaptive Signal */
body:not(.light-theme) .strategy-nav__submenu-separator--special .strategy-nav__submenu-separator-text {
  color: #34d399;
  border-color: #34d399;
  background: linear-gradient(135deg, rgba(110, 231, 183, 0.15) 0%, rgba(52, 211, 153, 0.15) 100%);
}

body:not(.light-theme) .strategy-nav__submenu-separator--special .strategy-nav__submenu-separator-icon {
  stroke: #34d399;
  fill: rgba(52, 211, 153, 0.3);
}

body:not(.light-theme) .strategy-nav__submenu-link--special {
  background: linear-gradient(135deg, rgba(110, 231, 183, 0.05) 0%, rgba(52, 211, 153, 0.05) 100%);
}

body:not(.light-theme) .strategy-nav__submenu-link--special:hover {
  background: linear-gradient(135deg, rgba(110, 231, 183, 0.15) 0%, rgba(52, 211, 153, 0.15) 100%);
  border-left-color: #34d399;
}

/* ========================================
   Navigation Scrollbar Hiding (Solution A)
   Complete scrollbar hiding while maintaining scroll functionality
   See: issues/ISSUE_BUILDER_90_PERCENT_CONTENT_WIDTH_LAYOUT.md
   ======================================== */

/* Hide scrollbar completely - Firefox */
.strategy-nav__wrapper {
  scrollbar-width: none; /* Firefox: completely hide scrollbar */
  -ms-overflow-style: none; /* IE/Edge: hide scrollbar */
  scroll-behavior: smooth; /* Maintain smooth scrolling */
}

/* Hide scrollbar completely - Webkit browsers (Chrome, Safari, Edge) */
.strategy-nav__wrapper::-webkit-scrollbar {
  display: none; /* Completely hide scrollbar */
  width: 0; /* Ensure no space reserved */
  height: 0;
}
