/* industry.css — Industry Aggregate section styles */

/* Industry section container */
#industrySection {
  display: none;
  padding: 20px;
  max-width: 100%;
}

#industrySection.active {
  display: block;
}

/* Industry nav link */
#industryLink {
  display: none;
}

/* Toggle buttons */
.industry-toggle-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.industry-toggle-btn {
  padding: 8px 16px;
  border: 1px solid #8a9bb5;
  background: #e8edf5;
  color: #1a2e4a;
  cursor: pointer;
  border-radius: 4px;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.industry-toggle-btn.active {
  background: #d4a843;
  color: #1a2e4a;
  border-color: #d4a843;
  font-weight: bold;
}

.industry-toggle-btn:hover {
  border-color: var(--accent, #d4a843);
}

/* Last updated + actions bar */
.industry-meta-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  flex-wrap: wrap;
  gap: 10px;
}

.industry-last-updated {
  color: #2a4a6a;
  font-size: 0.85rem;
}

.industry-actions {
  display: flex;
  gap: 8px;
}

.industry-action-btn {
  padding: 6px 12px;
  border: 1px solid #8a9bb5;
  background: #e8edf5;
  color: #1a2e4a;
  cursor: pointer;
  border-radius: 4px;
  font-size: 0.85rem;
}

.industry-action-btn:hover {
  border-color: #d4a843;
  color: #d4a843;
}

/* Chart */
.industry-chart-container {
  margin-bottom: 20px;
  padding: 15px;
  background: #f0f3f8;
  border-radius: 8px;
  border: 1px solid #c5d0e0;
}

/* Chart metric selector bar */
.industry-chart-selectors {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.industry-metric-selector {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 200px;
}

.industry-metric-selector label {
  font-size: 0.75rem;
  color: #2a4a6a;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.industry-metric-selector select {
  padding: 6px 8px;
  background: #ffffff;
  color: #1a2e4a;
  border: 1px solid #a0b0c8;
  border-radius: 4px;
  font-size: 0.85rem;
  cursor: pointer;
  max-width: 300px;
}

.industry-metric-selector select:hover {
  border-color: #d4a843;
}

.industry-metric-selector select:focus {
  border-color: #d4a843;
  outline: none;
}

.industry-metric-selector select option {
  background: #ffffff;
  color: #1a2e4a;
}

/* Chart wrapper — expandable */
.industry-chart-wrap {
  position: relative;
  height: 400px;
  transition: height 0.3s ease;
  margin-bottom: 10px;
}

.industry-chart-wrap.expanded {
  height: 700px;
}

.industry-chart-wrap canvas {
  max-height: 100%;
}

/* Chart expand button */
.industry-chart-expand-btn {
  position: absolute;
  top: 5px;
  right: 10px;
  padding: 4px 12px;
  border: 1px solid #8a9bb5;
  background: #e8edf5;
  color: #1a2e4a;
  cursor: pointer;
  border-radius: 4px;
  font-size: 0.8rem;
  z-index: 2;
  transition: all 0.2s;
}

.industry-chart-expand-btn:hover {
  border-color: #d4a843;
  color: #d4a843;
}

/* Tearsheet table */
.industry-table-header-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.industry-table-title {
  color: #1a3a5a;
  margin: 20px 0 10px 0;
  font-size: 1.1rem;
}

.industry-popout-btn {
  margin-bottom: 8px;
  padding: 4px 12px;
  border: 1px solid #8a9bb5;
  background: #e8edf5;
  color: #1a2e4a;
  cursor: pointer;
  border-radius: 4px;
  font-size: 0.8rem;
}

.industry-popout-btn:hover {
  border-color: #d4a843;
  color: #d4a843;
}

.industry-scroll-hint {
  color: #2a4a6a;
  font-size: 0.8rem;
  font-style: italic;
  padding: 4px 0 8px 0;
  animation: industryHintFade 4s ease-in-out infinite;
}

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

.industry-table-wrap {
  overflow-x: auto;
  margin-bottom: 20px;
}

.industry-tearsheet-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  min-width: 1200px;
  color: #1a2e4a;
  background: #ffffff;
}

.industry-tearsheet-table th {
  background: #d9e2ef;
  color: #1a3a5a;
  padding: 8px 6px;
  text-align: right;
  border-bottom: 2px solid #a0b0c8;
  position: sticky;
  top: 0;
  z-index: 1;
}

.industry-tearsheet-table th.col-sort,
.industry-tearsheet-table th.col-group,
.industry-tearsheet-table th.col-metric,
.industry-tearsheet-table th.col-unit,
.industry-tearsheet-table th.col-agg {
  text-align: left;
}

.industry-tearsheet-table th.col-year {
  text-align: right;
  min-width: 80px;
}

.industry-tearsheet-table td {
  padding: 5px 6px;
  border-bottom: 1px solid #e0e6f0;
  text-align: right;
  color: #1a2e4a;
}

.industry-tearsheet-table td.col-sort,
.industry-tearsheet-table td.col-group,
.industry-tearsheet-table td.col-metric,
.industry-tearsheet-table td.col-unit,
.industry-tearsheet-table td.col-agg-method {
  text-align: left;
}

/* Alternating row backgrounds */
.industry-tearsheet-table tbody tr:nth-child(even) {
  background: #f5f8fc;
}

.industry-tearsheet-table tbody tr:hover {
  background: #eef3fa;
}

/* Aggregation method badges */
.industry-tearsheet-table td.col-agg-method {
  white-space: nowrap;
  font-size: 0.75rem;
  padding: 2px 8px;
}

.industry-tearsheet-table td.agg-sum {
  color: #5dade2;
  font-weight: bold;
}

.industry-tearsheet-table td.agg-recomputed {
  color: #d4a843;
  font-weight: bold;
}

.industry-tearsheet-table td.agg-average {
  color: #58d68d;
  font-weight: bold;
}

.industry-tearsheet-table td.agg-direct {
  color: #2a4a6a;
}

.industry-tearsheet-table td.col-metric {
  white-space: nowrap;
}

.industry-tearsheet-table td.null-val {
  color: #8a9bb5;
  opacity: 0.5;
}

.industry-tearsheet-table tr.industry-group-header td {
  background: #e0e8f5;
  color: #1a3a5a;
  font-weight: bold;
  font-size: 0.9rem;
  padding: 6px 8px;
}

/* Individual company tearsheet */
.industry-individual-tearsheet {
  margin-top: 20px;
  padding: 15px;
  background: #f0f3f8;
  border-radius: 8px;
  border: 1px solid #c5d0e0;
}

/* Company list */
.industry-company-group {
  margin-bottom: 15px;
}

.industry-company-group h4 {
  color: #1a3a5a;
  margin: 0 0 8px 0;
  font-size: 0.95rem;
}

.industry-company-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  border-bottom: 1px solid #e0e6f0;
}

