/* Layout Structure */
.strategy-layout {
  display: grid;
  grid-template-areas:
    'header header'
    'nav main';
  grid-template-columns: var(--nona-nav-width) 1fr;
  grid-template-rows: var(--nona-header-height) 1fr;
  min-height: 100vh;
  width: 100%;
}

/* Header Styles */
.strategy-header-container {
  grid-area: header;
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  height: var(--nona-header-height);
  padding: 10px 20px;
  z-index: 1000;
  background-color: #fff;
  display: flex;
  /* align-items: center; */
  gap: 8px;
  border-bottom: 3px solid var(--color-border);
  /* box-shadow: var(--shadow-sm); */
  transition: top 0.3s ease;
}

.strategy-header-container .card-title {
  margin: 0;
  color: var(--color-text);
  font-size: 1.5rem;
  line-height: 2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.strategy-header-container .card-title svg {
  width: 1.5rem;
  height: 1.5rem;
}

.strategy-header-container .additional-content {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Main Content Area */
.strategy-main-container {
  grid-area: main;
  /* margin-left: var(--nona-nav-width); */
  /* margin-top: var(--nona-header-height); */
  padding: 24px;
  min-height: calc(100vh - var(--nona-header-height));
  overflow-y: auto;
}

@media screen and (max-width: 782px) {
  .strategy-header-container {
    padding: 8px 16px;
  }

  .strategy-header-container .card-title {
    font-size: 1rem;
    line-height: 1.5rem;
  }
}

/* Print Styles */
@media print {
  .strategy-header-container {
    position: relative;
    /* box-shadow: none; */
    border-bottom: 1px solid #000;
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  .strategy-header-container {
    background-color: #1f2937;
    border-bottom-color: #374151;
  }

  .strategy-header-container .card-title {
    color: #f3f4f6;
  }
}

.page-console {
  position: absolute;
  left: var(--nav-width-expanded);
  top: var(--nona-header-height);
  width: calc(100vw - var(--nav-width-expanded));
  min-height: calc(100vh - var(--nona-header-height));
  margin: 0;
  padding: 0;
  background: #f8fafc;
  transition: left 0.3s ease, width 0.3s ease;
  overflow-x: hidden;
}

/* 当导航菜单收起时的样式 */
body.nav-collapsed .page-console {
  left: var(--nav-width-collapsed);
  width: calc(100vw - var(--nav-width-collapsed));
}

.page-console .nona-container {
  margin: 32px auto;
  padding: 0;
  width: 98%;
  max-width: 1600px;
}

@media (max-width: 1024px) {
  .page-console {
    left: var(--nav-width-collapsed) !important;
    width: calc(100vw - var(--nav-width-collapsed)) !important;
  }
  
  .page-console .nona-container {
    width: 95%;
    margin: 24px auto;
  }
}

@media (max-width: 768px) {
  .page-console {
    left: 0 !important;
    width: 100vw !important;
  }
  
  .page-console .nona-container {
    width: 95%;
    margin: 16px auto;
  }
}

.nona-header-strategy-name-input {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 12.5% !important;
  height: calc(100vh / 25);
  padding: 8px 12px;
  font-size: 16px;
  border: 1px solid var(--strategy-name-border-color, #e5e7eb);
  border-radius: 8px;
  background-color: var(--strategy-name-bg-color, transparent) !important;
  outline: none;
  transition: all 0.3s ease;
  color: var(--strategy-name-text-color, inherit);
}

/* Light theme variables for strategy name */
.light-theme .nona-header-strategy-name-input {
  --strategy-name-bg-color: #ffffff;
  --strategy-name-border-color: #e5e7eb;
  --strategy-name-text-color: #374151;
}

/* Dark theme variables for strategy name (default) */
body:not(.light-theme) .nona-header-strategy-name-input {
  --strategy-name-bg-color: #374151;
  --strategy-name-border-color: #6b7280;
  --strategy-name-text-color: #f9fafb;
}

.nona-header-strategy-name-input:hover,
.nona-header-strategy-name-input:focus {
  border-color: #3b82f6;
  /* box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1); */
}

.nona-header-strategy-name-input::placeholder {
  color: transparent;
}

@media screen and (max-height: 400px) {
  .nona-header-strategy-name-input {
    height: 32px;
  }
}

@media screen and (min-height: 1200px) {
  .nona-header-strategy-name-input {
    height: 64px;
  }
}

.nona-project-name-container,
.nona-project-name,
.project-name-input {
  box-sizing: border-box;
}

/* 现代卡片风格表格样式 */
.page-console .nona-container {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.08);
  padding: 32px 32px;
  margin: 32px auto;
  overflow: hidden;
  border: 1px solid #e2e8f0;
}

/* 表格容器 */
.page-console .table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -16px;
  padding: 0 16px;
}

.page-console table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: transparent;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  min-width: 600px;
}

/* 表头样式 */
.page-console thead {
  background: rgb(233, 247, 251);
  position: sticky;
  top: 0;
  z-index: 10;
}

.page-console thead tr {
  background: transparent;
}

.page-console th {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  padding: 20px 24px;
  text-align: left;
  letter-spacing: 0.025em;
  text-transform: uppercase;
  border: none;
  position: relative;
}

.page-console th:not(:last-child)::after {
  content: '';
  position: absolute;
  right: 0;
  top: 25%;
  height: 50%;
  width: 1px;
  background: rgba(30, 41, 59, 0.1);
}

/* 表格主体样式 */
.page-console tbody tr {
  background: #ffffff;
  transition: all 0.2s ease;
  border-bottom: 1px solid #f1f5f9;
}

.page-console tbody tr:hover {
  background: #f8fafc;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.page-console tbody tr:last-child {
  border-bottom: none;
}

.page-console td {
  font-size: 15px;
  padding: 20px 24px;
  color: #334155;
  border: none;
  vertical-align: middle;
  line-height: 1.5;
}

/* 第一列样式（策略名称） */
.page-console td:first-child {
  font-weight: 600;
  color: #1e293b;
}

/* 数值列样式 */
.page-console td:nth-child(4),
.page-console td:nth-child(5) {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  font-weight: 500;
}

/* 正负值颜色 */
.page-console .positive {
  color: #059669;
  background: #ecfdf5;
  padding: 4px 8px;
  border-radius: 6px;
  font-weight: 600;
}

.page-console .negative {
  color: #dc2626;
  background: #fef2f2;
  padding: 4px 8px;
  border-radius: 6px;
  font-weight: 600;
}

/* 响应式表格 */
@media (max-width: 1024px) {
  .page-console .nona-container {
    border-radius: 12px;
    margin: 24px auto;
    padding: 24px 24px;
  }
  
  .page-console th,
  .page-console td {
    padding: 16px 20px;
    font-size: 14px;
  }
}

@media (max-width: 768px) {
  .page-console .nona-container {
    border-radius: 8px;
    margin: 16px auto;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    padding: 16px 16px;
  }
  
  .page-console table {
    min-width: 500px;
  }
  
  .page-console th,
  .page-console td {
    padding: 12px 16px;
    font-size: 13px;
  }
  
  .page-console th {
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .page-console .table-wrapper {
    margin: 0 -8px;
  }
  
  .page-console .nona-container {
    border-radius: 0;
    margin: 16px 0;
    padding: 8px 8px;
  }
  
  .page-console th,
  .page-console td {
    padding: 10px 12px;
  }
}

/* 加载状态 */
.page-console .loading {
  opacity: 0.6;
  pointer-events: none;
}

/* 空状态 */
.page-console .empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #64748b;
}

.page-console .empty-state h3 {
  font-size: 18px;
  margin-bottom: 8px;
  color: #334155;
}

.page-console .empty-state p {
  font-size: 14px;
  margin: 0;
}

/* 聊天组件样式 */
.chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.chat-toggle {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.5);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
  transition: all 0.3s ease;
  color: white;
  font-size: 18px;
}

