/* Live Feed Panel Styles */
.live-feed-panel {
  display: none;
  background: var(--card-bg);
  border: 1px solid var(--secondary-border-color);
  border-radius: 8px;
  padding: 0;
  margin-top: 4px;
  margin-bottom: 1px;
  height: 210px; /* Optimized height for chart with labels */
  overflow: visible; /* Allow labels to show */
  position: relative;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

/* Light mode live feed panel */
html.light .live-feed-panel {
  border: 1px solid rgba(0, 0, 0, 0.15);
}

/* Panel Layout - Two sections side by side */
.live-feed-content {
  display: flex;
  height: 100%;
  gap: 1px;
}

/* Technical Data Section */
.technical-data-section {
  flex: 0 0 40%;
  background: var(--secondary-bg);
  border-radius: 8px 0 0 8px;
  padding: 8px;
  overflow-y: auto;
  border-right: 1px solid var(--border-color);
}

/* Light mode technical data section */
html.light .technical-data-section {
  border-right: 1px solid rgba(0, 0, 0, 0.15);
}

.technical-data-header {
  font-size: 0.85em;
  font-weight: 600;
  color: var(--text-color);
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Light mode technical data header */
html.light .technical-data-header {
  border-bottom: 1px solid rgba(0, 0, 0, 0.15);
}

.technical-data-header svg {
  width: 16px;
  height: 16px;
  color: var(--accent-color);
}

/* Technical Data Grid */
.technical-data-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  max-height: calc(100% - 35px); /* Reserve space for header */
  overflow-y: auto;
}

/* For larger screens, try to fit all items without scrolling */
@media (min-width: 1200px) {
  .technical-data-grid {
    gap: 4px;
  }
  
  .technical-data-item {
    padding: 3px 5px;
  }
  
  .technical-data-label {
    font-size: 0.68em;
  }
  
  .technical-data-value {
    font-size: 0.72em;
  }
}

/* Medium screens optimization */
@media (min-width: 769px) and (max-width: 1199px) {
  .technical-data-section {
    flex: 0 0 38%; /* Slightly smaller to give more room to chart */
  }
  
  .technical-data-grid {
    gap: 4px;
  }
  
  .technical-data-item {
    padding: 3px 5px;
  }
  
  .technical-data-label {
    font-size: 0.65em;
  }
  
  .technical-data-value {
    font-size: 0.7em;
  }
}

.technical-data-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 6px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.04) 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  transition: all 0.2s ease;
}

/* Light mode technical data item */
html.light .technical-data-item {
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.03) 0%, rgba(0, 0, 0, 0.01) 100%);
  border: 1px solid rgba(0, 0, 0, 0.15);
}

.technical-data-item:hover {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.08) 100%);
  border-color: var(--accent-color);
  transform: translateY(-1px);
}

/* Light mode technical data item hover */
html.light .technical-data-item:hover {
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.06) 0%, rgba(0, 0, 0, 0.03) 100%);
  border-color: var(--accent-color);
}

.technical-data-label {
  font-size: 0.7em;
  color: var(--secondary-text);
  font-weight: 500;
}

.technical-data-value {
  font-size: 0.75em;
  font-weight: 600;
  color: var(--text-color);
}

/* Special styling for different data types */
.technical-data-value.positive {
  color: #22c55e;
}

.technical-data-value.negative {
  color: #ef4444;
}

.technical-data-value.neutral {
  color: var(--text-color);
}

/* Loading state styling */
.technical-data-value.loading {
  color: var(--accent-color);
  font-style: italic;
  animation: pulse 1.5s ease-in-out infinite;
}

/* Fetching state styling (priority fetch in progress) */
.technical-data-value.fetching {
  color: #3b82f6;
  font-style: italic;
  animation: pulse 1s ease-in-out infinite;
}

/* Refresh state styling (user should refresh) */
.technical-data-value.refresh {
  color: #f59e0b;
  font-style: italic;
  cursor: pointer;
  text-decoration: underline;
}

.technical-data-value.refresh:hover {
  color: #d97706;
}

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

/* Chart Section */
.chart-section {
  flex: 1;
  background: var(--card-bg);
  border-radius: 0 8px 8px 0;
  position: relative;
  overflow: visible; /* Allow labels to show */
}

