/**
 * AI Trade Training Monitor - Additional Styles
 */
 
/* MQTT Status Indicator */
.mqtt-status {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: bold;
  z-index: 1000;
}

.mqtt-connected {
  background-color: #28a745;
  color: white;
}

.mqtt-disconnected {
  background-color: #dc3545;
  color: white;
}

/* Flashing highlight for new best fitness */
@keyframes flash-green {
  0% { background-color: rgba(40, 167, 69, 0.1); }
  50% { background-color: rgba(40, 167, 69, 0.6); }
  100% { background-color: rgba(40, 167, 69, 0.1); }
}

/* Enhanced animation for new best fitness */
@keyframes flash-best {
  0% { 
    background-color: rgba(255, 215, 0, 0.1);
    color: #000;
    transform: scale(1);
  }
  30% { 
    background-color: rgba(255, 215, 0, 0.9);
    color: #000;
    transform: scale(1.3);
    box-shadow: 0 0 15px 5px rgba(255, 215, 0, 0.5);
  }
  70% { 
    background-color: rgba(255, 215, 0, 0.5);
    color: #000;
    transform: scale(1.1);
    box-shadow: 0 0 8px 3px rgba(255, 215, 0, 0.3);
  }
  100% { 
    background-color: rgba(255, 215, 0, 0.1);
    color: inherit;
    transform: scale(1);
    box-shadow: none;
  }
}

/* Pulsing animation for new best fitness */
@keyframes pulse-best {
  0% { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.7); }
  70% { box-shadow: 0 0 15px 10px rgba(255, 215, 0, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0); }
}

/* Special animation for the entire card when new best fitness is achieved */
@keyframes new-best-card {
  0% { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.7); }
  20% { box-shadow: 0 0 30px 15px rgba(255, 215, 0, 0.5); }
  70% { box-shadow: 0 0 15px 5px rgba(255, 215, 0, 0.3); }
  100% { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0); }
}

.flash-highlight {
  animation: flash-green 1s ease;
}

.flash-highlight-best {
  animation: flash-best 3s ease !important;
  font-weight: bold !important;
  border-radius: 4px;
  padding: 2px 4px;
}

.pulse-best {
  animation: pulse-best 3s infinite !important;
}

.new-best-fitness {
  animation: new-best-card 3s ease !important;
  border: 2px solid gold !important;
}

/* New Best Label styling */
.new-best-label {
  position: absolute;
  top: -18px;
  right: -15px;
  background-color: gold;
  color: black;
  font-weight: bold;
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 4px;
  box-shadow: 0 0 8px rgba(0,0,0,0.4);
  z-index: 10;
  transform: rotate(15deg);
  animation: pulseBestLabel 2s infinite;
}

/* Animation for the "NEW BEST" label */
@keyframes pulseBestLabel {
  0% { 
    transform: rotate(15deg) scale(1);
    box-shadow: 0 0 5px rgba(0,0,0,0.3);
  }
  50% { 
    transform: rotate(15deg) scale(1.1);
    box-shadow: 0 0 10px rgba(255,215,0,0.7);
  }
  100% { 
    transform: rotate(15deg) scale(1);
    box-shadow: 0 0 5px rgba(0,0,0,0.3);
  }
}

/* Highlight effect for UI updates */
@keyframes highlight-update {
  0% { background-color: rgba(255, 255, 0, 0); }
  30% { background-color: rgba(255, 255, 0, 0.3); }
  100% { background-color: rgba(255, 255, 0, 0); }
}

/* Special animation for generation counter */
@keyframes generation-update {
  0% { 
    background-color: rgba(0, 123, 255, 0); 
    transform: scale(1);
  }
  20% { 
    background-color: rgba(0, 123, 255, 0.2); 
    transform: scale(1.2);
  }
  100% { 
    background-color: rgba(0, 123, 255, 0); 
    transform: scale(1);
  }
}

/* Special animation for numerical value updates */
@keyframes value-update {
  0% { 
    color: inherit;
    transform: scale(1);
  }
  30% { 
    color: #007bff;
    transform: scale(1.15);
  }
  100% { 
    color: inherit;
    transform: scale(1);
  }
}

.highlight-update {
  animation: highlight-update 1.5s ease;
}

/* Apply special animation to generation text */
.generation-text.highlight-update {
  animation: generation-update 1.5s ease;
  font-weight: bold;
  color: #007bff;
}

/* Apply special animation to fitness values and metrics */
.best-fitness.highlight-update,
.avg-fitness.highlight-update,
.gen-time.highlight-update,
.elapsed-time.highlight-update {
  animation: value-update 1.5s ease;
  font-weight: bold;
}

/* Animation for session cards when updating */
.session-card.highlight-update {
  animation: highlight-update 1.5s ease;
  border: 2px solid #ffc107;
  transition: border-color 1.5s ease;
}

/* New animation for session card updates */
@keyframes session-card-flash {
  0% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.8); }
  70% { box-shadow: 0 0 25px 10px rgba(255, 193, 7, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0); }
}

/* Enhanced animation specifically for non-zero generation updates */
@keyframes non-zero-generation-flash {
  0% { box-shadow: 0 0 0 0 rgba(0, 123, 255, 0.9); }
  30% { box-shadow: 0 0 35px 15px rgba(0, 123, 255, 0.7); }
  70% { box-shadow: 0 0 25px 10px rgba(0, 123, 255, 0.4); }
  100% { box-shadow: 0 0 0 0 rgba(0, 123, 255, 0); }
}

