/* ==========================================================================
   V2 STOCK PROFILE PAGE STYLES
   Uses CSS custom properties for dark/light theme support.
   Namespace: .v2-sp-stock
   ========================================================================== */

/* --------------------------------------------------------------------------
   MAIN WRAPPER
   -------------------------------------------------------------------------- */

.v2-sp-stock {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg);
  overflow: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* --------------------------------------------------------------------------
   STICKY HEADER
   -------------------------------------------------------------------------- */

.v2-sp-stock__header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  flex-shrink: 0;
}

.v2-sp-stock__header-main {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.v2-sp-stock__identity {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.v2-sp-stock__ticker-input {
  display: inline-flex;
  align-items: center;
  gap: 0;
}

.v2-sp-stock__input {
  width: 90px;
  padding: 6px 10px;
  font-size: 14px;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  border: 2px solid var(--accent);
  border-radius: 6px 0 0 6px;
  background: var(--bg);
  color: var(--text);
  text-transform: uppercase;
  outline: none;
  transition: border-color 0.2s;
}

.v2-sp-stock__input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(9, 100, 160, 0.15);
}

.v2-sp-stock__go-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border: 2px solid var(--accent);
  border-left: none;
  border-radius: 0 6px 6px 0;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}

.v2-sp-stock__go-btn:hover {
  background: var(--accent-weak, #0b7cc4);
}

.v2-sp-stock__name {
  font-size: 18px;
  font-weight: 500;
  color: var(--text);
  margin: 0;
  line-height: 1.2;
}

.v2-sp-stock__badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  background: rgba(9, 100, 160, 0.1);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.v2-sp-stock__website-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  transition: background 0.15s, border-color 0.15s;
}

.v2-sp-stock__website-link:hover {
  background: rgba(9, 100, 160, 0.06);
  border-color: var(--accent);
  text-decoration: none;
}

.v2-sp-stock__website-link i {
  font-size: 11px;
}

/* --------------------------------------------------------------------------
   STATS STRIP
   -------------------------------------------------------------------------- */

.v2-sp-stock__stats-strip {
  display: flex;
  gap: 20px;
  padding: 10px 0 0;
  border-top: 1px solid var(--border);
  overflow-x: auto;
  flex-wrap: nowrap;
}

.v2-sp-stock__stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 80px;
  flex-shrink: 0;
}

.v2-sp-stock__stat-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.v2-sp-stock__stat-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.v2-sp-stock__stat-value.positive { color: var(--success); }
.v2-sp-stock__stat-value.negative { color: var(--danger); }

/* --------------------------------------------------------------------------
   TAB BAR
   -------------------------------------------------------------------------- */

.v2-sp-stock__tabs {
  display: flex;
  gap: 4px;
  padding: 8px 24px 0;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  flex-shrink: 0;
}

.v2-sp-stock__tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
  white-space: nowrap;
}

.v2-sp-stock__tab:hover {
  color: var(--text);
  background: rgba(0, 0, 0, 0.03);
}

.v2-sp-stock__tab.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.v2-sp-stock__tab i {
  font-size: 13px;
}

/* --------------------------------------------------------------------------
   TAB CONTENT AREA
   -------------------------------------------------------------------------- */

.v2-sp-stock__content {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px 40px;
}

.v2-sp-stock__tab-view {
  display: block;
}

.v2-sp-stock__tab-view.is-hidden {
  display: none;
}

/* --------------------------------------------------------------------------
   LOADING & ERROR STATES
   -------------------------------------------------------------------------- */

.v2-sp-stock__loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 40px;
  color: var(--muted);
  font-size: 14px;
}

.v2-sp-stock__no-data {
  text-align: center;
  padding: 40px;
  color: var(--muted);
  font-style: italic;
}

.v2-sp-stock__error {
  color: var(--danger);
  padding: 20px;
  text-align: center;
}

/* --------------------------------------------------------------------------
   GRID LAYOUTS
   -------------------------------------------------------------------------- */

.v2-sp-stock__grid {
  display: grid;
  gap: 20px;
  margin-bottom: 20px;
}

