/* ============================================
   SHARED REPORT LAYOUT SYSTEM
   Sandhill Oil & Gas LTD
   ============================================ */

/* ===== REPORT LAYOUT WRAPPER ===== */
.report-layout {
  --report-blue: #0066cc;
  --report-divider-color: var(--border);
  --report-divider-main-width: 2px;
  --report-divider-section-width: 1.5px;
  --report-divider-group-width: 1px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 0 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ===== REPORT HEADER ===== */
.report-header {
  text-align: center;
  padding-bottom: 1.25rem;
  border-bottom: var(--report-divider-main-width, 2px) solid
    var(--report-divider-color, var(--border));
}

.report-header-company {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--report-blue, #0066cc);
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.report-header-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.75rem;
}

.report-header-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  font-size: 0.875rem;
  color: var(--muted);
  justify-content: space-between;
}

.report-header-meta-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-align: left;
}

.report-header-meta-item strong {
  color: var(--text);
  font-weight: 600;
}

.report-header-meta-item:last-child {
  margin-left: auto;
  text-align: right;
}

.report-header-extra {
  margin-top: 0.75rem;
  font-size: 0.75rem;
  color: var(--muted);
  text-align: left;
}

/* ===== REPORT DIVIDERS ===== */
.report-divider {
  border: 0;
  border-top: var(--report-divider-section-width, 1.5px) solid
    var(--report-divider-color, var(--border));
  margin: 0;
}

.report-divider--main {
  border-top-width: var(--report-divider-main-width, 2px);
}

.report-divider--group {
  border-top-width: var(--report-divider-group-width, 1px);
}

