/* Payment Ledger Page */

.page-header {
  padding: 95px 0 20px;
  background: #1a1a2e;
}

.header-content {
  text-align: center;
}

.page-title {
  font-family: var(--font-primary);
  font-size: 3rem;
  font-weight: 800;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.page-subtitle {
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

.header-actions {
  margin-top: 1rem;
}

.nav-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.2rem;
  border-radius: 10px;
  text-decoration: none;
  color: #fff;
  background: var(--gradient-primary);
  font-weight: 600;
  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease;
}

.nav-action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(107, 70, 193, 0.4);
}

.summary-section {
  background: #1a1a2e;
  padding: 0 0 1rem;
}

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

.summary-card {
  border: 1px solid rgba(107, 70, 193, 0.25);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  padding: 1rem 1.2rem;
}

.summary-label {
  color: var(--text-secondary);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.summary-value {
  margin-top: 0.4rem;
  color: #fff;
  font-size: 1.65rem;
  font-weight: 700;
  font-family: var(--font-primary);
}

.ledger-section {
  background: #1a1a2e;
  padding: 0.5rem 0 2rem;
}

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

.chart-panel,
.totals-panel,
.per-match-panel {
  border: 1px solid rgba(107, 70, 193, 0.22);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  padding: 1rem;
}

.chart-panel h2,
.totals-panel h2,
.per-match-panel h2 {
  color: #fff;
  font-size: 1.2rem;
  margin-bottom: 0.8rem;
}

.chart-wrap {
  min-height: 360px;
  position: relative;
}

.chart-note {
  margin-top: 0.55rem;
  color: #9fb5ff;
  font-size: 0.82rem;
}

.chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.metric-toggle {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  padding: 0.2rem;
}

.metric-btn {
  border: 0;
  background: transparent;
  color: #cfd4ff;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.metric-btn.active {
  color: #ffffff;
  background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

#ledgerPieChart {
  width: 100%;
  height: 360px;
}

.chart-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

.totals-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-height: 360px;
  overflow-y: auto;
}

.total-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.total-item.selected {
  background: rgba(37, 99, 235, 0.22);
  border: 1px solid rgba(56, 189, 248, 0.55);
}

.total-left {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: #fff;
  min-width: 0;
}

.color-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.person-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.total-value {
  color: #ffd166;
  font-weight: 700;
}

.per-match-panel {
  margin-top: 1rem;
}

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

.ledger-table {
  width: 100%;
  border-collapse: collapse;
}

.ledger-table th,
.ledger-table td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0.7rem;
  text-align: left;
  color: #fff;
  vertical-align: top;
}

.ledger-table th {
  color: #cfd4ff;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.ledger-table tbody tr {
  transition:
    background 0.2s ease,
    transform 0.2s ease;
}

.ledger-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.05);
}

.players-empty {
  color: #9ca3af;
  font-size: 0.86rem;
}

.view-players-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.38rem 0.7rem;
  border-radius: 8px;
  border: 1px solid rgba(14, 165, 233, 0.5);
  background: rgba(14, 165, 233, 0.18);
  color: #dff5ff;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.view-players-btn:hover {
  background: rgba(14, 165, 233, 0.28);
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 1200;
  inset: 0;
  background: rgba(5, 8, 20, 0.7);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal.show {
  display: flex;
}

.players-modal-content {
  width: min(720px, 96vw);
  background: #121833;
  border: 1px solid rgba(129, 140, 248, 0.3);
  border-radius: 14px;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.modal-header h2 {
  color: #fff;
  font-size: 1.1rem;
  margin: 0;
}

.close-modal {
  border: 0;
  background: transparent;
  color: #cbd5e1;
  font-size: 1rem;
  cursor: pointer;
}

.players-modal-body {
  padding: 1rem;
}

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

.player-card {
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  padding: 0.65rem;
  color: #fff;
  font-size: 0.9rem;
}

.auth-required,
.empty-state {
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 2rem 1rem;
  text-align: center;
  color: #fff;
}

.auth-required i,
.empty-state i {
  font-size: 2rem;
  color: #9ea8ff;
  margin-bottom: 0.5rem;
}

.auth-required p,
.empty-state p {
  color: var(--text-secondary);
}

.login-link {
  display: inline-block;
  margin-top: 0.8rem;
  text-decoration: none;
  color: #fff;
  background: var(--gradient-primary);
  padding: 0.6rem 1rem;
  border-radius: 10px;
}

@media (max-width: 980px) {
  .ledger-content {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .page-title {
    font-size: 2.2rem;
  }

  #ledgerPieChart {
    height: 300px;
  }

  .chart-wrap,
  .totals-list {
    min-height: auto;
    max-height: none;
  }
}