.v2-sp-stock__grid--sidebar {
  grid-template-columns: 380px 1fr;
}

.v2-sp-stock__grid--2col {
  grid-template-columns: 1fr 1fr;
}

.v2-sp-stock__grid--dist {
  grid-template-columns: 2fr 1fr;
}

/* --------------------------------------------------------------------------
   OVERVIEW TAB: Company Details
   -------------------------------------------------------------------------- */

.v2-sp-stock__description {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  margin: 0 0 16px;
}

.v2-sp-stock__detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.v2-sp-stock__detail-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.v2-sp-stock__detail-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.v2-sp-stock__detail-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.v2-sp-stock__detail-value a {
  color: var(--accent);
  text-decoration: none;
}

.v2-sp-stock__detail-value a:hover {
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   OVERVIEW TAB: Summary Card hint text
   -------------------------------------------------------------------------- */

.v2-sp-stock__ov-hint {
  margin-top: auto;
  padding-top: 8px;
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
  line-height: 1.4;
}

/* --------------------------------------------------------------------------
   FINANCIALS TAB: Controls
   -------------------------------------------------------------------------- */

.v2-sp-stock__control-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.v2-sp-stock__control-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.v2-sp-stock__select {
  padding: 6px 28px 6px 10px;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  background-size: 16px;
  outline: none;
  transition: border-color 0.2s;
}

.v2-sp-stock__select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(9, 100, 160, 0.15);
}

/* --------------------------------------------------------------------------
   DISTRIBUTION CHARTS LAYOUT
   -------------------------------------------------------------------------- */

.v2-sp-stock__dist-charts {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* --------------------------------------------------------------------------
   RESPONSIVE
   -------------------------------------------------------------------------- */

@media (max-width: 1100px) {
  .v2-sp-stock__grid--sidebar {
    grid-template-columns: 1fr;
  }
  .v2-sp-stock__grid--dist {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .v2-sp-stock__grid--2col {
    grid-template-columns: 1fr;
  }
  .v2-sp-stock__header {
    padding: 12px 16px;
  }
  .v2-sp-stock__tabs {
    padding: 8px 16px 0;
  }
  .v2-sp-stock__content {
    padding: 16px;
  }
  .v2-sp-stock__tab span {
    display: none;
  }
  .v2-sp-stock__tab i {
    font-size: 16px;
  }
}

/* --------------------------------------------------------------------------
   DARK THEME OVERRIDES
   All colors above use CSS variables which auto-adapt, but a few
   specific values need explicit dark-theme treatment.
   -------------------------------------------------------------------------- */

.dark-theme .v2-sp-stock__badge {
  background: rgba(9, 100, 160, 0.2);
}

.dark-theme .v2-sp-stock__tab:hover {
  background: rgba(255, 255, 255, 0.05);
}

.dark-theme .v2-sp-stock__input {
  border-color: var(--accent);
}

/* Highcharts dark theme integration */
.dark-theme .v2-sp-stock .highcharts-background {
  fill: var(--bg-elev);
}

.dark-theme .v2-sp-stock .highcharts-title,
.dark-theme .v2-sp-stock .highcharts-subtitle {
  fill: var(--text) !important;
}

.dark-theme .v2-sp-stock .highcharts-axis-title,
.dark-theme .v2-sp-stock .highcharts-axis-labels text {
  fill: var(--muted) !important;
}

.dark-theme .v2-sp-stock .highcharts-grid-line {
  stroke: var(--border);
}

.dark-theme .v2-sp-stock .highcharts-tooltip-box {
  fill: var(--bg-elev);
  stroke: var(--border);
}

.dark-theme .v2-sp-stock .highcharts-label text {
  fill: var(--text) !important;
}

/* AG Grid dark theme integration */
.dark-theme .v2-sp-stock .ag-theme-balham {
  --ag-background-color: var(--bg-elev);
  --ag-header-background-color: var(--bg);
  --ag-odd-row-background-color: var(--bg);
  --ag-foreground-color: var(--text);
  --ag-secondary-foreground-color: var(--muted);
  --ag-border-color: var(--border);
  --ag-row-hover-color: rgba(255, 255, 255, 0.05);
}