.chart-section-header {
  position: absolute;
  top: 8px;
  left: 12px;
  right: 12px;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chart-title {
  font-size: 0.85em;
  font-weight: 600;
  color: var(--text-color);
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.7);
  padding: 4px 8px;
  border-radius: 6px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Light mode chart title */
html.light .chart-title {
  background: rgba(255, 255, 255, 0.9);
  color: var(--text-color);
}

.chart-title svg {
  width: 14px;
  height: 14px;
  color: var(--accent-color);
}

.chart-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.chart-toggle-btn {
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 4px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Light mode chart toggle button */
html.light .chart-toggle-btn {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.2);
  color: #374151;
}

.chart-toggle-btn:hover {
  background: rgba(59, 130, 246, 0.9);
  border-color: rgba(59, 130, 246, 0.6);
  color: white;
  transform: translateY(-1px);
}

.chart-toggle-btn svg {
  width: 16px;
  height: 16px;
}

/* Chart Container */
.live-feed-chart-container {
  width: 100%;
  height: 100%;
  position: relative;
}

.live-feed-chart-inner {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding-top: 35px; /* Space for "Live Chart" header */
  padding-bottom: 5px; /* Minimal bottom padding */
  display: flex;
  flex-direction: column;
  overflow: visible; /* Allow labels to show */
}

.live-feed-chart-canvas {
  width: 100% !important;
  max-height: 165px !important; /* Optimized height for better fit */
  display: block;
}

.live-feed-chart-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--secondary-text);
  font-size: 0.85em;
  text-align: center;
  flex-direction: column;
  gap: 8px;
}

.live-feed-chart-placeholder svg {
  width: 32px;
  height: 32px;
  opacity: 0.5;
}

/* Modern chart placeholder styles */
.chart-placeholder-modern {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 32px 16px;
  color: var(--secondary-text);
  text-align: center;
  height: 100%;
}

.chart-placeholder-modern svg {
  width: 48px;
  height: 48px;
  opacity: 0.6;
  animation: pulse-subtle 2s ease-in-out infinite;
}

.chart-placeholder-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chart-placeholder-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-color);
}

.chart-placeholder-subtitle {
  font-size: 13px;
  color: var(--secondary-text);
}

@keyframes pulse-subtle {
  0%, 100% {
    opacity: 0.6;
  }
  50% {
    opacity: 0.3;
  }
}

/* Light mode adjustments */
html.light .chart-placeholder-modern svg {
  opacity: 0.5;
}

html.light .chart-placeholder-title {
  color: var(--text-color);
}

html.light .chart-placeholder-subtitle {
  color: var(--secondary-text);
}

/* Responsive Design */
@media (max-width: 768px) {
  .live-feed-panel {
    height: 190px; /* Optimized for mobile */
  }
  
  .live-feed-content {
    flex-direction: row; /* Keep side by side on mobile */
    gap: 1px;
  }
  
  .technical-data-section {
    flex: 0 0 45%; /* Slightly larger for mobile */
    border-radius: 8px 0 0 8px;
    border-right: 1px solid var(--border-color);
    border-bottom: none;
    padding: 6px;
  }
  
  /* Light mode mobile technical data section */
  html.light .technical-data-section {
    border-right: 1px solid rgba(0, 0, 0, 0.15);
    border-bottom: none;
  }
  
  .chart-section {
    flex: 1;
    border-radius: 0 8px 8px 0;
  }
  
  .technical-data-header {
    font-size: 0.75em;
    margin-bottom: 6px;
    padding-bottom: 3px;
  }
  
  .technical-data-grid {
    grid-template-columns: 1fr; /* Single column for mobile to fit more data */
    gap: 3px;
  }
  
  .technical-data-item {
    padding: 3px 4px;
  }
  
  .technical-data-label {
    font-size: 0.6em;
  }
  
  .technical-data-value {
    font-size: 0.65em;
  }
  
  .chart-section-header {
    top: 4px;
    left: 6px;
    right: 6px;
  }
  
  .chart-title {
    font-size: 0.7em;
    padding: 2px 4px;
  }
  
  .chart-title svg {
    width: 12px;
    height: 12px;
  }
  
  .chart-toggle-btn {
    padding: 2px;
  }
  
  .chart-toggle-btn svg {
    width: 12px;
    height: 12px;
  }
  
  .live-feed-chart-inner {
    padding: 28px 6px 6px 6px;
  }
}

