/**
 * 더모음 대시보드 — 듀얼 테마 (AI 모드 + 전문가 모드)
 */

/* ============================================================
   Mode Transition
   ============================================================ */
body {
  transition: background-color 0.4s ease, color 0.4s ease;
}

.mode-container,
#main-layout,
#sidebar,
#search-section,
#bb-ticker-bar,
#bb-market-panels {
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================
   Mode Toggle Switch
   ============================================================ */
.mode-toggle-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 0;
  background: var(--toggle-bg, transparent);
  border-bottom: 1px solid var(--toggle-border, #334155);
  transition: background 0.4s ease, border-color 0.4s ease;
}

.mode-toggle-pill {
  display: inline-flex;
  background: var(--pill-bg, #1e293b);
  border-radius: 9999px;
  padding: 3px;
  border: 1px solid var(--pill-border, #334155);
  transition: all 0.4s ease;
}

.mode-toggle-btn {
  padding: 8px 20px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--pill-text, #94a3b8);
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.mode-toggle-btn.active {
  background: var(--pill-active-bg, #3b82f6);
  color: #fff;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.35);
}

.mode-toggle-btn:hover:not(.active) {
  color: var(--pill-hover-text, #e2e8f0);
}

/* ============================================================
   AI MODE (ChatGPT Style)
   ============================================================ */
body.mode-ai {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #0f172a;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-glow: rgba(59, 130, 246, 0.15);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;
  --border: #334155;
  --border-hover: #475569;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --card-radius: 16px;
  --toggle-bg: transparent;
  --toggle-border: #334155;
  --pill-bg: #1e293b;
  --pill-border: #334155;
  --pill-text: #94a3b8;
  --pill-active-bg: #3b82f6;
  --pill-hover-text: #e2e8f0;
}

/* AI mode search — large, centered */
body.mode-ai #search-section {
  max-width: 720px;
  margin: 0 auto 24px;
}

body.mode-ai #search-section .search-inner {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px 24px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

body.mode-ai #search-section input {
  font-size: 18px;
  padding: 14px 18px;
  border-radius: 14px;
}

body.mode-ai #search-section .search-hint {
  display: block;
  text-align: center;
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-secondary);
}

body.mode-ai #sidebar {
  display: block;
  opacity: 1;
  transform: translateX(0);
}

body.mode-ai #data-panels {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

body.mode-ai .expert-only {
  display: none !important;
}

/* ============================================================
   EXPERT MODE (Data Terminal Style — high density, high contrast)
   ============================================================ */
body.mode-expert {
  --bg-primary: #08080c;
  --bg-secondary: #0e0e14;
  --bg-tertiary: #0a0a10;
  --accent: #00ff88;
  --accent-hover: #00cc6a;
  --accent-glow: rgba(0, 255, 136, 0.06);
  --text-primary: #e8e8e8;
  --text-secondary: #999999;
  --text-tertiary: #555555;
  --border: #1a1a24;
  --border-hover: #2a2a38;
  --border-active: #333;
  --success: #00ff88;
  --warning: #ff9500;
  --danger: #ff3b30;
  --card-radius: 3px;
  --toggle-bg: #08080c;
  --toggle-border: #1a1a24;
  --pill-bg: #0e0e14;
  --pill-border: #1a1a24;
  --pill-text: #666;
  --pill-active-bg: #00ff88;
  --pill-hover-text: #aaa;
  font-family: 'SF Mono', 'Consolas', 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

/* Expert mode scrollbar */
body.mode-expert ::-webkit-scrollbar { width: 4px; height: 4px; }
body.mode-expert ::-webkit-scrollbar-track { background: var(--bg-primary); }
body.mode-expert ::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 2px; }
body.mode-expert ::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

body.mode-expert #search-section {
  max-width: 100%;
  margin: 0 0 10px;
}

body.mode-expert #search-section .search-inner {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 10px 14px;
  box-shadow: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

body.mode-expert #search-section .search-inner label {
  font-size: 11px;
  color: var(--accent);
  white-space: nowrap;
  font-weight: 600;
}

body.mode-expert #search-section input {
  font-size: 13px;
  padding: 7px 10px;
  border-radius: 2px;
  background: #06060a;
  border-color: var(--border);
  color: var(--text-primary);
}
body.mode-expert #search-section input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-glow);
}

body.mode-expert #search-section .search-hint { display: none; }

body.mode-expert #search-section #tab-bar {
  display: flex;
  gap: 3px;
}

body.mode-expert #search-section .tab-btn {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 2px;
  background: var(--bg-tertiary);
  color: var(--text-tertiary);
  border: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

body.mode-expert #search-section .tab-btn.active {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
  font-weight: 700;
}

body.mode-expert #search-section .tab-btn:hover:not(.active) {
  border-color: var(--accent);
  color: var(--accent);
}

body.mode-expert #sidebar { display: none !important; }

/* ── 3-column data grid ── */
body.mode-expert #data-panels {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}
body.mode-expert #data-panels > :not([hidden]) ~ :not([hidden]) {
  margin-top: 0 !important;
}

body.mode-expert #company-card       { grid-column: 1 / 2; }
body.mode-expert #financial-section   { grid-column: 2 / 4; grid-row: 1 / 3; }
body.mode-expert #news-section        { grid-column: 1 / 2; }
body.mode-expert #realestate-section  { grid-column: 1 / 2; }
body.mode-expert #patents-section     { grid-column: 2 / 3; }
body.mode-expert #stats-section       { grid-column: 2 / 4; }
body.mode-expert #ai-analysis-section { grid-column: 1 / -1; }

