/* Stock Analysis Dashboard Styles */

body {
  background-color: #121212;
  color: #e0e0e0;
  font-family: "Inter", sans-serif;
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(18, 18, 18, 0.95);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

.loading-overlay.hidden {
  opacity: 0;
  visibility: hidden;
}

.loading-content {
  text-align: center;
}

.loading-spinner {
  width: 60px;
  height: 60px;
  border: 4px solid #333;
  border-top: 4px solid #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-text {
  font-size: 1.5rem;
  font-weight: 600;
  color: #e0e0e0;
  margin-bottom: 8px;
}

.loading-subtext {
  font-size: 0.9rem;
  color: #888;
  animation: pulse 1.5s ease-in-out infinite;
}

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

/* Safe area for notch devices - mobile only */
@media screen and (max-width: 768px) {
  body {
    background-color: #1a1a1a;
  }
  body > header {
    margin-top: 20px;
  }
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #1a1a1a;
}
::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #444;
}

/* Line clamp */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Slide Menu */
.slide-menu {
  position: fixed;
  top: 0;
  left: -280px;
  width: 280px;
  height: 100vh;
  background-color: #1a1a1a;
  border-right: 1px solid #2a2a2a;
  z-index: 100;
  transition: left 0.3s ease;
  overflow-y: auto;
}

/* Safe area for slide menu - mobile only */
@media screen and (max-width: 768px) {
  .slide-menu {
    padding-top: 44px;
  }
}
.slide-menu.open {
  left: 0;
}

.slide-menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 99;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease;
}
.slide-menu-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* Hamburger Button */
.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 28px;
  height: 24px;
  cursor: pointer;
  padding: 3px;
}
.hamburger span {
  display: block;
  width: 100%;
  height: 3px;
  background-color: #e0e0e0;
  border-radius: 2px;
  transition: all 0.3s ease;
}
.hamburger:hover span {
  background-color: #3b82f6;
}

/* ============================================
   Market Index Real-time Update Animations
   ============================================ */

/* Flash animation for price increase (green) */
.flash-up {
  animation: flashUp 0.8s ease-out;
}

@keyframes flashUp {
  0% {
    background-color: rgba(34, 197, 94, 0.4);
  }
  100% {
    background-color: transparent;
  }
}

/* Flash animation for price decrease (red) */
.flash-down {
  animation: flashDown 0.8s ease-out;
}

@keyframes flashDown {
  0% {
    background-color: rgba(239, 68, 68, 0.4);
  }
  100% {
    background-color: transparent;
  }
}

/* Fade animation for value update */
.fade-update {
  animation: fadeUpdate 0.5s ease-out;
}

/* Realtime active indicator style */
.realtime-active {
  position: relative;
}

.realtime-active::after {
  content: '';
  position: absolute;
  top: -2px;
  right: -8px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #22c55e;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.2);
    opacity: 0.7;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes fadeUpdate {
  0% {
    opacity: 0.5;
    transform: scale(1.05);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Market index card base styles */
.market-index-card {
  transition: background-color 0.3s ease, transform 0.2s ease;
}

.market-index-card:hover {
  transform: translateY(-2px);
}

/* Last update time styling */
#market-indices-last-update {
  font-variant-numeric: tabular-nums;
}

/* ============================================
   Drawing Tools Styles
   ============================================ */

/* Drawing menu dropdown item */
.drawing-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 6px 12px;
  font-size: 10px;
  color: #d1d5db;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background-color 0.15s;
}

.drawing-menu-item:hover {
  background-color: #333;
}

/* Active drawing tool indicator */
#drawing-tool-btn.active {
  background-color: #3b82f6;
  border-color: #3b82f6;
  color: white;
}

/* Drawing mode cursor */
.chart-drawing-mode {
  cursor: crosshair !important;
}

/* Drawing tool toast notification */
.drawing-toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #1a1a1a;
  border: 1px solid #333;
  color: white;
  padding: 10px 16px;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  z-index: 1000;
  font-size: 13px;
  animation: slideInToast 0.3s ease-out;
}

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

/* ============================================
   Onboarding & Welcome Modal Styles
   ============================================ */

/* Welcome modal animation */
.animate-modal-appear {
  animation: modalAppear 0.3s ease-out;
}

@keyframes modalAppear {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Tooltip animation */
.animate-tooltip-appear {
  animation: tooltipAppear 0.2s ease-out;
}

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

/* Help menu animation */
.animate-menu-appear {
  animation: menuAppear 0.2s ease-out;
}

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

/* Pulse border animation for highlight */
.animate-pulse-border {
  animation: pulseBorder 1.5s ease-in-out infinite;
}

@keyframes pulseBorder {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(59, 130, 246, 0);
  }
}

/* ============================================
   Stock List Selection Highlight Enhancement
   ============================================ */

/* Selected stock row - enhanced visibility */
.stock-row.selected {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.3) 0%, rgba(59, 130, 246, 0.1) 100%) !important;
  border-left: 3px solid #3b82f6 !important;
  position: relative;
}

.stock-row.selected::after {
  content: '';
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-right: 6px solid #3b82f6;
}

/* Hover effect for stock rows */
.stock-row {
  transition: all 0.15s ease;
  border-left: 3px solid transparent;
}

.stock-row:hover:not(.selected) {
  background-color: rgba(255, 255, 255, 0.05);
  border-left-color: #444;
}

/* ============================================
   Stock Info Bar Styles
   ============================================ */

#stock-info-bar {
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-100%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   Panel Stock Badge Styles
   ============================================ */

.panel-stock-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.2), rgba(139, 92, 246, 0.2));
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 9999px;
  font-size: 11px;
  color: #93c5fd;
  animation: badgeAppear 0.3s ease-out;
}

.panel-stock-badge::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  background-color: #3b82f6;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes badgeAppear {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ============================================
   Floating Help Button Styles
   ============================================ */

#floating-help-container {
  transition: transform 0.2s ease;
}

#floating-help-btn {
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

#floating-help-btn:hover {
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
}

/* Hide help pulse after interaction */
#help-pulse.hidden {
  display: none;
}
