/* ==========================================================================
   StockNews Design System & Application Styles (Premium Fintech Redesign)
   ========================================================================== */

/* --------------------------------------------------------------------------
   CSS Custom Properties (Theme Design Tokens)
   -------------------------------------------------------------------------- */
:root {
  /* Dark Mode Defaults (Claude UI) */
  --bg-primary: hsl(223, 47%, 8%);       /* Deep Cyberpunk Navy #0A0F1A */
  --bg-surface: rgba(255, 255, 255, 0.03); /* Glassmorphism surface */
  --bg-surface-hover: rgba(255, 255, 255, 0.06);
  --bg-surface-alt: rgba(255, 255, 255, 0.02);
  --bg-card: rgba(255, 255, 255, 0.04);
  
  --border-color: rgba(255, 255, 255, 0.08);
  --text-primary: hsl(0, 0%, 95%);
  --text-secondary: hsl(220, 15%, 60%);
  --text-tertiary: hsl(220, 15%, 40%);
  
  --accent-green: hsl(150, 90%, 55%);     /* Neon Green */
  --accent-red: hsl(350, 90%, 65%);       /* Neon Red */
  --accent-gold: hsl(45, 100%, 58%);
  --accent-blue: hsl(210, 100%, 60%);
  --accent-purple: hsl(260, 80%, 65%);
  
  /* New Gradients */
  --gradient-primary: linear-gradient(135deg, #0A58CA 0%, #6610F2 100%);
  --gradient-green: linear-gradient(135deg, hsl(150, 90%, 40%), hsl(150, 90%, 60%));
  --gradient-red: linear-gradient(135deg, hsl(350, 90%, 50%), hsl(350, 90%, 70%));
  
  /* Neon Glows */
  --glow-green: rgba(16, 185, 129, 0.15);
  --glow-red: rgba(239, 68, 68, 0.15);
  
  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-blur: blur(24px);
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  
  --radius: 20px;
  --radius-md: 16px;
  --radius-sm: 14px;
  --radius-xs: 8px;
  
  --transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  --transition-fast: all 0.15s ease;
  --spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
  
  --nav-height: 72px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

[data-theme="light"] {
  --bg-primary: hsl(220, 20%, 97%);
  --bg-surface: hsl(0, 0%, 100%);
  --bg-surface-hover: hsl(220, 20%, 95%);
  --bg-surface-alt: hsl(220, 20%, 96%);
  --bg-card: hsl(0, 0%, 100%);
  --border-color: rgba(0, 0, 0, 0.08);
  --text-primary: hsl(222, 47%, 11%);
  --text-secondary: hsl(220, 10%, 45%);
  --text-tertiary: hsl(220, 10%, 65%);
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(0, 0, 0, 0.08);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  --accent-purple: hsl(260, 80%, 55%);
  --glow-green: rgba(16, 185, 129, 0.3);
  --glow-red: rgba(239, 68, 68, 0.3);
}

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

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

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  padding-bottom: var(--nav-height);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --------------------------------------------------------------------------
   Layout Shell
   -------------------------------------------------------------------------- */
#app {
  max-width: 480px;
  margin: 0 auto;
  padding: 12px 14px calc(var(--nav-height) + 30px);
  min-height: 100vh;
}

#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: rgba(18, 22, 31, 0.85); /* fallback based on var(--bg-surface) */
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 1000;
  padding-bottom: env(safe-area-inset-bottom);
}
[data-theme="light"] #bottom-nav {
  background: rgba(255, 255, 255, 0.85);
}

/* --------------------------------------------------------------------------
   Navigation Items
   -------------------------------------------------------------------------- */
.nav-item {
  background: none;
  border: none;
  color: var(--text-tertiary);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-family: var(--font);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  padding: 8px 16px;
  position: relative;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.nav-item .nav-icon {
  font-size: 22px;
  transition: var(--transition);
}
/* For SVGs inside */
.nav-item svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
  transition: var(--transition);
}

.nav-item.active {
  color: var(--text-primary);
  text-shadow: 0 0 10px rgba(255,255,255,0.2);
}

.nav-item.active .nav-icon,
.nav-item.active svg {
  color: white;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.3));
}

