/* Report Page Styles */
body {
  font-family: Arial, sans-serif;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid #e0e0e0;
}

.header h1 {
  font-size: 1.8rem;
  color: #333;
  margin: 0;
}

/* Filter Section */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 24px;
  padding: 16px;
  background: #f8f9fa;
  border-radius: 8px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #555;
}

.filter-select {
  padding: 8px 12px;
  font-size: 0.95rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: white;
  min-width: 150px;
  cursor: pointer;
}

.filter-select:focus {
  border-color: #007bff;
  outline: none;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.filter-input {
  padding: 8px 12px;
  font-size: 0.95rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: white;
  min-width: 150px;
}

.filter-input:focus {
  border-color: #007bff;
  outline: none;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.btn {
  padding: 10px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  background: #007bff;
  color: white;
}

.btn-primary:hover {
  background: #0056b3;
}

.btn-secondary {
  background: #6c757d;
  color: white;
}

.btn-secondary:hover {
  background: #5a6268;
}

/* Main Content - Side by Side Layout */
.report-main-content {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 24px;
  margin-bottom: 32px;
  align-items: start;
}

.summary-section {
  min-width: 0;
}

/* Summary Cards */
.summary-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.summary-card {
  display: flex;
  align-items: center;
  padding: 18px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border-left: 4px solid;
  transition: transform 0.2s, box-shadow 0.2s;
}

.summary-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.summary-card.pouch {
  border-left-color: #36a2eb;
}

.summary-card.chest {
  border-left-color: #9966ff;
}

.summary-card.web {
  border-left-color: #ff9f40;
}

.summary-card.coindonate {
  border-left-color: #ff6384;
}

.summary-card.account {
  border-left-color: #334155;
}

.summary-card.total {
  border-left-color: #4bc0c0;
}

.card-icon {
  font-size: 2rem;
  margin-right: 14px;
}

.card-content {
  flex: 1;
}

.card-title {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: #333;
}

.card-value.positive {
  color: #28a745;
}

.card-value.negative {
  color: #dc3545;
}

/* Chart Section */
.chart-section {
  background: white;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 32px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.chart-section.monthly-chart-section {
  background: linear-gradient(135deg, #f8f9fa 0%, #fff 100%);
  border: 1px solid #e0e8f0;
}

.chart-section h2 {
  font-size: 1.3rem;
  color: #333;
  margin: 0 0 20px 0;
  padding-bottom: 12px;
  border-bottom: 1px solid #eee;
}

.chart-container {
  position: relative;
  height: 400px;
  width: 100%;
}

/* Table Section */
.table-section {
  min-width: 0;
  overflow: auto;
  background: white;
  border-radius: 12px;
  padding: 24px;
  margin: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.table-section h2 {
  font-size: 1.3rem;
  color: #333;
  margin: 0 0 20px 0;
  padding-bottom: 12px;
  border-bottom: 1px solid #eee;
}

.table-container {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  min-width: 1320px;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th {
  background: #f8f9fa;
  padding: 12px;
  text-align: right;
  font-weight: 600;
  color: #555;
  border-bottom: 2px solid #e0e0e0;
  white-space: nowrap;
}

.data-table th.group-header {
  text-align: center;
  border-bottom: 1px solid #ddd;
}

.data-table th.period-header,
.data-table th.total-header {
  text-align: center;
  vertical-align: middle;
}

.data-table th.group-header.pouch-chest {
  background: rgba(54, 162, 235, 0.1);
  color: #2171b5;
}

.data-table th.group-header.web {
  background: rgba(255, 159, 64, 0.1);
  color: #d48806;
}

.data-table th.group-header.donate {
  background: rgba(255, 99, 132, 0.1);
  color: #c73a5b;
}

.data-table th.group-header.account {
  background: rgba(51, 65, 85, 0.1);
  color: #334155;
}

.data-table .subheader-row th {
  padding-top: 10px;
  padding-bottom: 10px;
  text-align: right;
  border-bottom: 2px solid #e0e0e0;
}

.data-table .subheader-row th:nth-child(-n + 3) {
  background: rgba(54, 162, 235, 0.05);
}

.data-table .subheader-row th:nth-child(n + 4):nth-child(-n + 6) {
  background: rgba(255, 159, 64, 0.05);
}

.data-table .subheader-row th:nth-child(n + 7):nth-child(-n + 9) {
  background: rgba(255, 99, 132, 0.05);
}

.data-table .subheader-row th:nth-child(n + 10) {
  background: rgba(51, 65, 85, 0.05);
}

.data-table td {
  padding: 12px;
  border-bottom: 1px solid #eee;
  vertical-align: middle;
}

.data-table tbody td:first-child,
.data-table tfoot td:first-child {
  text-align: left;
  white-space: nowrap;
}

.data-table tbody tr:hover {
  background: #f8f9fa;
}

.data-table .price {
  text-align: right;
  font-family: 'Roboto Mono', monospace;
  white-space: nowrap;
}

.data-table .amount {
  text-align: right;
  font-family: 'Roboto Mono', monospace;
}

.data-table .positive {
  color: #28a745;
  font-weight: 600;
}

.data-table .negative {
  color: #dc3545;
  font-weight: 600;
}

.data-table .total {
  font-weight: 700;
}

.data-table tfoot tr {
  background: #f0f7ff;
  font-weight: 600;
}

.data-table tfoot td {
  border-top: 2px solid #007bff;
  border-bottom: none;
}

.total-row td {
  background: linear-gradient(135deg, #f0f7ff 0%, #e8f4ff 100%);
}

/* Loading Spinner */
.loading-spinner {
  display: inline-block;
  width: 30px;
  height: 30px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #007bff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 10px;
}

.report-loading-cell,
.report-empty-cell,
.report-error-cell {
  padding: 40px !important;
  text-align: center;
}

.report-empty-cell {
  color: #666;
}

.report-error-cell {
  color: #dc3545;
  font-weight: 600;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Error Container */
.error-container {
  text-align: center;
  padding: 60px 20px;
}

.error-container h1 {
  color: #dc3545;
  margin-bottom: 16px;
}

.error-container pre {
  background: #f8f9fa;
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  text-align: left;
  margin: 20px 0;
}

/* Responsive Design */
@media (max-width: 992px) {
  .report-main-content {
    grid-template-columns: 1fr;
  }

  .summary-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-card {
    min-width: 200px;
  }
}

@media (max-width: 768px) {
  .container {
    padding: 12px;
  }

  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .header h1 {
    font-size: 1.4rem;
  }

  .filters {
    flex-direction: column;
    align-items: stretch;
  }

  .summary-cards {
    grid-template-columns: 1fr;
  }

  .summary-card {
    padding: 16px;
  }

  .card-icon {
    font-size: 2rem;
    margin-right: 12px;
  }

  .card-value {
    font-size: 1.3rem;
  }

  .chart-container {
    height: 300px;
  }

  .data-table {
    font-size: 0.8rem;
  }

  .data-table th,
  .data-table td {
    padding: 8px 6px;
  }
}

/* Print Styles */
@media print {
  .filters,
  .btn,
  .navbar {
    display: none !important;
  }

  .container {
    max-width: 100%;
  }

  .summary-card,
  .chart-section,
  .table-section {
    box-shadow: none;
    border: 1px solid #ddd;
    break-inside: avoid;
  }
}
