/* ──── Custom CSS for Trading System ──── */

/* Scrollbar styling for dark theme */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #1f2937;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: #4b5563;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #6b7280;
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: #4b5563 #1f2937;
}

/* Loading spinner animation */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.animate-spin {
  animation: spin 1s linear infinite;
}

/* Pulse animation for loading states */
@keyframes pulse-glow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.animate-pulse-glow {
  animation: pulse-glow 2s ease-in-out infinite;
}

/* Skeleton loading */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(90deg, #1f2937 25%, #374151 50%, #1f2937 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 4px;
}

/* Toast notification animations */
@keyframes slide-in-right {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes slide-out-right {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

.toast-enter {
  animation: slide-in-right 0.3s ease-out forwards;
}

.toast-exit {
  animation: slide-out-right 0.3s ease-in forwards;
}

/* Table row hover */
.table-row-hover:hover {
  background-color: rgba(55, 65, 81, 0.5);
}

/* Card hover effect */
.card-hover {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Toggle switch */
.toggle-checkbox:checked {
  right: 0;
  border-color: #10b981;
}

.toggle-checkbox:checked + .toggle-label {
  background-color: #10b981;
}

/* Fade in animation */
@keyframes fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fade-in 0.3s ease-out;
}

/* Badge styles */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.25rem;
}

/* Chart container */
.chart-container {
  position: relative;
  width: 100%;
  min-height: 400px;
  background: #111827;
  border-radius: 8px;
  overflow: hidden;
}

/* Inter font override */
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Sidebar transition */
.sidebar-transition {
  transition: transform 0.3s ease-in-out, width 0.3s ease-in-out;
}

/* Focus styles for dark theme */
input:focus, select:focus, textarea:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
}

/* PnL colors */
.pnl-positive { color: #10b981; }
.pnl-negative { color: #ef4444; }
.pnl-zero { color: #9ca3af; }

/* Loading overlay */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

/* ── Latest data-point glow ── */
@keyframes glow-pulse {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.8);
    opacity: 0.45;
  }
}

@keyframes glow-ring {
  0% {
    width: 8px;
    height: 8px;
    opacity: 0.7;
  }
  100% {
    width: 28px;
    height: 28px;
    opacity: 0;
  }
}

.latest-glow {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 5;
  animation: glow-pulse 2s ease-in-out infinite;
  transition: left 0.3s ease, top 0.3s ease;
}

.latest-glow::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: glow-ring 2s ease-out infinite;
}

.latest-glow.up {
  background: #10b981;
  box-shadow: 0 0 8px 3px rgba(16, 185, 129, 0.5);
}
.latest-glow.up::after {
  border: 1.5px solid rgba(16, 185, 129, 0.4);
}

.latest-glow.down {
  background: #ef4444;
  box-shadow: 0 0 8px 3px rgba(239, 68, 68, 0.5);
}
.latest-glow.down::after {
  border: 1.5px solid rgba(239, 68, 68, 0.4);
}

/* ── Quote card update flash ── */
@keyframes quote-flash {
  0% { border-color: #3b82f6; box-shadow: 0 0 12px rgba(59,130,246,0.3); }
  100% { border-color: #374151; box-shadow: none; }
}
.quote-updated {
  animation: quote-flash 1s ease-out;
}

/* ── LIVE indicator ── */
@keyframes live-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
.live-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  animation: live-blink 1.5s ease-in-out infinite;
}