.nav-item::after {
  content: '';
  position: absolute;
  bottom: 0px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text-primary);
  box-shadow: 0 0 8px 2px rgba(255, 255, 255, 0.6);
  opacity: 0;
  transform: translateY(10px);
  transition: var(--transition);
}

.nav-item.active::after {
  opacity: 1;
  transform: translateY(0);
}

.nav-item:active {
  transform: scale(0.92);
}

/* --------------------------------------------------------------------------
   Page Headers & Back Button
   -------------------------------------------------------------------------- */
.page-header {
  padding: 12px 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.page-title {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.1;
}

.page-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 6px;
  font-weight: 500;
}

.back-btn {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 24px;
  cursor: pointer;
  padding: 8px;
  margin: -8px;
  transition: var(--transition);
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.back-btn:active {
  transform: scale(0.9);
}

/* --------------------------------------------------------------------------
   Components: Cards & Surfaces
   -------------------------------------------------------------------------- */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  transition: var(--transition);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  position: relative;
  overflow: hidden;
}

.card:active {
  transform: scale(0.98);
  background: var(--bg-surface-hover);
}

/* --------------------------------------------------------------------------
   Market Summary
   -------------------------------------------------------------------------- */
.market-summary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.market-card {
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  padding: 16px;
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--accent-purple);
  transition: var(--transition);
}

.market-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255,255,255,0.15);
}

.market-card .market-name {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

.market-card .market-value {
  font-size: 22px;
  font-weight: 800;
  margin: 6px 0;
  letter-spacing: -0.5px;
}

.market-card .market-change {
  font-size: 13px;
  font-weight: 700;
}

.market-card .market-change.up { color: var(--accent-green); }
.market-card .market-change.down { color: var(--accent-red); }

/* --------------------------------------------------------------------------
   Stock List Items
   -------------------------------------------------------------------------- */
.stock-item {
  display: flex;
  align-items: center;
  padding: 16px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
  margin-bottom: 4px;
}

.stock-item:nth-child(even) {
  background: var(--bg-surface-alt);
}

.stock-item:active {
  background: var(--bg-surface-hover);
  transform: scale(0.97);
}

.stock-info {
  flex: 1;
}

.stock-ticker {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.2px;
}

.stock-name {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
  font-weight: 500;
}

.stock-price-col {
  text-align: right;
}

.stock-price {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.2px;
  margin-bottom: 4px;
}

.stock-change {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  display: inline-block;
}

.stock-change.up {
  color: white;
  background: var(--gradient-green);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}

.stock-change.down {
  color: white;
  background: var(--gradient-red);
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.2);
}

/* --------------------------------------------------------------------------
   News Cards
   -------------------------------------------------------------------------- */
.news-card {
  display: flex;
  gap: 16px;
  padding: 16px;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--accent-blue); /* Default */
  cursor: pointer;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

.news-card.bullish { border-left-color: var(--accent-green); }
.news-card.bearish { border-left-color: var(--accent-red); }

.news-card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  border-color: rgba(255,255,255,0.1);
}

.news-card:active {
  transform: scale(0.97);
}

.news-card::after {
  content: '→';
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  transition: var(--transition);
  color: var(--text-tertiary);
  font-weight: bold;
}
.news-card:hover::after {
  opacity: 1;
  transform: translateY(-50%) translateX(4px);
}

.news-content {
  flex: 1;
  padding-right: 16px; /* Room for arrow */
}

.news-source {
  font-size: 12px;
  color: var(--accent-blue);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.news-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
  margin: 6px 0 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-time {
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 500;
}

.news-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  margin-left: 8px;
  background: rgba(255, 215, 0, 0.15);
  color: var(--accent-gold);
}

/* --------------------------------------------------------------------------
   Search Bar
   -------------------------------------------------------------------------- */
.search-bar {
  position: relative;
  margin-bottom: 24px;
  z-index: 100;
}

.search-bar:focus-within {
  z-index: 9999;
}

.search-input {
  width: 100%;
  padding: 16px 16px 16px 48px;
  background: var(--glass-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 100px; /* Pill shape */
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 500;
  font-family: var(--font);
  outline: none;
  transition: var(--transition);
  box-shadow: 0 4px 20px rgba(0,0,0,0.1), inset 0 2px 4px rgba(255,255,255,0.02);
}

.search-input:focus {
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.05), 0 8px 30px rgba(0,0,0,0.2);
  background: rgba(255, 255, 255, 0.05);
}

