/* ============================================
   股市复盘系统 - 主样式文件
   Dark Financial Terminal Theme
   ============================================ */

:root {
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: #1a2235;
  --bg-hover: #1e2d42;
  --bg-input: #0f1829;
  --gold: #f0b429;
  --gold-light: #fcd34d;
  --gold-dark: #d97706;
  /* Chinese market: UP = RED, DOWN = GREEN */
  --up-color: #ff1744;
  --down-color: #00c853;
  --green: #00c853;
  --green-dark: #00a040;
  --red: #ff1744;
  --red-dark: #c62828;
  --blue: #3b82f6;
  --blue-dark: #2563eb;
  --purple: #8b5cf6;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #4b5563;
  --border: #2d3748;
  --border-light: #374151;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 48px rgba(0, 0, 0, 0.6);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============ Reset & Base ============ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 14px;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ============ Scrollbar ============ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}
::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ============ Typography ============ */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  font-weight: 600;
  line-height: 1.3;
}

a {
  color: var(--gold);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--gold-light);
}

/* ============ Layout ============ */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  margin-left: 240px;
  min-height: 100vh;
  background: var(--bg-primary);
  transition: margin-left 0.3s ease;
  /* Page entrance animation */
  animation: pageEnter 0.4s ease-out;
}

@keyframes pageEnter {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}


.page-content {
  padding: 24px;
  max-width: 1400px;
}

/* ============ Ticker Tape ============ */
.ticker-wrap {
  width: 100%;
  background: rgba(0, 0, 0, 0.55);
  border-bottom: 1px solid rgba(240, 180, 41, 0.25);
  overflow: hidden;
  height: 32px;
  line-height: 32px;
  position: relative;
  z-index: 10;
}

.ticker {
  display: inline-block;
  white-space: nowrap;
  animation: tickerMove 40s linear infinite;
  font-family: 'Roboto Mono', monospace;
  font-size: 12px;
  color: #e2e8f0;
  padding-left: 100%;
}

@keyframes tickerMove {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}

.ticker-up   { color: var(--up-color); font-weight: 700; }
.ticker-down { color: var(--down-color); font-weight: 700; }

/* ============ Sidebar ============ */
.sidebar {
  width: 240px;
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  background: var(--bg-secondary);
  border-right: 1px solid transparent;
  background-clip: padding-box;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.3s ease;
  position: fixed;
}