.session-card-updated {
  animation: session-card-flash 1.5s ease;
  border: 2px solid #ffc107 !important;
}

/* Special styling for non-zero generation updates */
.non-zero-update {
  animation: non-zero-generation-flash 2.5s ease !important;
  border: 2px solid #007bff !important;
  transition: all 0.3s ease-in-out;
}

/* Animation for confirmed updates */
@keyframes confirmed-update-flash {
  0% { box-shadow: 0 0 0 0 rgba(0, 255, 0, 0.9); background-color: rgba(0, 255, 0, 0.1); }
  30% { box-shadow: 0 0 35px 15px rgba(0, 255, 0, 0.7); background-color: rgba(0, 255, 0, 0.2); }
  70% { box-shadow: 0 0 25px 10px rgba(0, 255, 0, 0.4); background-color: rgba(0, 255, 0, 0.1); }
  100% { box-shadow: 0 0 0 0 rgba(0, 255, 0, 0); background-color: transparent; }
}

.confirmed-update {
  animation: confirmed-update-flash 3s ease !important;
  border: 2px solid #00cc00 !important;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  body {
    background-color: #212529;
    color: #f8f9fa;
  }
  
  .card {
    background-color: #2c3034;
    border-color: #495057;
  }
  
  .card-header {
    background-color: #343a40;
    color: #f8f9fa;
  }
  
  .metric-box {
    background-color: #343a40;
    border-color: #495057;
  }
  
  .metric-label {
    color: #adb5bd;
  }
  
  .table {
    color: #f8f9fa;
  }
  
  .table-striped > tbody > tr:nth-of-type(odd) {
    background-color: rgba(255, 255, 255, 0.05);
    color: #f8f9fa;
  }
  
  .table-hover > tbody > tr:hover {
    background-color: rgba(255, 255, 255, 0.075);
    color: #f8f9fa;
  }
}

/* Animation for active sessions */
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.4);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(40, 167, 69, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(40, 167, 69, 0);
  }
}

.session-card {
  animation: pulse 2s infinite;
}

/* Hover effects for table rows */
.table-hover tbody tr:hover {
  transform: translateY(-1px);
  transition: all 0.2s ease;
}

/* Progress bar animation */
.progress-bar {
  transition: width 0.6s ease;
  animation: progress-bar-stripes 1s linear infinite;
}

/* Chart container styling */
.chart-container {
  height: 250px;
  margin-top: 15px;
  margin-bottom: 10px;
  position: relative;
  border-radius: 4px;
  background-color: rgba(0,0,0,0.02);
}

/* Better mobile responsiveness */
@media (max-width: 768px) {
  .metric-box {
    margin-bottom: 10px;
  }
  
  .metric-value {
    font-size: 1.2rem;
  }
  
  .chart-container {
    height: 200px;
  }
}

/* Enhanced strategy progress display */
.strategy-progress {
  padding: 4px 8px;
  border-radius: 4px;
  background-color: rgba(0, 123, 255, 0.1);
  border-left: 3px solid #007bff;
  font-weight: bold;
  color: #007bff !important;
  margin-top: 5px !important;
  transition: all 0.3s ease;
}

/* Animation for strategy progress updates */
@keyframes strategy-progress-update {
  0% { background-color: rgba(0, 123, 255, 0.1); }
  50% { background-color: rgba(0, 123, 255, 0.3); }
  100% { background-color: rgba(0, 123, 255, 0.1); }
}

.strategy-progress.highlight-update {
  animation: strategy-progress-update 1.5s ease;
}

/* Print styles */
@media print {
  .session-card {
    break-inside: avoid;
  }
  
  .chart-container {
    height: 200px;
  }
  
  .timestamp {
    color: #000 !important;
  }
}

/* Tooltip styles */
.custom-tooltip {
  position: absolute;
  background-color: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 5px 10px;
  border-radius: 4px;
  z-index: 100;
  font-size: 12px;
  max-width: 300px;
}

/* Loading indicator for page refreshes */
.loading-indicator {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 5px;
  background-color: #28a745;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

body.loading .loading-indicator {
  opacity: 1;
}

/* Status badges */
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 15px;
  color: white;
  font-weight: bold;
  font-size: 0.75rem;
  text-transform: uppercase;
}

.status-badge.active {
  background-color: #28a745;
}

.status-badge.completed {
  background-color: #007bff;
}

.status-badge.error {
  background-color: #dc3545;
}

/* Switch for toggling between light and dark mode */
.theme-switch-wrapper {
  display: flex;
  align-items: center;
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 1000;
}

.theme-switch {
  display: inline-block;
  height: 24px;
  position: relative;
  width: 44px;
}

.theme-switch input {
  display: none;
}

.slider {
  background-color: #ccc;
  bottom: 0;
  cursor: pointer;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
  transition: .4s;
  border-radius: 34px;
}

.slider:before {
  background-color: white;
  bottom: 4px;
  content: "";
  height: 16px;
  left: 4px;
  position: absolute;
  transition: .4s;
  width: 16px;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #2196F3;
}

input:checked + .slider:before {
  transform: translateX(20px);
}

.theme-icon {
  margin-left: 5px;
  font-size: 0.8rem;
}