.search-input::placeholder {
  color: var(--text-tertiary);
}

.search-icon {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  font-size: 18px;
  transition: var(--transition);
  z-index: 2;
}

.search-input:focus ~ .search-icon {
  color: var(--text-primary);
}

/* --------------------------------------------------------------------------
   Tabs (Pill Navigation)
   -------------------------------------------------------------------------- */
.tabs {
  display: flex;
  background: var(--bg-surface);
  border-radius: 100px;
  padding: 4px;
  margin-bottom: 16px;
  border: 1px solid var(--border-color);
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none; /* Hide scrollbar Firefox */
  -ms-overflow-style: none; /* IE */
}
.tabs::-webkit-scrollbar {
  display: none; /* Hide scrollbar Chrome/Safari */
}

.tab {
  flex: 1;
  min-width: max-content;
  padding: 8px 14px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  border-radius: 100px;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-secondary);
  border: none;
  background: none;
  font-family: var(--font);
  outline: none;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.tab:hover {
  color: var(--text-primary);
}

.tab.active {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

[data-theme="light"] .tab.active {
  background: var(--text-primary);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

/* --------------------------------------------------------------------------
   Stock Detail Page
   -------------------------------------------------------------------------- */
.detail-header {
  text-align: center;
  padding: 24px 0;
}

.detail-ticker {
  font-size: 16px;
  color: var(--text-secondary);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.detail-name {
  font-size: 26px;
  font-weight: 800;
  margin: 6px 0;
  letter-spacing: -0.5px;
}

.detail-price {
  font-size: 44px;
  font-weight: 800;
  margin: 12px 0;
  letter-spacing: -1.5px;
}

.detail-change {
  font-size: 18px;
  font-weight: 700;
  padding: 6px 16px;
  border-radius: 10px;
  display: inline-block;
}
.detail-change.up {
  color: white;
  background: var(--gradient-green);
}
.detail-change.down {
  color: white;

  background: var(--gradient-red);
}

.chart-container {
  background: var(--bg-surface);
  border-radius: var(--radius);
  padding: 20px;
  margin: 20px 0;
  border: 1px solid var(--border-color);
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.chart-canvas {
  width: 100%;
  height: 240px;
}

.chart-periods {
  display: flex;
  gap: 4px;
  justify-content: center;
  margin-top: 16px;
}

.chart-period {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-secondary);
  background: none;
  border: none;
  font-family: var(--font);
  transition: var(--transition);
  outline: none;
}

.chart-period.active {
  background: var(--bg-surface-alt);
  color: var(--text-primary);
  box-shadow: inset 0 0 0 1px var(--border-color);
}

/* --------------------------------------------------------------------------
   Fundamentals Grid
   -------------------------------------------------------------------------- */
.fundamentals {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 20px 0;
}

.fund-item {
  background: var(--bg-surface);
  padding: 16px;
}

.fund-label {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.fund-value {
  font-size: 18px;
  font-weight: 800;
  margin-top: 6px;
}

/* --------------------------------------------------------------------------
   Dividend Section
   -------------------------------------------------------------------------- */
.dividend-card {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.1), rgba(255, 215, 0, 0.02));
  border: 1px solid rgba(255, 215, 0, 0.2);
  border-radius: var(--radius);
  padding: 20px;
  margin: 20px 0;
  position: relative;
  overflow: hidden;
}

.dividend-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.dividend-icon { font-size: 28px; }
.dividend-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--accent-gold);
}

.dividend-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 215, 0, 0.1);
}
.dividend-row:last-child { border-bottom: none; }

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

.dividend-value {
  font-size: 14px;
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   Alerts & Settings
   -------------------------------------------------------------------------- */
.alert-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  border: 1px solid var(--border-color);
}

.alert-icon { font-size: 28px; }
.alert-info { flex: 1; }

.alert-stock {
  font-size: 16px;
  font-weight: 800;
}
.alert-condition {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
  font-weight: 500;
}