/* ===== EXECUTIVE SUMMARY BAND ===== */
.report-summary-band {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: var(--panel-2);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.report-summary-stat {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.report-summary-stat-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.report-summary-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.report-summary-stat-value.accent {
  color: var(--accent-2);
}

.report-summary-stat-value.muted {
  color: var(--muted);
  font-size: 1.25rem;
}

/* ===== NEW DECLUTTERED SUMMARY LAYOUT ===== */
.report-summary-section {
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: var(--panel-2);
  border-radius: 12px;
  border: 1px solid var(--border);
}

/* Primary KPIs Row */
.report-summary-primary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.report-summary-stat-primary {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.report-summary-stat-primary .report-summary-stat-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.report-summary-stat-primary .report-summary-stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.report-summary-stat-primary .report-summary-stat-value.accent {
  font-size: 2.25rem;
  color: var(--accent-2);
}

/* Secondary Breakdown Section */
.report-summary-secondary {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
}

.report-summary-group {
  flex: 1;
  min-width: 200px;
}

.report-summary-group-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.report-summary-group-items {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.report-summary-stat-secondary {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.report-summary-stat-label-secondary {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
}

.report-summary-stat-value-secondary {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* Insight Line */
.report-summary-insight {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--muted);
  font-style: italic;
  line-height: 1.5;
}

/* ===== CHART CONTAINER ===== */
.report-charts-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.report-chart-wrapper {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
}

.report-chart-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.report-chart-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  color: var(--muted);
  font-size: 0.875rem;
  font-style: italic;
}

/* ===== VIEW TOGGLE ===== */
.report-view-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: var(--panel-2);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.report-view-toggle {
  display: flex;
  gap: 0.5rem;
  background: var(--bg);
  border-radius: 6px;
  padding: 0.25rem;
  border: 1px solid var(--border);
}

.report-view-toggle button {
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
}

.report-view-toggle button:hover {
  color: var(--text);
  background: var(--panel);
}

.report-view-toggle button.active {
  background: var(--accent-2);
  color: white;
}

.report-export-buttons {
  display: flex;
  gap: 0.5rem;
}

.report-export-btn {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s;
}

.report-export-btn:hover {
  background: var(--panel-2);
  border-color: var(--accent-2);
  color: var(--accent-2);
}

/* ===== REPORT CONTROL LAYOUT ===== */
.report-controls {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.report-controls-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  align-items: end;
}

.report-controls-row--main {
  grid-template-columns: repeat(2, minmax(240px, 1fr));
}

.report-controls-row--secondary {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.report-controls-row--actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
}

.report-controls-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.report-controls-row--actions .report-export-buttons {
  margin-left: auto;
}

.report-controls-actions .btn,
.report-controls-row--actions .btn {
  min-width: 140px;
}

.report-controls-note {
  font-size: 0.75rem;
  color: var(--muted);
}

.report-results {
  margin-top: 1.5rem;
}

/* ===== TABLE CONTAINER ===== */
.report-table-container {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
}

.report-layout .report-table-wrapper,
.report-layout .coa-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
}

.report-layout .coa-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.report-layout .coa-table thead {
  background: var(--panel-2);
}

.report-layout .coa-table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  border-bottom: var(--report-divider-main-width, 2px) solid
    var(--report-divider-color, var(--border));
  white-space: nowrap;
}

.report-layout .coa-table td {
  padding: 0.75rem 1rem;
  color: var(--text);
  vertical-align: top;
}

.report-layout .coa-table tbody tr {
  border-bottom: 1px solid var(--border);
}

.report-layout .coa-table tbody tr:last-child {
  border-bottom: none;
}

.report-table thead {
  background: var(--panel-2);
  position: sticky;
  top: 0;
  z-index: 10;
}

.report-table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  border-bottom: var(--report-divider-main-width, 2px) solid
    var(--report-divider-color, var(--border));
  white-space: nowrap;
}

.report-table th.text-right {
  text-align: right;
}

.report-table th.text-center {
  text-align: center;
}

.report-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.report-table tbody tr:hover {
  background: var(--panel-2);
}

.report-table tbody tr:last-child {
  border-bottom: none;
}

.report-table td {
  padding: 0.75rem 1rem;
  color: var(--text);
  vertical-align: top;
}

.report-table td.text-right {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.report-table td.text-center {
  text-align: center;
}

.report-layout .coa-table .text-right {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.report-layout .coa-table .text-center {
  text-align: center;
}

.report-table td.empty {
  color: var(--muted);
  font-style: italic;
}

/* ===== GROUPED VIEW STYLES ===== */
.report-table-group {
  border-bottom: var(--report-divider-section-width, 1.5px) solid
    var(--report-divider-color, var(--border));
}

.report-table-group:last-child {
  border-bottom: none;
}

.report-table-group-header {
  background: var(--panel-2);
  font-weight: 600;
  border-bottom: var(--report-divider-group-width, 1px) solid
    var(--report-divider-color, var(--border));
}

.report-table-group-header td {
  padding: 1rem;
  color: var(--text);
}

.report-table-group-header .order-total {
  color: var(--accent-2);
  font-size: 1rem;
}

.report-table-group-header .data-inconsistent {
  font-size: 0.75rem;
  color: var(--warning, #f59e0b);
  font-weight: 500;
  margin-left: 0.5rem;
}

.report-table-group-lines {
  background: var(--panel);
}

.report-table-group-lines tr {
  border-bottom: var(--report-divider-group-width, 1px) solid
    var(--report-divider-color, var(--border));
}

.report-table-group-lines tr:last-child {
  border-bottom: none;
}

.report-table-group-lines td {
  padding-left: 2rem;
  color: var(--text);
}

/* ===== TOTAL ROWS ===== */
.report-table-total-row {
  background: var(--panel-2);
  font-weight: 700;
  border-top: var(--report-divider-main-width, 2px) solid
    var(--report-divider-color, var(--border));
  border-bottom: var(--report-divider-section-width, 1.5px) solid
    var(--report-divider-color, var(--border));
}

.report-table-total-row td {
  padding: 1rem;
  color: var(--text);
}

.report-table-total-row td.total-value {
  color: var(--accent-2);
  font-size: 1rem;
}

/* ===== EMPTY STATE ===== */
.report-empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--muted);
}

.report-empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.report-empty-state-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.report-empty-state-message {
  font-size: 0.875rem;
  color: var(--muted);
}

/* ============================================
   PRINT / PDF STYLES
   ============================================ */

@media print {
  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  body {
    background: white;
    color: #000;
  }

  .report-layout {
    --report-divider-color: #111;
    --report-blue: #0066cc;
  }

  .report-header {
    border-bottom: var(--report-divider-main-width, 2px) solid
      var(--report-divider-color, #111);
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
  }

  .report-header-company {
    color: var(--report-blue, #0066cc);
    font-size: 1.25rem;
  }

  .report-header-title {
    font-size: 1rem;
    color: #000;
  }

  .report-header-meta {
    font-size: 0.75rem;
    color: #666;
  }

  .report-summary-band {
    background: #f5f5f5;
    border: 1px solid #ddd;
    page-break-inside: avoid;
  }

  .report-summary-stat-value {
    color: #000;
  }

  .report-summary-stat-value.accent {
    color: #000;
  }

  .report-view-controls,
  .report-export-buttons {
    display: none;
  }

  .report-charts-container {
    display: none;
  }

  .report-table-container {
    border: 1px solid #111;
    page-break-inside: avoid;
  }

  .report-table {
    font-size: 0.75rem;
  }

  .report-table thead {
    background: #f5f5f5;
    display: table-header-group;
  }

  .report-table th {
    background: #f5f5f5;
    color: #000;
    border-bottom: var(--report-divider-main-width, 2px) solid #111;
    padding: 0.5rem;
  }

  .report-table tbody tr {
    border-bottom: 1px solid #ddd;
    page-break-inside: avoid;
  }

  .report-table td {
    padding: 0.5rem;
    color: #000;
  }

  .report-table-group-header {
    background: #f5f5f5;
    border-bottom: var(--report-divider-group-width, 1px) solid #111;
  }

  .report-table-group-lines {
    background: white;
  }

  .report-table-total-row {
    background: #f5f5f5;
    border-top: var(--report-divider-main-width, 2px) solid #111;
    border-bottom: var(--report-divider-section-width, 1.5px) solid #111;
  }

  .report-table-total-row td {
    color: #000;
    font-weight: 700;
  }

  @page {
    margin: 1.5cm;
    size: A4;
  }

  .report-table thead {
    position: static;
  }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .report-summary-band {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    padding: 1rem;
  }

  .report-summary-stat-value {
    font-size: 1.25rem;
  }

  /* New decluttered layout responsive */
  .report-summary-primary {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }

  .report-summary-stat-primary .report-summary-stat-value {
    font-size: 1.5rem;
  }

  .report-summary-stat-primary .report-summary-stat-value.accent {
    font-size: 1.75rem;
  }

  .report-summary-secondary {
    flex-direction: column;
    gap: 1.5rem;
  }

  .report-view-controls {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }

  .report-export-buttons {
    flex-wrap: wrap;
  }

  .report-controls-row {
    grid-template-columns: 1fr;
  }

  .report-controls-row--actions {
    align-items: stretch;
  }

  .report-controls-row--actions .report-export-buttons {
    margin-left: 0;
    justify-content: flex-start;
  }

  .report-table {
    font-size: 0.75rem;
  }

  .report-table th,
  .report-table td {
    padding: 0.5rem;
  }

  .report-table-group-lines td {
    padding-left: 1rem;
  }
}