@media (max-width: 480px) {
  .live-feed-panel {
    height: 170px; /* Optimized for small mobile */
  }
  
  .technical-data-section {
    flex: 0 0 42%; /* Slightly smaller on very small screens */
    padding: 4px;
  }
  
  .technical-data-header {
    font-size: 0.7em;
    margin-bottom: 4px;
    padding-bottom: 2px;
  }
  
  .technical-data-header svg {
    width: 12px;
    height: 12px;
  }
  
  .technical-data-grid {
    gap: 2px;
  }
  
  .technical-data-item {
    padding: 2px 3px;
  }
  
  .technical-data-label {
    font-size: 0.55em;
  }
  
  .technical-data-value {
    font-size: 0.6em;
  }
  
  .chart-section-header {
    top: 3px;
    left: 4px;
    right: 4px;
  }
  
  .chart-title {
    font-size: 0.65em;
    padding: 2px 3px;
  }
  
  .chart-title svg {
    width: 10px;
    height: 10px;
  }
  
  .chart-toggle-btn {
    padding: 2px;
  }
  
  .chart-toggle-btn svg {
    width: 10px;
    height: 10px;
  }
  
  .live-feed-chart-inner {
    padding: 24px 4px 4px 4px;
  }
}

/* Ultra small screens */
@media (max-width: 360px) {
  .live-feed-panel {
    height: 160px; /* Optimized for ultra small */
  }
  
  .technical-data-section {
    flex: 0 0 40%; /* Balanced split for ultra small screens */
    padding: 3px;
  }
  
  .technical-data-header {
    font-size: 0.65em;
    margin-bottom: 3px;
    padding-bottom: 1px;
  }
  
  .technical-data-header svg {
    width: 10px;
    height: 10px;
  }
  
  .technical-data-grid {
    gap: 1px;
  }
  
  .technical-data-item {
    padding: 1px 2px;
  }
  
  .technical-data-label {
    font-size: 0.5em;
  }
  
  .technical-data-value {
    font-size: 0.55em;
  }
  
  .chart-section-header {
    top: 2px;
    left: 3px;
    right: 3px;
  }
  
  .chart-title {
    font-size: 0.6em;
    padding: 1px 2px;
  }
  
  .chart-title svg {
    width: 8px;
    height: 8px;
  }
  
  .chart-toggle-btn {
    padding: 1px;
  }
  
  .chart-toggle-btn svg {
    width: 8px;
    height: 8px;
  }
  
  .live-feed-chart-inner {
    padding: 20px 3px 3px 3px;
  }
}

/* Loading States */
.technical-data-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--secondary-text);
  font-size: 0.85em;
  flex-direction: column;
  gap: 8px;
}

.technical-data-loading .loading-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-top: 2px solid var(--accent-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Error States */
.technical-data-error {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #ef4444;
  font-size: 0.85em;
  text-align: center;
  flex-direction: column;
  gap: 8px;
}

.technical-data-error svg {
  width: 24px;
  height: 24px;
  opacity: 0.7;
}

/* Scrollbar Styling */
.technical-data-section::-webkit-scrollbar {
  width: 4px;
}

.technical-data-section::-webkit-scrollbar-track {
  background: transparent;
}

.technical-data-section::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 2px;
}

.technical-data-section::-webkit-scrollbar-thumb:hover {
  background: var(--accent-color);
}

/* Animation for data updates */
.technical-data-item.updated {
  animation: dataUpdate 0.5s ease-out;
}

@keyframes dataUpdate {
  0% {
    background: rgba(59, 130, 246, 0.3);
    transform: scale(1.02);
  }
  100% {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.04) 100%);
    transform: scale(1);
  }
}

/* Light mode data update animation */
html.light .technical-data-item.updated {
  animation: dataUpdateLight 0.5s ease-out;
}

@keyframes dataUpdateLight {
  0% {
    background: rgba(59, 130, 246, 0.2);
    transform: scale(1.02);
  }
  100% {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.03) 0%, rgba(0, 0, 0, 0.01) 100%);
    transform: scale(1);
  }
}