body.mode-expert .expert-only { display: block !important; }
body.mode-expert #expert-market-panels.expert-only { display: grid !important; }
body.mode-expert #expert-ticker-bar.expert-only { display: block !important; }

/* ── Data cards (compact, terminal-style) ── */
body.mode-expert .data-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 10px 12px;
  font-size: 11px;
  transition: border-color 0.15s;
}
body.mode-expert .data-card:hover {
  border-color: var(--border-hover);
}

body.mode-expert .data-card h2,
body.mode-expert .data-card h3 {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
  margin-bottom: 8px;
}

body.mode-expert .data-card .data-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

/* Section headings in expert mode */
body.mode-expert #company-card h3,
body.mode-expert #financial-section h3,
body.mode-expert #news-section h3,
body.mode-expert #realestate-section h3,
body.mode-expert #patents-section h3,
body.mode-expert #stats-section h3,
body.mode-expert #ai-analysis-section h3 {
  font-size: 10px !important;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}

body.mode-expert #company-card,
body.mode-expert #financial-section,
body.mode-expert #news-section,
body.mode-expert #realestate-section,
body.mode-expert #patents-section,
body.mode-expert #stats-section,
body.mode-expert #ai-analysis-section {
  border-radius: 2px !important;
  border-color: var(--border) !important;
  font-size: 11px;
}

body.mode-expert .spinner {
  border-color: var(--border);
  border-top-color: var(--accent);
}

/* ── Financial table (dense data rows) ── */
body.mode-expert #bb-financial-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
body.mode-expert #bb-financial-table th {
  text-align: right;
  padding: 3px 8px;
  font-size: 9px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
}
body.mode-expert #bb-financial-table th:first-child { text-align: left; }
body.mode-expert #bb-financial-table td {
  text-align: right;
  padding: 3px 8px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
body.mode-expert #bb-financial-table td:first-child { 
  text-align: left; 
  color: var(--text-secondary);
  font-size: 10px;
}
body.mode-expert #bb-financial-table tbody tr:hover {
  background: var(--accent-glow);
}
body.mode-expert #bb-financial-table tbody tr:nth-child(even) {
  background: rgba(255,255,255,0.015);
}

/* Positive/Negative value coloring */
body.mode-expert .val-positive { color: var(--success) !important; }
body.mode-expert .val-negative { color: var(--danger) !important; }
body.mode-expert .val-change-up { color: var(--success) !important; }
body.mode-expert .val-change-down { color: var(--danger) !important; }

/* ============================================================
   Bloomberg News Ticker
   ============================================================ */
#bb-ticker-bar {
  overflow: hidden;
  white-space: nowrap;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 6px 0;
}

#bb-ticker-bar .ticker-track {
  display: inline-flex;
  animation: ticker-scroll 40s linear infinite;
  gap: 48px;
}

#bb-ticker-bar .ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}

#bb-ticker-bar .ticker-item .ticker-time {
  color: var(--text-tertiary);
  font-size: 11px;
}

#bb-ticker-bar .ticker-item .ticker-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

@keyframes ticker-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* Pause ticker on hover */
#bb-ticker-bar:hover .ticker-track {
  animation-play-state: paused;
}

/* ============================================================
   Bloomberg Market Overview Panels
   ============================================================ */
#bb-market-panels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.expert-market-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 14px 16px;
  transition: border-color 0.2s ease;
}

.expert-market-card:hover {
  border-color: var(--border-hover);
}

.expert-market-card .expert-market-label {
  font-family: 'Courier New', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

.expert-market-card .expert-market-value {
  font-family: 'Courier New', monospace;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.expert-market-card .expert-market-change {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  margin-top: 2px;
}

.expert-market-card .expert-market-change.up {
  color: var(--danger);
}

.expert-market-card .expert-market-change.down {
  color: var(--accent);
}

.expert-market-card .expert-market-change.flat {
  color: var(--text-secondary);
}

/* ============================================================
   Bloomberg Data Table styling (used in render functions)
   ============================================================ */
.bb-table {
  width: 100%;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  border-collapse: collapse;
}

.bb-table th {
  text-align: left;
  padding: 6px 10px;
  color: var(--text-tertiary);
  font-weight: 400;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

.bb-table td {
  padding: 5px 10px;
  color: var(--text-primary);
  border-bottom: 1px solid rgba(30, 30, 36, 0.6);
  font-variant-numeric: tabular-nums;
}

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

.bb-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.bb-table .positive {
  color: var(--accent);
}

.bb-table .negative {
  color: var(--danger);
}

/* ============================================================
   Responsive adjustments
   ============================================================ */
@media (max-width: 1024px) {
  body.mode-expert #data-panels {
    grid-template-columns: 1fr;
  }

  body.mode-expert #company-card,
  body.mode-expert #financial-section,
  body.mode-expert #news-section,
  body.mode-expert #realestate-section,
  body.mode-expert #patents-section,
  body.mode-expert #stats-section,
  body.mode-expert #ai-analysis-section {
    grid-column: 1 / -1 !important;
  }

  #bb-market-panels {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .mode-toggle-btn {
    padding: 6px 14px;
    font-size: 12px;
  }

  body.mode-ai #search-section {
    max-width: 100%;
  }

  body.mode-ai #search-section .search-inner {
    padding: 14px 16px;
  }

  body.mode-ai #search-section input {
    font-size: 15px;
  }

  #bb-market-panels {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ============================================================
   Navbar mode indicator dot
   ============================================================ */
#mode-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transition: all 0.4s ease;
}

body.mode-ai #mode-indicator {
  background: #3b82f6;
  box-shadow: 0 0 6px rgba(59, 130, 246, 0.5);
}

body.mode-expert #mode-indicator {
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
}