/* Billing & Invoicing Styles */

:root {
  --color-primary: #2563eb;
  --color-success: #10b981;
  --color-warn: #f59e0b;
  --color-gray-50: #f9fafb;
  --color-gray-100: #f3f4f6;
  --color-gray-200: #e5e7eb;
  --color-gray-600: #4b5563;
  --color-gray-900: #111827;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.billing-container {
  display: flex;
  max-width: 1400px;
  margin: 2rem auto;
  gap: 2rem;
  padding: 0 2rem;
  min-height: 70vh;
}

.billing-sidebar {
  width: 300px;
  background: white;
  border-radius: 8px;
  padding: 1.5rem;
  height: fit-content;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.sidebar-section {
  margin-bottom: 2rem;
}

.sidebar-section h3 {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--color-gray-600);
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.summary-box {
  background: var(--color-gray-50);
  border-radius: 6px;
  padding: 1rem;
  border: 1px solid var(--color-gray-200);
}

.summary-item {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-gray-200);
}

.summary-item:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

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

.summary-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-gray-900);
}

.quick-action {
  display: block;
  width: 100%;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  background: var(--color-gray-50);
  border: 1px solid var(--color-gray-200);
  border-radius: 4px;
  cursor: pointer;
  text-align: left;
  font-size: 0.875rem;
  transition: all 0.2s;
}

.quick-action:hover {
  background: var(--color-gray-100);
  border-color: var(--color-primary);
}

.billing-main {
  flex: 1;
  background: white;
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  padding: 2rem;
  overflow-y: auto;
}

.billing-header {
  margin-bottom: 2rem;
}

.billing-header h1 {
  font-size: 1.875rem;
  color: var(--color-gray-900);
  margin: 0 0 1rem;
}

.filter-tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 2px solid var(--color-gray-200);
  margin-bottom: 1.5rem;
}

.tab-btn {
  padding: 0.75rem 1.5rem;
  border: none;
  background: transparent;
  color: var(--color-gray-600);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}

.tab-btn:hover {
  color: var(--color-gray-900);
}

.tab-btn.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.invoices-list {
  display: grid;
  gap: 1rem;
}

.invoice-item {
  background: white;
  border: 1px solid var(--color-gray-200);
  border-radius: 6px;
  padding: 1.5rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2rem;
  align-items: center;
  transition: all 0.2s;
}

.invoice-item:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--color-primary);
}

.invoice-details {
  display: flex;
  justify-content: space-between;
  align-items: start;
}

.invoice-info {
  flex: 1;
}

.invoice-number {
  font-weight: 600;
  color: var(--color-gray-900);
  margin-bottom: 0.25rem;
}

.invoice-company {
  color: var(--color-gray-600);
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

.invoice-date {
  color: var(--color-gray-600);
  font-size: 0.8rem;
}

.invoice-stats {
  display: flex;
  gap: 2rem;
}

.invoice-stat {
  text-align: right;
}

.invoice-stat-label {
  color: var(--color-gray-600);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.invoice-stat-value {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-gray-900);
}

.invoice-status {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.status-badge {
  padding: 0.375rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.status-badge.draft {
  background: var(--color-gray-100);
  color: var(--color-gray-600);
}

.status-badge.sent {
  background: #e0e7ff;
  color: var(--color-primary);
}

.status-badge.paid {
  background: #ecfdf5;
  color: var(--color-success);
}

.status-badge.overdue {
  background: #fef2f2;
  color: #ef4444;
}

.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 4px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-primary {
  background: var(--color-primary);
  color: white;
}

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

.btn-secondary {
  background: white;
  color: var(--color-gray-900);
  border: 1px solid var(--color-gray-300);
}

.btn-secondary:hover {
  background: var(--color-gray-50);
}

.btn-block {
  width: 100%;
  justify-content: center;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-gray-700);
  margin-bottom: 0.5rem;
}

.form-control {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--color-gray-300);
  border-radius: 4px;
  font-size: 0.875rem;
}

.form-control:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-content {
  background: white;
  border-radius: 8px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--color-gray-200);
}

.modal-header h2 {
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--color-gray-600);
}

.modal-close:hover {
  color: var(--color-gray-900);
}

.modal-body {
  padding: 1.5rem;
}

.toast {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  padding: 1rem 1.5rem;
  background: var(--color-gray-900);
  color: white;
  border-radius: 4px;
  box-shadow: var(--shadow-md);
  z-index: 2000;
}

.toast.success {
  background: var(--color-success);
}

.toast.error {
  background: #ef4444;
}

@media (max-width: 768px) {
  .billing-container {
    flex-direction: column;
  }

  .billing-sidebar {
    width: 100%;
  }

  .invoice-item {
    grid-template-columns: 1fr;
  }

  .invoice-stats {
    flex-wrap: wrap;
  }

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