.alert-delete {
  background: rgba(239, 68, 68, 0.1);
  border: none;
  color: var(--accent-red);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.alert-delete:active { transform: scale(0.9); }

.setting-group { margin-bottom: 28px; }
.setting-group-title {
  font-size: 13px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
  padding-left: 8px;
  font-weight: 700;
}

.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
}
.setting-item:first-child { border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.setting-item:last-child { border-radius: 0 0 var(--radius-sm) var(--radius-sm); border-bottom: none; }

.setting-label {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 12px;
}
.setting-emoji { font-size: 20px; }

/* --------------------------------------------------------------------------
   Controls & Inputs
   -------------------------------------------------------------------------- */
.toggle {
  width: 52px;
  height: 30px;
  background: var(--text-tertiary);
  border-radius: 15px;
  position: relative;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  outline: none;
}
.toggle::after {
  content: '';
  position: absolute;
  width: 24px;
  height: 24px;
  background: white;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: var(--transition);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.toggle.active { background: var(--accent-purple); }
.toggle.active::after { transform: translateX(22px); }

.lang-selector {
  display: flex;
  background: var(--bg-surface-alt);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}
.lang-option {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  background: none;
  color: var(--text-secondary);
}
.lang-option.active {
  background: var(--accent-purple);
  color: white;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
  padding: 14px 28px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font);
  outline: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}
.btn-primary:active { transform: scale(0.97); }
.btn-outline {
  background: transparent;
  border: 2px solid var(--accent-blue);
  color: var(--accent-blue);
}
.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--accent-red);
}
.btn-full { width: 100%; }

/* --------------------------------------------------------------------------
   Modal Sheet
   -------------------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 1;
  pointer-events: all;
  visibility: visible;
  transition: opacity 0.3s, visibility 0.3s;
}
.modal-overlay.hidden {
  display: flex !important; /* override global .hidden */
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}
.modal-overlay .modal { transform: translateY(0); }
.modal-overlay.hidden .modal { transform: translateY(100%); }

.modal {
  background: var(--bg-surface);
  border-radius: 28px 28px 0 0;
  padding: 24px 24px 40px;
  width: 100%;
  max-width: 480px;
  transform: translateY(100%);
  transition: transform 0.4s var(--spring);
  box-shadow: 0 -10px 40px rgba(0,0,0,0.3);
  position: relative;
}
.modal::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 60px;
  background: linear-gradient(180deg, rgba(255,255,255,0.05) 0%, transparent 100%);
  border-radius: 28px 28px 0 0;
  pointer-events: none;
}

.modal-handle {
  width: 40px;
  height: 5px;
  background: var(--text-tertiary);
  border-radius: 3px;
  margin: 0 auto 24px;
}

.modal-title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 20px;
  letter-spacing: -0.5px;
}

/* --------------------------------------------------------------------------
   Watchlist Star
   -------------------------------------------------------------------------- */
.watchlist-btn {
  background: none;
  border: none;
  font-size: 26px;
  cursor: pointer;
  padding: 4px;
  transition: var(--transition);
  filter: grayscale(1) opacity(0.5);
}
.watchlist-btn.active {
  filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.4));
}
.watchlist-btn:active { transform: scale(1.3); }

.badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--gradient-red);
  color: white;
  font-size: 11px;
  font-weight: 800;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

/* --------------------------------------------------------------------------
   Empty State
   -------------------------------------------------------------------------- */
.empty-state {
  text-align: center;
  padding: 80px 24px;
  position: relative;
}
.empty-state::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at center, rgba(255,255,255,0.02) 2px, transparent 2px);
  background-size: 30px 30px;
  z-index: -1;
}
.alert-empty-icon, .empty-icon {
  font-size: 72px;
  margin-bottom: 24px;
  display: inline-block;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.alert-empty, .empty-text {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 12px;
  color: var(--text-primary);
}
.empty-subtext {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* --------------------------------------------------------------------------
   New Additions & Utility Classes
   -------------------------------------------------------------------------- */
/* Live Indicator Dot */
.live-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent-green);
  display: inline-block;
  animation: pulse-glow 2s infinite;
  box-shadow: 0 0 8px var(--accent-green);
}

/* Gradient Text */
.gradient-text {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Status Bar Pill */
.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 20px;
  font-size: 13px; font-weight: 700;
}
.status-pill.up { background: rgba(16, 185, 129, 0.15); color: var(--accent-green); }
.status-pill.down { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); }

/* Section Divider */
.section-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-color), transparent);
  margin: 32px 0;
}