/* Animated gradient border on sidebar right edge */
.sidebar::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 1px; height: 100%;
  background: linear-gradient(to bottom, transparent, #f0b429, rgba(240, 180, 41, 0.3), transparent);
  animation: sidebarGlow 3s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes sidebarGlow {
  from { opacity: 0.3; }
  to   { opacity: 1; }
}

.sidebar-logo {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 0 20px rgba(240, 180, 41, 0.3);
}

.sidebar-logo-text {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.5px;
}

.sidebar-logo-sub {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 400;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.nav-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 8px 8px 4px;
  margin-top: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 2px;
  text-decoration: none;
}

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

.nav-item.active {
  background: rgba(240, 180, 41, 0.12);
  color: var(--gold);
  border-left: 3px solid var(--gold);
  padding-left: 9px;
}

.nav-item.active .nav-icon {
  color: var(--gold);
}

.nav-icon {
  width: 18px;
  text-align: center;
  font-size: 15px;
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.user-info:hover {
  background: var(--bg-hover);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  flex-shrink: 0;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.user-role {
  font-size: 11px;
  color: var(--text-secondary);
}

/* ============ Header ============ */
.page-header {
  padding: 20px 24px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

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

/* ============ Cards ============ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: var(--transition);
}

.card:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow);
}

.card-glass {
  background: rgba(26, 34, 53, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
  padding: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title-icon {
  color: var(--gold);
}

/* ============ Market Index Cards ============ */
.market-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
  box-shadow: 0 0 20px rgba(240, 180, 41, 0.08), 0 4px 24px rgba(0, 0, 0, 0.4);
}

.market-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
}

/* Chinese market: up = red top bar */
.market-card.up::before {
  background: linear-gradient(90deg, var(--up-color), #ff6090);
}

/* Chinese market: down = green top bar */
.market-card.down::before {
  background: linear-gradient(90deg, var(--down-color), #69f0ae);
}

.market-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 0 40px rgba(240, 180, 41, 0.2), 0 8px 32px rgba(0, 0, 0, 0.5);
  border-color: rgba(240, 180, 41, 0.35);
}

.market-card.up:hover {
  box-shadow: 0 0 40px rgba(255, 23, 68, 0.25), 0 8px 32px rgba(0, 0, 0, 0.5);
  border-color: rgba(255, 23, 68, 0.4);
}

.market-card.down:hover {
  box-shadow: 0 0 40px rgba(0, 200, 83, 0.25), 0 8px 32px rgba(0, 0, 0, 0.5);
  border-color: rgba(0, 200, 83, 0.4);
}

.market-card-name {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-weight: 500;
}

.market-card-value {
  font-size: 24px;
  font-weight: 700;
  font-family: 'Roboto Mono', 'Consolas', monospace;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.market-card-change {
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Chinese market colors: up=red, down=green */
.change-up {
  color: var(--up-color);
}

.change-down {
  color: var(--down-color);
}

.change-neutral {
  color: var(--text-secondary);
}

/* ============ Stats Cards ============ */
.stat-card {
  background: var(--bg-card);
  border: 1px solid rgba(240, 180, 41, 0.2);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 20px rgba(240, 180, 41, 0.1), 0 4px 24px rgba(0, 0, 0, 0.4);
}

.stat-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 40%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 0 40px rgba(240, 180, 41, 0.25), 0 8px 32px rgba(0, 0, 0, 0.5);
  border-color: rgba(240, 180, 41, 0.5);
}

/* Card variants for up/down */
.card-up {
  border-color: rgba(255, 23, 68, 0.3) !important;
  box-shadow: 0 0 20px rgba(255, 23, 68, 0.12), 0 4px 24px rgba(0, 0, 0, 0.4) !important;
}
.card-up:hover {
  box-shadow: 0 0 40px rgba(255, 23, 68, 0.3), 0 8px 32px rgba(0, 0, 0, 0.5) !important;
  border-color: rgba(255, 23, 68, 0.5) !important;
}
.card-down {
  border-color: rgba(0, 200, 83, 0.3) !important;
  box-shadow: 0 0 20px rgba(0, 200, 83, 0.12), 0 4px 24px rgba(0, 0, 0, 0.4) !important;
}
.card-down:hover {
  box-shadow: 0 0 40px rgba(0, 200, 83, 0.3), 0 8px 32px rgba(0, 0, 0, 0.5) !important;
  border-color: rgba(0, 200, 83, 0.5) !important;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--gold);
  font-family: 'Roboto Mono', monospace;
  line-height: 1;
  margin-bottom: 6px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ============ Diary Cards ============ */
.diary-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
}

.diary-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 4px;
  border-radius: 4px 0 0 4px;
}

/* Bull = red (up in Chinese market), Bear = green (down) */
.diary-card.sentiment-strong_bull::before { background: linear-gradient(180deg, #ff6090, var(--up-color)); }
.diary-card.sentiment-bull::before        { background: linear-gradient(180deg, var(--up-color), #c62828); }
.diary-card.sentiment-neutral::before     { background: linear-gradient(180deg, var(--gold), var(--gold-dark)); }
.diary-card.sentiment-bear::before        { background: linear-gradient(180deg, #69f0ae, var(--down-color)); }
.diary-card.sentiment-strong_bear::before { background: linear-gradient(180deg, var(--down-color), #00701a); }

.diary-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-light);
}

/* Bull diary cards glow red */
.diary-card.sentiment-strong_bull:hover,
.diary-card.sentiment-bull:hover {
  box-shadow: 0 8px 40px rgba(255, 23, 68, 0.2), 0 2px 8px rgba(0, 0, 0, 0.4);
  border-color: rgba(255, 23, 68, 0.3);
}

/* Bear diary cards glow green */
.diary-card.sentiment-strong_bear:hover,
.diary-card.sentiment-bear:hover {
  box-shadow: 0 8px 40px rgba(0, 200, 83, 0.2), 0 2px 8px rgba(0, 0, 0, 0.4);
  border-color: rgba(0, 200, 83, 0.3);
}

.diary-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-left: 12px;
}

.diary-card-date {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
  font-weight: 500;
}

.diary-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}

.diary-card-body {
  padding-left: 12px;
}

.diary-card-indices {
  display: flex;
  gap: 16px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.index-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.index-label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
}

.index-value {
  font-size: 13px;
  font-weight: 600;
  font-family: monospace;
}

.diary-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  padding-left: 12px;
}

/* ============ Sentiment Badge ============ */
.sentiment-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

/* Bull=red, Bear=green for Chinese market */
.sentiment-strong_bull { background: rgba(255, 23, 68, 0.15); color: #ff6090; border: 1px solid rgba(255, 23, 68, 0.3); }
.sentiment-bull        { background: rgba(255, 23, 68, 0.12); color: var(--up-color); border: 1px solid rgba(255, 23, 68, 0.25); }
.sentiment-neutral     { background: rgba(240, 180, 41, 0.15); color: var(--gold); border: 1px solid rgba(240, 180, 41, 0.3); }
.sentiment-bear        { background: rgba(0, 200, 83, 0.12); color: var(--down-color); border: 1px solid rgba(0, 200, 83, 0.25); }
.sentiment-strong_bear { background: rgba(0, 200, 83, 0.18); color: #69f0ae; border: 1px solid rgba(0, 200, 83, 0.35); }

/* ============ P&L Badge ============ */
.pl-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  font-family: monospace;
}

/* Profit = red (up), Loss = green (down) in Chinese market */
.pl-positive {
  background: rgba(255, 23, 68, 0.15);
  color: var(--up-color);
  border: 1px solid rgba(255, 23, 68, 0.3);
}

.pl-negative {
  background: rgba(0, 200, 83, 0.15);
  color: var(--down-color);
  border: 1px solid rgba(0, 200, 83, 0.3);
}

/* ============ Tags ============ */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  background: rgba(59, 130, 246, 0.15);
  color: var(--blue);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  cursor: default;
}

.tag-remove {
  cursor: pointer;
  margin-left: 4px;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.tag-remove:hover {
  opacity: 1;
  color: var(--up-color);
}

/* ============ Buttons ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  outline: none;
  white-space: nowrap;
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #000;
  box-shadow: 0 4px 15px rgba(240, 180, 41, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  box-shadow: 0 6px 20px rgba(240, 180, 41, 0.4);
  transform: translateY(-1px);
  color: #000;
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--text-muted);
  color: var(--text-primary);
}

.btn-danger {
  background: rgba(255, 23, 68, 0.15);
  color: var(--up-color);
  border: 1px solid rgba(255, 23, 68, 0.3);
}

.btn-danger:hover {
  background: rgba(255, 23, 68, 0.25);
  box-shadow: 0 4px 15px rgba(255, 23, 68, 0.2);
}

.btn-green {
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  color: #fff;
  box-shadow: 0 4px 15px rgba(0, 200, 83, 0.3);
}

.btn-green:hover {
  box-shadow: 0 6px 20px rgba(0, 200, 83, 0.4);
  transform: translateY(-1px);
  color: #fff;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 16px;
  border-radius: var(--radius);
}

.btn-icon {
  padding: 8px;
  width: 36px;
  height: 36px;
}

/* Floating Action Button */
.fab {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #000;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(240, 180, 41, 0.4);
  transition: var(--transition);
  border: none;
  z-index: 200;
  text-decoration: none;
}

.fab:hover {
  transform: scale(1.1) rotate(90deg);
  box-shadow: 0 12px 32px rgba(240, 180, 41, 0.5);
  color: #000;
}

/* ============ Form Inputs ============ */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.3px;
}

.form-label.required::after {
  content: ' *';
  color: var(--up-color);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  transition: var(--transition);
  outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(240, 180, 41, 0.1), 0 0 20px rgba(240, 180, 41, 0.05);
  background: #0d1525;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}

.form-textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.6;
}

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-group .form-input {
  padding-left: 40px;
}

.input-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  font-size: 15px;
  pointer-events: none;
}

.input-suffix {
  position: absolute;
  right: 12px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  pointer-events: none;
}

/* ============ Sentiment Selector ============ */
.sentiment-selector {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.sentiment-option {
  flex: 1;
  min-width: 80px;
  padding: 12px 8px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-input);
}

.sentiment-option:hover {
  border-color: var(--border-light);
  background: var(--bg-hover);
  transform: translateY(-2px);
}

.sentiment-option.selected {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

/* Bull=red, Bear=green */
.sentiment-option[data-value="strong_bull"].selected { border-color: #ff6090; background: rgba(255, 23, 68, 0.1); }
.sentiment-option[data-value="bull"].selected        { border-color: var(--up-color); background: rgba(255, 23, 68, 0.08); }
.sentiment-option[data-value="neutral"].selected     { border-color: var(--gold); background: rgba(240, 180, 41, 0.1); }
.sentiment-option[data-value="bear"].selected        { border-color: var(--down-color); background: rgba(0, 200, 83, 0.08); }
.sentiment-option[data-value="strong_bear"].selected { border-color: #00701a; background: rgba(0, 112, 26, 0.15); }

.sentiment-emoji {
  font-size: 24px;
  display: block;
  margin-bottom: 4px;
}

.sentiment-label {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 600;
}

/* ============ Index Input Grid ============ */
.index-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.index-input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.index-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.index-name::before {
  content: '';
  width: 3px;
  height: 12px;
  background: var(--gold);
  border-radius: 2px;
}

/* ============ Login Page ============ */
.login-page {
  min-height: 100vh;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.login-bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.login-bg-grid::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(240, 180, 41, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(240, 180, 41, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
}

.login-bg-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
}

.glow-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(240, 180, 41, 0.08) 0%, transparent 70%);
  top: -100px;
  right: -100px;
  animation: glow-float 8s ease-in-out infinite;
}

.glow-2 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(0, 200, 83, 0.06) 0%, transparent 70%);
  bottom: -100px;
  left: -100px;
  animation: glow-float 10s ease-in-out infinite reverse;
}

.glow-3 {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.05) 0%, transparent 70%);
  top: 40%;
  left: 40%;
  animation: glow-float 12s ease-in-out infinite;
}

@keyframes glow-float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(20px, -20px) scale(1.05); }
  66% { transform: translate(-10px, 15px) scale(0.95); }
}

