/* Social Sentiment Trend Widget Styles */

/* Proxima Nova Font Faces */
@font-face {
    font-family: 'Proxima Nova';
    src: url('../../web-fonts/fonts/proximanova-regular.woff2.woff') format('woff2'),
         url('../../web-fonts/fonts/proximanova-regular.woff.woff') format('woff');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Proxima Nova';
    src: url('../../web-fonts/fonts/proximanova-medium.woff2.woff') format('woff2'),
         url('../../web-fonts/fonts/proximanova-medium.woff.woff') format('woff');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Proxima Nova';
    src: url('../../web-fonts/fonts/proximanova-semibold.woff2.woff') format('woff2'),
         url('../../web-fonts/fonts/proximanova-semibold.woff.woff') format('woff');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Proxima Nova';
    src: url('../../web-fonts/fonts/proximanova-bold.woff2.woff') format('woff2'),
         url('../../web-fonts/fonts/proximanova-bold.woff.woff') format('woff');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--ibkr-font-family, 'Proxima Nova', Verdana, Arial, sans-serif);
}

html, body {
  color-scheme: only light; /* Force light mode — ignore OS preference */
}

body {
  background-color: var(--ibkr-bg-canvas, #f0f4fa);
}

.chart-card {
  background: #fff; /* IBKR @bg */
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  height: 100%;
  display: flex;
  flex-direction: column;
  border: 1px solid #e3dcdc;
  position: relative;
}

.chart-header {
  margin-bottom: 15px;
}

.chart-title-row {
  margin-bottom: 12px;
}

.chart-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 4px;
}

.chart-subtitle {
  font-size: 0.8125rem;
  color: #6b7280;
}

#subjectLabel {
  font-weight: 500;
  color: #374151;
}

#industryLabel {
  color: #9ca3af;
}

.header-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.button-group {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.period-btn {
  height: 28px;
  padding: 4px 12px;
  border: none;
  border-radius: 14px;
  background: transparent;
  color: #374151;
  font-size: 0.8125rem;
  font-weight: 400;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.period-btn:hover {
  background: #f3f4f6;
}

.period-btn.active {
  background: transparent;
  color: #374151;
  font-weight: 600;
}

.chart-container {
  flex: 1;
  min-height: 280px;
  margin-bottom: 0;
}

#sentimentChart {
  width: 100%;
  height: 100%;
}

.header-divider {
  width: 100%;
  height: 1px;
  background: rgba(200, 200, 200, 0.6);
  flex-shrink: 0;
}

.chart-legend {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-right: 80px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-color {
  width: 16px;
  height: 3px;
  border-radius: 1px;
}

.legend-label {
  font-size: 0.75rem;
  color: #6b7280;
  font-weight: 500;
}

/* Visual separator before the SV Score legend item */
.legend-item--panel {
  border-left: 1px solid rgba(200, 200, 200, 0.6);
  padding-left: 12px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .chart-card {
    padding: 15px;
  }
  
  .chart-title {
    font-size: 1rem;
  }
  
  .chart-subtitle {
    font-size: 0.75rem;
  }
  
  .header-controls {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .period-btn {
    height: 26px;
    padding: 4px 10px;
    font-size: 0.75rem;
  }
  
  .chart-container {
    min-height: 300px;
  }
  
  .chart-legend {
    gap: 10px;
    margin-right: 0;
  }
  
  .legend-label {
    font-size: 0.6875rem;
  }
}

/* Small screens - keep 300px height */
@media (max-width: 360px) {
  .chart-card {
    padding: 12px;
  }
  
  .chart-container {
    min-height: 300px;
  }
}

/* Loading state */
.chart-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 300px;
  color: #9ca3af;
  font-size: 0.875rem;
}

/* Error state */
.chart-error {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 300px;
  color: #dc2626;
  font-size: 0.875rem;
}

.error-message {
  position: absolute;
  inset: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #666;
  font-size: 0.875rem;
  text-align: center;
  padding: 20px;
  background: #fff;
  border: 1px solid #e3dcdc;
  border-radius: 8px;
  z-index: 10;
  box-sizing: border-box;
}

.error-icon {
  font-size: 1.5rem;
  margin-bottom: 10px;
}

/* Skeleton Loading */
@keyframes skeleton-shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position: 600px 0; }
}

.skeleton {
  background: linear-gradient(90deg, #f0f2f5 25%, #e4e7ec 50%, #f0f2f5 75%);
  background-size: 1200px 100%;
  animation: skeleton-shimmer 1.6s infinite linear;
  border-radius: 4px;
}

.skeleton-subtitle {
  height: 13px;
  width: 140px;
}

.chart-skeleton {
  width: 100%;
}

.skeleton-chart-area {
  width: 100%;
  height: 300px;
  border-radius: 4px;
}