.text-green { color: var(--accent-green); }
.text-red { color: var(--accent-red); }
.text-gold { color: var(--accent-gold); }
.text-secondary { color: var(--text-secondary); }
.text-center { text-align: center; }

.hidden { display: none !important; }

/* --------------------------------------------------------------------------
   Animations & Dynamic Effects
   -------------------------------------------------------------------------- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

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

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes pulse-glow {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.fade-in { animation: fadeIn 0.5s var(--spring) forwards; }
/* Search Autocomplete Dropdown */
.search-results-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-sm);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.08);
  max-height: 380px;
  overflow-y: auto;
  z-index: 10000;
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
}
[data-theme="light"] .search-results-dropdown {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(0, 0, 0, 0.15);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.search-result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: var(--transition);
}
.search-result-item:last-child {
  border-bottom: none;
}
.search-result-item:hover, .search-result-item:active {
  background: var(--bg-surface-hover);
}
.search-result-ticker {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary);
}
.search-result-name {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* --------------------------------------------------------------------------
   🤖 AI Financial Copilot & Terminal Controls
   -------------------------------------------------------------------------- */
.btn-ai-glow {
  background: linear-gradient(135deg, #8b5cf6, #3b82f6, #06b6d4);
  color: #ffffff;
  font-weight: 700;
  border: none;
  border-radius: 100px;
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.45);
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}
.btn-ai-glow:hover, .btn-ai-glow:active {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 28px rgba(139, 92, 246, 0.65);
}

.chart-ctrl-bar {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 10px;
  flex-wrap: wrap;
}

.chart-ctrl-btn {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: var(--transition);
}
.chart-ctrl-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}
.chart-ctrl-btn.active {
  background: rgba(139, 92, 246, 0.2);
  color: #c084fc;
  border-color: rgba(139, 92, 246, 0.4);
}

/* AI Chat Window Modal */
.ai-chat-box {
  display: flex;
  flex-direction: column;
  height: 480px;
  max-height: 80vh;
}
.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 4px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ai-msg {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
  max-width: 88%;
}
.ai-msg.bot {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.ai-msg.user {
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: #ffffff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.ai-quick-pills {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 6px 0;
  scrollbar-width: none;
}
.ai-quick-pills::-webkit-scrollbar { display: none; }
.ai-pill-btn {
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 100px;
  background: rgba(139, 92, 246, 0.15);
  color: #c084fc;
  border: 1px solid rgba(139, 92, 246, 0.3);
  white-space: nowrap;
  cursor: pointer;
}

.slide-up { animation: slideUp 0.6s var(--spring) forwards; }

@media (min-width: 1100px) {
  .market-summary {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ==========================================================================
   🚀 StockNews 3.0 Ultimate Upgrade Components
   ========================================================================== */

/* 🧮 Trade Planner & Profit Target Matrix */
.trade-planner-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: 12px;
}

.trade-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 12px 0;
}

.trade-stat-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px;
}

.trade-stat-label {
  font-size: 11px;
  color: var(--text-secondary);
}

.trade-stat-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 2px;
}

.profit-target-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 10px 0;
}

.target-pill-btn {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
}

.target-pill-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.target-pill-btn.active {
  background: var(--accent-green);
  color: #000;
  border-color: var(--accent-green);
  font-weight: 700;
}

.profit-result-banner {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.12), rgba(59, 130, 246, 0.08));
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 10px;
  padding: 14px;
  margin: 14px 0;
}

/* 💼 Multi-Lot Breakdown */
.lot-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
  max-height: 240px;
  overflow-y: auto;
}

.lot-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}

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

.lot-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-blue);
  font-weight: 600;
  display: inline-block;
  margin-bottom: 2px;
}

/* 🗺️ Market Treemap Heatmap */
.treemap-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin: 16px 0;
}