.login-card {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 420px;
  margin: 20px;
  background: rgba(26, 34, 53, 0.9);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid rgba(240, 180, 41, 0.15);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.03);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo-icon {
  font-size: 48px;
  display: block;
  margin-bottom: 12px;
  filter: drop-shadow(0 0 20px rgba(240, 180, 41, 0.5));
}

.login-logo-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: 2px;
}

.login-logo-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
  letter-spacing: 1px;
}

.login-tabs {
  display: flex;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 28px;
}

.login-tab {
  flex: 1;
  padding: 8px;
  text-align: center;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: var(--transition);
}

.login-tab.active {
  background: var(--bg-card);
  color: var(--gold);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* ============ Charts Section ============ */
.chart-container {
  width: 100%;
  height: 300px;
}

.chart-container-sm {
  width: 100%;
  height: 200px;
}

/* ============ Table ============ */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
}

.data-table td {
  padding: 14px 16px;
  font-size: 13px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background: rgba(255,255,255,0.02);
}

/* ============ Search & Filter Bar ============ */
.filter-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search-input-wrap .form-input {
  padding-left: 40px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

/* ============ Pagination ============ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 24px;
}

.page-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
}

.page-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-light);
}

.page-btn.active {
  background: var(--gold);
  color: #000;
  border-color: var(--gold);
}

.page-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}

/* ============ Loading ============ */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 26, 0.8);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Cool loader variant */
.loader {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(240, 180, 41, 0.2);
  border-top-color: #f0b429;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============ Price flash animation ============ */
@keyframes priceFlashUp {
  0%   { background: rgba(255, 23, 68, 0.35); }
  100% { background: transparent; }
}

@keyframes priceFlashDown {
  0%   { background: rgba(0, 200, 83, 0.3); }
  100% { background: transparent; }
}

.price-flash-up   { animation: priceFlashUp   0.6s ease-out; }
.price-flash-down { animation: priceFlashDown 0.6s ease-out; }

/* ============ Toast ============ */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.3s ease;
  pointer-events: all;
  max-width: 400px;
  white-space: nowrap;
}

