/* --- Modal Styles --- */
.ticker-item {
  transition: opacity 0.3s, transform 0.3s, filter 0.3s;
  will-change: transform, filter;
  /* [GPU] Optimize Hover & Scroll */
}

.ticker-item:hover {
  filter: brightness(1.2) contrast(1.1);
  transform: scale(1.02);
  z-index: 10;
  pointer-events: auto;
}

.mini-sparkline {
  display: inline-block;
  vertical-align: middle;
  margin-left: 6px;
  width: 28px;
  height: 12px;
  opacity: 0.8;
}

.mini-sparkline path {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.modal {
  display: none;
  position: fixed;
  z-index: 50;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.modal-content {
  animation-name: zoomIn;
  animation-duration: 0.3s;
}

@keyframes zoomIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* --- Close Button --- */
.close {
  color: #94a3b8;
  float: right;
  font-size: 28px;
  font-weight: bold;
  line-height: 1;
  transition: color 0.2s;
  cursor: pointer;
}

.close:hover {
  color: #ef4444;
}

/* --- Table Sort Icons --- */
.sort-icon {
  display: inline-block;
  width: 12px;
  text-align: center;
  margin-left: 4px;
  font-size: 0.8em;
}

/* --- Chart Reset --- */
canvas {
  display: block;
  max-width: 100%;
}

/* Flash khi giá thay đổi - JS đang dùng class này */
.flash-up {
  background: rgba(22, 163, 74, .18);
  transition: background .2s;
}

.flash-down {
  background: rgba(220, 38, 38, .18);
  transition: background .2s;
}

/* Icon mũi tên */
.price-up::after {
  content: ' ▲';
  color: #16a34a;
  font-size: 0.8em;
}

.price-down::after {
  content: ' ▼';
  color: #dc2626;
  font-size: 0.8em;
}

/* Sparkline - JS đang vẽ SVG */
.sparkline path {
  transition: d 0.2s ease, stroke 0.2s ease;
}

/* Watchlist Blink Effect */
@keyframes wlBlinkUp {
  0% {
    background-color: rgba(5, 150, 105, .18);
  }

  100% {
    background-color: transparent;
  }
}

@keyframes wlBlinkDown {
  0% {
    background-color: rgba(220, 38, 38, .18);
  }

  100% {
    background-color: transparent;
  }
}

/* Pulse Animation */
@keyframes pulseGreen {
  0% {
    box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.7);
  }

  70% {
    box-shadow: 0 0 0 6px rgba(22, 163, 74, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(22, 163, 74, 0);
  }
}

@keyframes pulseRed {
  0% {
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.7);
  }

  70% {
    box-shadow: 0 0 0 6px rgba(220, 38, 38, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0);
  }
}

.animate-pulse-green {
  animation: pulseGreen 2s infinite;
}

.animate-pulse-red {
  animation: pulseRed 2s infinite;
}

.wl-blink-up {
  animation: wlBlinkUp .4s ease-out;
}

.wl-blink-down {
  animation: wlBlinkDown .4s ease-out;
}

/* Watchlist Layout Fixes */
.col-span-12.xl\:col-span-3>div {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#watchlistBody {
  overflow-anchor: none;
}

#watchlistBody td,
#watchlistBody th {
  white-space: nowrap;
}

/* Watchlist Sort Headers */
[data-watch-sort] {
  cursor: pointer;
  user-select: none;
}

[data-watch-sort].sort-asc::after {
  content: ' ▲';
  font-size: 10px;
  opacity: 0.6;
}

[data-watch-sort].sort-desc::after {
  content: ' ▼';
  font-size: 10px;
  opacity: 0.6;
}

/* --- Text Ticker Animation Removed (Replaced by CountUp.js logic) --- */

/* --- Header Ticker Animation --- */
/* Scrolling now handled by JS for smooth hover-to-slow effect */

.ticker-item {
  transition: transform 0.2s ease, filter 0.2s ease;
}

.ticker-item:hover {
  transform: scale(1.05);
  /* Slight pop */
  filter: brightness(1.3);
  /* Brighten for focus */
}

/* Style for the mini sparklines inside ticker */
.mini-sparkline {
  opacity: 0.8;
  filter: drop-shadow(0 0 2px currentColor);
}

.ticker-item:hover .mini-sparkline {
  opacity: 1;
}

/* --- GPU Optimizations for Views & Controls --- */
#summaryView,
#backtestView {
  will-change: transform;
  /* [GPU] Optimize Slide Transition */
}

#btRunBtn {
  will-change: transform, box-shadow;
  /* [GPU] Optimize Hover */
}

/* --- New Animations for Calendar --- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translate3d(0, 10px, 0);
  }

  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

.animate-fade-in-up {
  animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  will-change: transform, opacity;
}