/* Invoice List & Management Styles */

/* Summary Cards */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.summary-card {
  background: white;
  border-radius: 10px;
  padding: 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  text-align: center;
}

.summary-card .count {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1e293b;
}

.summary-card .label {
  font-size: 0.75rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.25rem;
}

.summary-card .amount {
  font-size: 0.875rem;
  color: #475569;
  margin-top: 0.25rem;
}

.summary-card.outstanding .count { color: #dc2626; }

/* Filter Bar */
.filter-bar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  padding: 1rem;
  background: white;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.filter-bar select,
.filter-bar input {
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.875rem;
  background: white;
  color: #1e293b;
}

.filter-bar select option {
  background: white;
  color: #1e293b;
}

.filter-bar .spacer {
  flex: 1;
}

/* Invoice Table */
.invoice-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.invoice-table thead th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.invoice-table tbody tr {
  cursor: pointer;
  transition: background 0.15s;
}

.invoice-table tbody tr:hover {
  background: #f8fafc;
}

.invoice-table td {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: #1e293b;
  border-bottom: 1px solid #f1f5f9;
}

.invoice-table .amount-cell {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* Status Badges */
.status-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}

.status-draft { background: #f1f5f9; color: #64748b; }
.status-sent { background: #dbeafe; color: #1d4ed8; }
.status-viewed { background: #ede9fe; color: #6d28d9; }
.status-overdue { background: #fee2e2; color: #dc2626; }
.status-partially_paid { background: #fef3c7; color: #d97706; }
.status-paid { background: #dcfce7; color: #16a34a; }
.status-void { background: #fce4ec; color: #991b1b; }
.status-credited { background: #f1f5f9; color: #64748b; }

/* Button styles */
.btn-primary {
  padding: 0.5rem 1.25rem;
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-primary:hover { background: #1d4ed8; }

.btn-secondary {
  padding: 0.5rem 1.25rem;
  background: white;
  color: #374151;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
}

.btn-secondary:hover { background: #f9fafb; }

.btn-danger {
  padding: 0.5rem 1.25rem;
  background: #dc2626;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-danger:hover { background: #b91c1c; }

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 12px;
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.25rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #6b7280;
  padding: 0.25rem;
}

/* Detail View */
.invoice-detail {
  background: white;
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #1e293b;
}

.detail-header h2 {
  margin: 0;
  font-size: 1.5rem;
}

.detail-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 1.5rem;
}

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

.detail-section h4 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  margin: 0 0 0.5rem 0;
}

.detail-section p {
  margin: 0.25rem 0;
  font-size: 0.875rem;
  color: #1e293b;
}

/* Line Items Table */
.line-items-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

.line-items-table th {
  text-align: left;
  padding: 0.5rem;
  font-size: 0.75rem;
  color: #6b7280;
  border-bottom: 1px solid #e2e8f0;
  text-transform: uppercase;
}

.line-items-table td {
  padding: 0.5rem;
  font-size: 0.875rem;
  border-bottom: 1px solid #f1f5f9;
}

.line-items-table .text-right {
  text-align: right;
}

/* Totals */
.totals-section {
  margin-left: auto;
  max-width: 300px;
}

.totals-row {
  display: flex;
  justify-content: space-between;
  padding: 0.375rem 0;
  font-size: 0.875rem;
}

.totals-row.total {
  border-top: 2px solid #1e293b;
  font-weight: 700;
  font-size: 1rem;
  padding-top: 0.5rem;
  margin-top: 0.25rem;
}

/* Payment History */
.payment-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0;
}

.payment-list li {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.875rem;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #64748b;
}

.empty-state h3 {
  color: #374151;
  margin-bottom: 0.5rem;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 1000;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s, transform 0.3s;
}

.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { background: #16a34a; color: white; }
.toast-error { background: #dc2626; color: white; }