.toast-success {
  background: rgba(0, 200, 83, 0.15);
  border: 1px solid rgba(0, 200, 83, 0.4);
  color: var(--green);
}

.toast-error {
  background: rgba(255, 23, 68, 0.15);
  border: 1px solid rgba(255, 23, 68, 0.4);
  color: var(--up-color);
}

.toast-info {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: var(--blue);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ============ Divider ============ */
.divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

.divider-text {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 12px;
  margin: 16px 0;
}

.divider-text::before,
.divider-text::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ============ Grid Layouts ============ */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ============ Gauge / Sentiment Indicator ============ */
.sentiment-gauge {
  position: relative;
  text-align: center;
  padding: 16px;
}

.gauge-value {
  font-size: 36px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ============ Market Ticker ============ */
.ticker-bar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 8px 0;
  overflow: hidden;
  white-space: nowrap;
}

.ticker-content {
  display: inline-flex;
  gap: 32px;
  animation: ticker-scroll 30s linear infinite;
}

.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
}

.ticker-name  { color: var(--text-secondary); }
.ticker-price { color: var(--text-primary); font-family: monospace; }

@keyframes ticker-scroll {
  from { transform: translateX(100vw); }
  to   { transform: translateX(-100%); }
}

/* ============ Empty State ============ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.empty-state-icon {
  font-size: 48px;
  display: block;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.empty-state-desc {
  font-size: 14px;
  margin-bottom: 24px;
}

/* ============ Section Headers ============ */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title-bar {
  width: 4px;
  height: 18px;
  background: linear-gradient(180deg, var(--gold), var(--gold-dark));
  border-radius: 2px;
}