.industry-company-name {
  font-size: 0.85rem;
  color: #1a2e4a;
}

.industry-load-btn {
  padding: 4px 10px;
  font-size: 0.8rem;
  border: 1px solid #8a9bb5;
  background: #e8edf5;
  color: #1a2e4a;
  cursor: pointer;
  border-radius: 3px;
}

.industry-load-btn:hover {
  border-color: #d4a843;
  color: #d4a843;
}

/* No data message */
.industry-no-data {
  color: #2a4a6a;
  font-style: italic;
  padding: 20px;
}

/* Group section (by-industry view) */
.industry-group-section {
  margin-bottom: 30px;
}

/* Responsive: collapse year columns into rows on mobile */
@media (max-width: 768px) {
  .industry-tearsheet-table {
    min-width: 100%;
  }

  .industry-tearsheet-table thead {
    display: none;
  }

  .industry-tearsheet-table,
  .industry-tearsheet-table tbody,
  .industry-tearsheet-table tr,
  .industry-tearsheet-table td {
    display: block;
    width: 100%;
  }

  .industry-tearsheet-table tr {
    margin-bottom: 10px;
    border: 1px solid #c5d0e0;
    border-radius: 4px;
    padding: 5px;
    background: #f0f3f8;
  }

  .industry-tearsheet-table tr.industry-group-header {
    background: #e0e8f5;
    margin-top: 15px;
  }

  .industry-tearsheet-table tr.industry-group-header td {
    font-size: 1rem;
  }

  .industry-tearsheet-table td {
    text-align: left;
    padding: 3px 8px;
    border-bottom: none;
  }

  .industry-tearsheet-table td.col-sort,
  .industry-tearsheet-table td.col-group {
    display: none;
  }

  .industry-tearsheet-table td.col-metric {
    font-weight: bold;
    color: #1a3a5a;
  }

  .industry-tearsheet-table td.col-unit {
    display: inline-block;
    font-size: 0.75rem;
    color: #2a4a6a;
  }

  .industry-tearsheet-table td.col-year::before {
    content: attr(data-year) ": ";
    color: #2a4a6a;
  }
}

/* Print styles */
@media print {
  #industrySection {
    display: block !important;
  }

  .top-nav, .company-nav, .theme-selector, .auth-prompt,
  .loading-overlay, #heroSection, #mainContent,
  .industry-toggle-bar, .industry-actions, .industry-load-btn,
  #industryCompaniesList, #industryIndividualContainer {
    display: none !important;
  }

  .industry-tearsheet-table {
    font-size: 0.7rem;
    min-width: 100%;
  }

  .industry-tearsheet-table th,
  .industry-tearsheet-table td {
    padding: 2px 3px;
  }
}