.treemap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.treemap-node {
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  min-height: 80px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.treemap-node:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.treemap-up-strong { background: linear-gradient(135deg, #15803d, #166534); color: #fff; }
.treemap-up-mod { background: linear-gradient(135deg, #16a34a, #15803d); color: #fff; }
.treemap-up-light { background: linear-gradient(135deg, #22c55e, #16a34a); color: #000; }
.treemap-down-light { background: linear-gradient(135deg, #ef4444, #dc2626); color: #fff; }
.treemap-down-mod { background: linear-gradient(135deg, #dc2626, #b91c1c); color: #fff; }
.treemap-down-strong { background: linear-gradient(135deg, #991b1b, #7f1d1d); color: #fff; }
.treemap-neutral { background: rgba(255, 255, 255, 0.06); color: var(--text-primary); }

/* 🔮 AI Screener Cards */
.screener-theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.screener-theme-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s ease;
}

.screener-theme-card:hover {
  border-color: var(--accent-blue);
  background: rgba(59, 130, 246, 0.05);
}

.screener-theme-card.active {
  border-color: #8b5cf6;
  background: rgba(139, 92, 246, 0.12);
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.3);
}

/* 💰 Monthly Dividend Forecast */
.dividend-forecast-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin: 16px 0;
}

.dividend-bar-container {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 120px;
  padding-top: 20px;
  margin: 16px 0 8px;
  border-bottom: 1px solid var(--border-color);
}

.dividend-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
}

.dividend-bar {
  width: 100%;
  max-width: 22px;
  background: linear-gradient(180deg, #38bdf8, #0284c7);
  border-radius: 4px 4px 0 0;
  transition: height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 4px;
}

.dividend-bar:hover {
  background: linear-gradient(180deg, #60a5fa, #2563eb);
}

.dividend-month-label {
  font-size: 10px;
  color: var(--text-secondary);
  margin-top: 6px;
}

/* 📈 Live Market Ticker Ribbon */
.market-ticker-ribbon {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  white-space: nowrap;
  padding: 8px 4px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border-color);
  -webkit-overflow-scrolling: touch;
}

.market-ticker-ribbon::-webkit-scrollbar {
  display: none;
}

.ticker-ribbon-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 500;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}

.ticker-ribbon-item b {
  color: var(--text-primary);
  font-weight: 700;
}

/* 📊 9x9 Profit Target Matrix Table */
.trade-matrix-wrapper {
  width: 100%;
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  -webkit-overflow-scrolling: touch;
}

.trade-matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  text-align: center;
  min-width: 640px;
}

.trade-matrix-table th, .trade-matrix-table td {
  padding: 6px 8px;
  border: 1px solid var(--border-color);
  white-space: nowrap;
}

.trade-matrix-table th {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  font-weight: 700;
  position: sticky;
  top: 0;
}

.trade-matrix-table th.matrix-current-col,
.trade-matrix-table td.matrix-current-col {
  background: rgba(59, 130, 246, 0.08);
}

.trade-matrix-table tr.matrix-current-row td {
  background: rgba(16, 185, 129, 0.08);
  font-weight: 700;
}

.trade-matrix-table tr.matrix-current-row td.matrix-current-col {
  background: rgba(245, 158, 11, 0.15);
  box-shadow: inset 0 0 0 1.5px var(--accent-gold);
}

.matrix-cell-price {
  font-weight: 700;
  color: var(--accent-green);
}

.matrix-cell-profit {
  font-size: 9px;
  color: var(--text-secondary);
  display: block;
}

/* 💼 Holdings Lots Accordion & Quick Actions */
.holding-lot-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  margin-top: 6px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 12px;
}

.holding-lot-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.holding-lots-drawer {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-color);
}

.holding-quick-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
}

/* ==========================================================================
   ✨ Pro-Grade Visual Polish & Power User Features (Phase 5)
   ========================================================================== */

/* 🟢🔴 Real-Time Price Tick Flash Animations */
@keyframes tick-flash-green {
  0% { background-color: rgba(16, 185, 129, 0.45); color: #ffffff; }
  100% { background-color: transparent; }
}

@keyframes tick-flash-red {
  0% { background-color: rgba(239, 68, 68, 0.45); color: #ffffff; }
  100% { background-color: transparent; }
}

.tick-up {
  animation: tick-flash-green 1.4s cubic-bezier(0.2, 0.8, 0.2, 1);
  border-radius: 4px;
}

.tick-down {
  animation: tick-flash-red 1.4s cubic-bezier(0.2, 0.8, 0.2, 1);
  border-radius: 4px;
}

/* 🔢 Tabular Numbers for Price Data Alignment */
.stock-price,
.detail-price,
.fund-value,
.stock-change,
.matrix-cell-price,
.trade-matrix-table td,
.trade-matrix-table th,
.dividend-bar,
.price-tag {
  font-variant-numeric: tabular-nums lining-nums;
  letter-spacing: -0.01em;
}

/* ⌨️ Keyboard Shortcut Pill & Quick Search Modal */
.kbd-shortcut {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 6px;
  font-size: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 4px;
  color: var(--text-secondary);
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.quick-search-modal {
  max-width: 600px;
  border-top: 3px solid var(--accent-blue);
}

.quick-search-input-wrapper {
  position: relative;
  margin-bottom: 12px;
}

.quick-search-result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.quick-search-result-item:hover,
.quick-search-result-item.selected {
  background: rgba(59, 130, 246, 0.15);
}




/* ==========================================================================
   Google Stitch AI Design Tokens & Modern Components
   ========================================================================== */

/* Shimmer Loading Skeleton */
.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: var(--radius-xs, 8px);
}
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Horizontal Scroll Row */
.scroll-row {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 4px;
}
.scroll-row::-webkit-scrollbar { display: none; }
.scroll-row > * { scroll-snap-align: start; flex-shrink: 0; }

/* Section Header */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.section-link {
  font-size: 12px;
  color: var(--accent-blue);
  text-decoration: none;
  font-weight: 600;
}
.section-link:hover { text-decoration: underline; }

/* Tabular numbers for clean financial alignment */
.num { font-variant-numeric: tabular-nums; }

/* Modern Pills for Change */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.pill.up { background: rgba(16,185,129,0.15); color: var(--accent-green); }
.pill.down { background: rgba(239,68,68,0.15); color: var(--accent-red); }

/* Index Pill (Hero Ticker Ribbon) */
.index-pill {
  min-width: 145px;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm, 14px);
  backdrop-filter: var(--glass-blur, blur(24px));
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.index-pill:hover {
  transform: translateY(-2px);
  border-color: rgba(255,255,255,0.15);
}

/* Top Mover Cards V2 */
.mover-card-v2 {
  min-width: 125px;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm, 14px);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}
.mover-card-v2:hover {
  transform: translateY(-2px);
  background: var(--bg-surface-hover);
}
.mover-card-v2:active { transform: scale(0.97); }

/* News Compact Cards V2 */
.news-card-v2 {
  min-width: 270px;
  max-width: 280px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm, 14px);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.news-card-v2:hover {
  transform: translateY(-2px);
  border-color: rgba(99,102,241,0.3);
}

/* Portfolio Hero Card */
.portfolio-hero {
  padding: 20px 22px;
  background: linear-gradient(135deg, rgba(10,88,202,0.18), rgba(102,16,242,0.12));
  border: 1px solid rgba(99,102,241,0.25);
  border-radius: var(--radius, 20px);
  box-shadow: 0 8px 32px rgba(10,88,202,0.12);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.portfolio-hero:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(10,88,202,0.2);
}

/* Stock Row (Markets Page) */
.stock-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm, 14px);
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}
.stock-row:hover {
  background: var(--bg-surface-hover);
  transform: translateY(-1px);
}
.stock-row:active { transform: scale(0.99); }

/* Filter Pills */
.filter-pills {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 4px;
}
.filter-pills::-webkit-scrollbar { display: none; }
.filter-pill {
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-secondary);
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
}
.filter-pill:hover {
  color: var(--text-primary);
  border-color: rgba(255,255,255,0.2);
}
.filter-pill.active {
  background: var(--accent-blue);
  color: #fff;
  border-color: var(--accent-blue);
  box-shadow: 0 4px 12px rgba(10,88,202,0.3);
}

/* ==========================================================================
   🖥️ Responsive Desktop & Tablet System (Fixes the 480px squeezed bug)
   ========================================================================== */
/* Hide Desktop Header on mobile by default */
#desktop-header {
  display: none;
}

@media (min-width: 768px) {
  /* Hide Mobile Bottom Nav completely on Desktop */
  #bottom-nav {
    display: none !important;
  }

  /* Desktop Header Sticky Bar */
  #desktop-header {
    display: block;
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 64px;
    background: rgba(10, 15, 26, 0.88);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 1000;
  }

  [data-theme="light"] #desktop-header {
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  }

  .desktop-header-inner {
    max-width: 1080px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    gap: 16px;
  }

  .desktop-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    text-decoration: none;
  }

  .desktop-logo-icon {
    font-size: 16px;
    background: var(--gradient-primary);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: #fff;
    box-shadow: 0 4px 12px rgba(10, 88, 202, 0.4);
  }

  .desktop-brand-title {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-primary);
  }

  .desktop-brand-badge {
    font-size: 10px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
    border: 1px solid rgba(59, 130, 246, 0.3);
    text-transform: uppercase;
  }

  .desktop-nav-menu {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
  }

  .desktop-nav-menu .nav-item {
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    padding: 6px 14px !important;
    width: auto !important;
    height: 38px !important;
    border-radius: 20px !important;
    background: transparent !important;
    border: 1px solid transparent !important;
    color: var(--text-secondary) !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    white-space: nowrap !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
    position: static !important;
    flex-shrink: 0 !important;
  }

  .desktop-nav-menu .nav-item::before,
  .desktop-nav-menu .nav-item::after {
    display: none !important;
  }

  .desktop-nav-menu .nav-item .nav-icon,
  .desktop-nav-menu .nav-item svg {
    margin: 0 !important;
    width: 16px !important;
    height: 16px !important;
    flex-shrink: 0 !important;
  }

  .desktop-nav-menu .nav-item .nav-label {
    display: inline-block !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    line-height: 1 !important;
    margin: 0 !important;
    white-space: nowrap !important;
  }

  .desktop-nav-menu .nav-item:hover {
    color: var(--text-primary) !important;
    background: rgba(255, 255, 255, 0.06) !important;
  }

  .desktop-nav-menu .nav-item.active {
    color: #fff !important;
    background: rgba(59, 130, 246, 0.18) !important;
    border: 1px solid rgba(59, 130, 246, 0.4) !important;
  }

  .desktop-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .desktop-search-box input {
    width: 200px;
    height: 36px;
    padding: 0 14px;
    font-size: 12px;
    border-radius: 18px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    outline: none;
    transition: all 0.2s ease;
  }

  .desktop-search-box input:focus {
    width: 260px;
    border-color: var(--accent-blue);
    background: rgba(255, 255, 255, 0.08);
  }

  .desktop-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    transition: all 0.15s ease;
  }

  .desktop-icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
  }

  #app {
    max-width: 1040px !important;
    margin: 0 auto;
    padding: 24px 24px 60px !important;
  }

  #home-quick-search-wrapper {
    display: none !important;
  }

  /* Grid Layout for Index Ribbon on Desktop */
  .scroll-row {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)) !important;
    gap: 14px !important;
    overflow-x: visible !important;
    padding: 0 !important;
  }

  .index-pill {
    min-width: 0 !important;
  }

  .mover-card-v2 {
    min-width: 0 !important;
  }

  .news-card-v2 {
    min-width: 0 !important;
    max-width: none !important;
  }

  #home-movers-container {
    grid-template-columns: repeat(4, 1fr) !important;
  }

  #home-news-section .scroll-row {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Detail Page 2-Column Desktop Grid */
  .detail-desktop-grid {
    display: grid !important;
    grid-template-columns: 1.8fr 1.2fr !important;
    gap: 20px !important;
    align-items: start !important;
  }

  /* Centered Modals on Desktop */
  .modal-overlay {
    align-items: center !important;
    padding: 24px !important;
  }

  .modal-overlay .modal {
    border-radius: 20px !important;
    max-height: 88vh !important;
    transform: scale(1) !important;
  }

  .modal-overlay.hidden .modal {
    transform: scale(0.95) !important;
  }
}

/* 🏷️ App Version Badge (Bottom-Left Corner) */
.app-version-badge {
  position: fixed;
  bottom: 12px;
  left: 12px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono, ui-monospace, monospace);
  color: var(--text-tertiary);
  background: var(--bg-card, rgba(15, 23, 42, 0.75));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  z-index: 1000;
  pointer-events: none;
  opacity: 0.85;
  letter-spacing: 0.5px;
  user-select: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

@media (max-width: 768px) {
  .app-version-badge {
    bottom: calc(var(--nav-height, 60px) + env(safe-area-inset-bottom, 0px) + 8px);
    left: 8px;
    font-size: 10px;
    padding: 2px 6px;
  }
}

