/* Billing Pages Styles */

/* ============================================================================
   PAGE LAYOUT
   ============================================================================ */

.billingDashboard {
  padding: 1.5rem;
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.pageHeader {
  margin-bottom: 2rem;
}

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

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

/* ============================================================================
   SECTIONS
   ============================================================================ */

.section {
  margin-bottom: 2rem;
}

.sectionHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.sectionTitle {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary, #e0e0e0);
  margin: 0 0 1rem 0;
}

.sectionHeader .sectionTitle {
  margin-bottom: 0;
}

/* ============================================================================
   BALANCE CARDS
   ============================================================================ */

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

.balanceCard {
  background: var(--surface-color, #1e1e1e);
  border: 1px solid var(--border-color, #333);
  border-radius: 12px;
  padding: 1.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.balanceCard:hover {
  border-color: var(--primary-color, #f25843);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.balanceCard.warning {
  border-color: #ffc107;
  background: rgba(255, 193, 7, 0.1);
}

.balanceHeader {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

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

.billingModel {
  font-size: 0.75rem;
  color: var(--text-secondary, #888);
  background: var(--bg-secondary, #2a2a2a);
  padding: 2px 8px;
  border-radius: 4px;
}

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

.warningBadge {
  display: inline-block;
  font-size: 0.75rem;
  color: #856404;
  background: rgba(255, 193, 7, 0.3);
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 500;
}

/* ============================================================================
   KPI CARDS
   ============================================================================ */

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

.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 GRID
   ============================================================================ */

.chartsGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 1.5rem;
}

/* ============================================================================
   TIME SERIES CHART
   ============================================================================ */

.timeSeriesChart {
  padding: 0.5rem 0;
}

.timeSeriesBars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 200px;
  padding-bottom: 24px;
  position: relative;
}

.timeSeriesBarWrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}

.timeSeriesBarOuter {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.timeSeriesBar {
  width: 80%;
  max-width: 40px;
  background: var(--primary-color, #f25843);
  border-radius: 4px 4px 0 0;
  min-height: 2px;
  transition: height 0.3s ease;
  cursor: pointer;
}

.timeSeriesBar:hover {
  opacity: 0.8;
}

.timeSeriesLabel {
  font-size: 0.6875rem;
  color: var(--text-secondary, #888);
  margin-top: 4px;
  white-space: nowrap;
}

/* ============================================================================
   SUMMARY TABLE
   ============================================================================ */

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

.summaryRow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.625rem 0.75rem;
  background: var(--bg-secondary, #2a2a2a);
  border-radius: 6px;
  font-size: 0.875rem;
}

.summaryRow span {
  color: var(--text-secondary, #888);
}

.summaryRow strong {
  color: var(--text-primary, #e0e0e0);
  font-family: monospace;
}

/* ============================================================================
   STATISTICS
   ============================================================================ */

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

.select {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color, #333);
  border-radius: 6px;
  background: var(--surface-color, #1e1e1e);
  color: var(--text-primary, #e0e0e0);
  font-size: 0.875rem;
  cursor: pointer;
}

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

.statisticsChart {
  background: var(--surface-color, #1e1e1e);
  border: 1px solid var(--border-color, #333);
  border-radius: 12px;
  padding: 1.5rem;
}

.totalCost {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.5rem;
  background: var(--bg-secondary, #2a2a2a);
  border-radius: 8px;
  margin-bottom: 1.5rem;
}

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

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

.chartSection {
  margin-bottom: 1.5rem;
}

.chartSection:last-child {
  margin-bottom: 0;
}

.chartSection h4 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary, #888);
  margin: 0 0 1rem 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

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

.barLabel {
  width: 100px;
  font-size: 0.875rem;
  color: var(--text-primary, #e0e0e0);
  text-transform: capitalize;
}

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

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

.barValue {
  width: 100px;
  text-align: right;
  font-size: 0.875rem;
  color: var(--text-secondary, #888);
  font-family: monospace;
}

.featureList {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.featureRow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem;
  background: var(--bg-secondary, #2a2a2a);
  border-radius: 4px;
}

.featureLabel {
  font-size: 0.875rem;
  color: var(--text-primary, #e0e0e0);
  text-transform: capitalize;
}

.featureValue {
  font-size: 0.875rem;
  color: var(--text-secondary, #888);
  font-family: monospace;
}

/* ============================================================================
   TRANSACTIONS
   ============================================================================ */

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

.transactionsTable th,
.transactionsTable td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color, #333);
}

.transactionsTable th {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary, #888);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--bg-secondary, #2a2a2a);
}

.transactionsTable td {
  font-size: 0.875rem;
  color: var(--text-primary, #e0e0e0);
}

.transactionType {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

.transactionType.credit {
  background: rgba(40, 167, 69, 0.1);
  color: #28a745;
}

.transactionType.debit {
  background: rgba(220, 53, 69, 0.1);
  color: #dc3545;
}

.transactionType.adjustment {
  background: rgba(23, 162, 184, 0.1);
  color: #17a2b8;
}

/* ============================================================================
   ADMIN STYLES
   ============================================================================ */

.adminSection {
  background: var(--surface-color, #1e1e1e);
  border: 1px solid var(--border-color, #333);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.adminSection h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary, #e0e0e0);
  margin: 0 0 1rem 0;
}

.formRow {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.formGroup {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.formGroup label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary, #888);
}

.input {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color, #333);
  border-radius: 6px;
  background: var(--surface-color, #1e1e1e);
  color: var(--text-primary, #e0e0e0);
  font-size: 0.875rem;
}

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

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

.accountCard {
  background: var(--bg-secondary, #2a2a2a);
  border: 1px solid var(--border-color, #333);
  border-radius: 8px;
  padding: 1rem;
}

.accountCard h4 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary, #e0e0e0);
  margin: 0 0 0.5rem 0;
}

.accountInfo {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.875rem;
}

.accountInfo span {
  color: var(--text-secondary, #888);
}

.accountInfo strong {
  color: var(--text-primary, #e0e0e0);
}

/* ============================================================================
   BUTTONS
   ============================================================================ */

.button {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.buttonPrimary {
  background: var(--primary-color, #f25843);
  color: white;
}

.buttonPrimary:hover {
  background: var(--primary-dark, #d94d3a);
}

.buttonPrimary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.buttonSecondary {
  background: var(--bg-secondary, #2a2a2a);
  color: var(--text-primary, #e0e0e0);
  border: 1px solid var(--border-color, #333);
}

.buttonSecondary:hover {
  background: var(--surface-color, #1e1e1e);
}

/* ============================================================================
   UTILITY CLASSES
   ============================================================================ */

.loadingPlaceholder {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  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.875rem;
  font-style: italic;
}

.errorMessage {
  background: rgba(220, 53, 69, 0.1);
  color: #dc3545;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.successMessage {
  background: rgba(40, 167, 69, 0.1);
  color: #28a745;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 768px) {
  .billingDashboard {
    padding: 0.75rem;
  }
  
  .balanceGrid {
    grid-template-columns: 1fr;
  }
  
  .sectionHeader {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .periodSelector {
    width: 100%;
    flex-wrap: wrap;
  }
  
  .formRow {
    flex-direction: column;
  }
  
  .barLabel,
  .barValue {
    width: 80px;
    font-size: 0.75rem;
  }
}