.chat-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.4);
  background: rgba(59, 130, 246, 0.7);
}

.chat-toggle.active {
  background: rgba(59, 130, 246, 0.8);
}

.chat-panel {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 380px;
  height: 500px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  transform: translateY(20px) scale(0.95);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  border: 1px solid #e2e8f0;
}

.chat-panel.active {
  transform: translateY(0) scale(1);
  opacity: 1;
  visibility: visible;
}

.chat-header {
  background: rgba(59, 130, 246, 0.5);
  color: white;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.chat-close {
  background: none;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.chat-close:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.chat-messages {
  height: 340px;
  overflow-y: auto;
  padding: 20px;
  background: #f8fafc;
}

.chat-message {
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.chat-message.user {
  flex-direction: row-reverse;
}

.chat-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
}

.chat-message.user .chat-avatar {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.chat-bubble {
  background: white;
  padding: 12px 16px;
  border-radius: 16px;
  max-width: 240px;
  font-size: 14px;
  line-height: 1.4;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.chat-message.user .chat-bubble {
  background: rgba(59, 130, 246, 0.5);
  color: white;
}

.chat-input-area {
  padding: 20px;
  border-top: 1px solid #e2e8f0;
  background: white;
}

.chat-input-container {
  display: flex;
  gap: 12px;
  align-items: center;
}

.chat-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #e2e8f0;
  border-radius: 24px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease;
}

.chat-input:focus {
  border-color: #667eea;
}

.chat-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgb(233, 247, 251);
  border: none;
  color: #667eea;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}

.chat-send:hover {
  transform: scale(1.05);
}

.chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* 响应式聊天组件 */
@media (max-width: 768px) {
  .chat-widget {
    bottom: 16px;
    right: 16px;
  }
  
  .chat-panel {
    width: calc(100vw - 32px);
    right: -8px;
    max-width: 360px;
  }
}

@media (max-width: 480px) {
  .chat-panel {
    width: calc(100vw - 16px);
    right: -16px;
    height: 450px;
  }
  
  .chat-messages {
    height: 290px;
  }
}
