/* =============================================================================
   FormGeneratorReport - Generic Reporting Component
   ============================================================================= */

/* --- Container --- */

.reportContainer {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: 100%;
}

.reportHeader {
  margin-bottom: 0.5rem;
}

.reportTitle {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary, #e0e0e0);
  margin: 0 0 0.25rem 0;
}

.reportSubtitle {
  font-size: 0.875rem;
  color: var(--text-secondary, #888);
  margin: 0;
}

/* --- Toolbar (Filters + Period) --- */

.toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.75rem 1rem;
  background: var(--surface-color, #1e1e1e);
  border: 1px solid var(--border-color, #333);
  border-radius: 10px;
}

.toolbarGroup {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toolbarLabel {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary, #888);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.toolbarSeparator {
  width: 1px;
  height: 24px;
  background: var(--border-color, #333);
  margin: 0 0.25rem;
}

.select {
  padding: 0.375rem 0.625rem;
  border: 1px solid var(--border-color, #333);
  border-radius: 6px;
  background: var(--bg-secondary, #2a2a2a);
  color: var(--text-primary, #e0e0e0);
  font-size: 0.8125rem;
  cursor: pointer;
  min-width: 80px;
}

.select:focus {
  outline: none;
  border-color: var(--primary-color, #f25843);
}

.dateInput {
  padding: 0.375rem 0.625rem;
  border: 1px solid var(--border-color, #333);
  border-radius: 6px;
  background: var(--bg-secondary, #2a2a2a);
  color: var(--text-primary, #e0e0e0);
  font-size: 0.8125rem;
  cursor: pointer;
}

.dateInput:focus {
  outline: none;
  border-color: var(--primary-color, #f25843);
}

.textInput {
  padding: 0.375rem 0.625rem;
  border: 1px solid var(--border-color, #333);
  border-radius: 6px;
  background: var(--bg-secondary, #2a2a2a);
  color: var(--text-primary, #e0e0e0);
  font-size: 0.8125rem;
  min-width: 120px;
}

.textInput:focus {
  outline: none;
  border-color: var(--primary-color, #f25843);
}

/* --- Sections Grid --- */

.sectionsGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.sectionFull {
  grid-column: 1 / -1;
}

.sectionHalf {
  grid-column: span 1;
}

/* --- Section Card --- */

.sectionCard {
  background: var(--surface-color, #1e1e1e);
  border: 1px solid var(--border-color, #333);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
}

.sectionTitle {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary, #888);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 0.75rem 0;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}

.sectionDescription {
  font-size: 0.8125rem;
  color: var(--text-tertiary, #666);
  margin: -0.5rem 0 0.75rem 0;
}

/* --- KPI Grid --- */

.kpiGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}

.kpiCard {
  background: var(--surface-color, #1e1e1e);
  border: 1px solid var(--border-color, #333);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.kpiLabel {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary, #888);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.kpiValue {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary, #e0e0e0);
}

.kpiSubtitle {
  font-size: 0.75rem;
  color: var(--text-tertiary, #666);
}

/* --- Charts (recharts wrappers) --- */

.chartWrapper {
  width: 100%;
  height: 280px;
  min-height: 280px;
  min-width: 0;
}

.chartWrapperSmall {
  width: 100%;
  height: 250px;
  min-height: 250px;
  min-width: 0;
}

/* --- Horizontal Bar Chart --- */

.horizontalBarList {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.horizontalBarRow {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.horizontalBarLabel {
  width: 120px;
  font-size: 0.8125rem;
  color: var(--text-primary, #e0e0e0);
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  flex-shrink: 0;
}

.horizontalBarTrack {
  flex: 1;
  height: 22px;
  background: var(--bg-secondary, #2a2a2a);
  border-radius: 4px;
  overflow: hidden;
}

.horizontalBarFill {
  height: 100%;
  background: var(--primary-color, #f25843);
  border-radius: 4px;
  transition: width 0.3s ease;
  min-width: 4px;
}

.horizontalBarValue {
  width: 90px;
  text-align: right;
  font-size: 0.8125rem;
  color: var(--text-secondary, #888);
  font-family: monospace;
  flex-shrink: 0;
}

/* --- Table --- */

.reportTable {
  width: 100%;
  border-collapse: collapse;
}

.reportTable th {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary, #888);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.625rem 0.75rem;
  text-align: left;
  border-bottom: 2px solid var(--border-color, #333);
}

.reportTable td {
  font-size: 0.8125rem;
  color: var(--text-primary, #e0e0e0);
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border-color, #333);
}

.reportTable tr:last-child td {
  border-bottom: none;
}

.reportTable tr:hover td {
  background: var(--bg-secondary, #2a2a2a);
}

.alignRight {
  text-align: right;
}

.alignCenter {
  text-align: center;
}

.monoValue {
  font-family: monospace;
}

.showMoreRow {
  text-align: center;
  padding: 0.5rem;
}

.showMoreButton {
  background: none;
  border: none;
  color: var(--primary-color, #f25843);
  font-size: 0.8125rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
}

.showMoreButton:hover {
  text-decoration: underline;
}

/* --- Loading / No Data --- */

.loadingContainer {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: var(--text-secondary, #888);
  font-size: 0.875rem;
}

.noData {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  color: var(--text-tertiary, #666);
  font-size: 0.8125rem;
  font-style: italic;
}

/* --- Recharts Custom Tooltip --- */

.customTooltip {
  background: var(--surface-color, #1e1e1e);
  border: 1px solid var(--border-color, #333);
  border-radius: 8px;
  padding: 0.75rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.tooltipLabel {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary, #e0e0e0);
  margin-bottom: 0.25rem;
}

.tooltipValue {
  font-size: 0.8125rem;
  color: var(--text-secondary, #888);
}

.tooltipValue span {
  color: var(--text-primary, #e0e0e0);
  font-weight: 600;
}

/* --- Responsive --- */

@media (max-width: 768px) {
  .sectionsGrid {
    grid-template-columns: 1fr;
  }

  .sectionHalf {
    grid-column: span 1;
  }

  .toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .toolbarSeparator {
    width: 100%;
    height: 1px;
    margin: 0.25rem 0;
  }

  .kpiGrid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }

  .horizontalBarLabel {
    width: 80px;
    font-size: 0.75rem;
  }

  .horizontalBarValue {
    width: 70px;
    font-size: 0.75rem;
  }

  .chartWrapper {
    height: 220px;
  }
}