/* ============ Dragon Tiger Modal ============ */
.dt-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.dt-modal {
  background: rgba(17, 24, 39, 0.95);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid rgba(240, 180, 41, 0.25);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 720px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7), 0 0 40px rgba(240, 180, 41, 0.08);
  animation: modalSlideIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalSlideIn {
  from { opacity: 0; transform: scale(0.93) translateY(20px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}

.dt-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid rgba(240, 180, 41, 0.15);
  position: sticky;
  top: 0;
  background: rgba(17, 24, 39, 0.98);
  z-index: 1;
}

.dt-modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.dt-modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: var(--transition);
}

.dt-modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--up-color);
}

.dt-modal-body {
  padding: 20px 24px 24px;
}

.dt-modal-kv-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 16px;
}

.dt-modal-kv {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

.dt-modal-kv-label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.dt-modal-kv-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  font-family: 'Roboto Mono', monospace;
}

.dt-modal-section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin: 20px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.dt-amount-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 12px;
}

.dt-amount-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  text-align: center;
}

.dt-amount-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}

.dt-amount-value {
  font-size: 18px;
  font-weight: 700;
  font-family: 'Roboto Mono', monospace;
}

.dt-amount-value.positive { color: var(--up-color); }
.dt-amount-value.negative { color: var(--down-color); }
.dt-amount-value.neutral  { color: var(--text-secondary); }

.dt-perf-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.dt-perf-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  text-align: center;
}

.dt-perf-label {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.dt-perf-value {
  font-size: 14px;
  font-weight: 700;
  font-family: 'Roboto Mono', monospace;
}

/* ============ Responsive ============ */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .index-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .main-content::after {
    left: 0;
  }

  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }

  .index-grid {
    grid-template-columns: 1fr;
  }

  .page-content {
    padding: 16px;
  }

  .login-card {
    padding: 28px 24px;
  }

  .sentiment-selector {
    gap: 6px;
  }

  .sentiment-option {
    min-width: 60px;
    padding: 8px 4px;
  }

  .dt-modal-kv-grid { grid-template-columns: 1fr; }
  .dt-amount-row    { grid-template-columns: 1fr; }
  .dt-perf-grid     { grid-template-columns: repeat(2, 1fr); }
}

/* ============ Animations ============ */
.fade-in {
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.slide-in {
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ============ Misc Utility ============ */
.text-gold     { color: var(--gold); }
.text-green    { color: var(--down-color); }   /* green = down in CN market */
.text-red      { color: var(--up-color); }     /* red = up in CN market */
.text-up       { color: var(--up-color); }
.text-down     { color: var(--down-color); }
.text-secondary { color: var(--text-secondary); }
.text-muted    { color: var(--text-muted); }
.text-sm       { font-size: 12px; }
.text-xs       { font-size: 11px; }
.font-mono     { font-family: 'Roboto Mono', monospace; }
.font-bold     { font-weight: 700; }

/* Positive = profit = red in CN market */
.positive { color: var(--up-color); }
.negative { color: var(--down-color); }

.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }

.w-full { width: 100%; }
.hidden { display: none; }
.cursor-pointer { cursor: pointer; }

.overflow-hidden { overflow: hidden; }
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
