/* AGS Business Operating System - Finance Module Styling */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: Arial, sans-serif;
  background-color: #f5f5f5;
  color: #333;
  line-height: 1.6;
}

/* Navbar Styling */
.navbar {
  background-color: #2c3e50;
  color: white;
  padding: 0;
  position: sticky;
  top: 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  z-index: 100;
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 30px;
  max-width: 1400px;
  margin: 0 auto;
}

.nav-brand {
  font-size: 18px;
  font-weight: bold;
  color: white;
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: 0;
}

.nav-link {
  color: white;
  text-decoration: none;
  padding: 15px 15px;
  transition: background-color 0.3s;
  display: block;
}

.nav-link:hover,
.nav-link.active {
  background-color: #34495e;
}

.nav-link.logout {
  background-color: #e74c3c;
}

.nav-link.logout:hover {
  background-color: #c0392b;
}

/* Main Container */
.main-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 30px;
  min-height: calc(100vh - 80px);
}

/* Page Styling */
.page {
  display: none;
}

.page.active {
  display: block;
  animation: fadeIn 0.3s;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Page Header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  border-bottom: 2px solid #ecf0f1;
  padding-bottom: 20px;
}

.page-header h1 {
  font-size: 28px;
  color: #2c3e50;
}

.page-header .last-updated {
  font-size: 12px;
  color: #7f8c8d;
  margin-top: 5px;
}

/* KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.kpi-card {
  background: white;
  padding: 25px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.kpi-label {
  font-size: 12px;
  text-transform: uppercase;
  color: #7f8c8d;
  font-weight: bold;
  margin-bottom: 10px;
}

.kpi-value {
  font-size: 32px;
  font-weight: bold;
  color: #2c3e50;
  margin-bottom: 15px;
}

.kpi-detail {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  color: #5d6d7b;
}

.kpi-detail span {
  display: flex;
  justify-content: space-between;
}

/* Charts Grid */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.chart-card {
  background: white;
  padding: 25px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.chart-card h3 {
  margin-bottom: 20px;
  color: #2c3e50;
  font-size: 16px;
}

/* Section Styling */
.section {
  background: white;
  padding: 25px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  margin-bottom: 30px;
}

.section h2 {
  color: #2c3e50;
  margin-bottom: 20px;
  font-size: 18px;
}

/* Filters */
.filters {
  display: flex;
  gap: 15px;
  margin-bottom: 20px;
}

.filters input,
.filters select {
  padding: 10px 15px;
  border: 1px solid #bdc3c7;
  border-radius: 4px;
  font-size: 14px;
}

.filters input {
  flex: 1;
  min-width: 200px;
}

.filters select {
  min-width: 150px;
}

.filters input:focus,
.filters select:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

/* Data Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 8px;
  overflow: hidden;
}

.data-table thead {
  background-color: #ecf0f1;
}

.data-table th {
  padding: 15px;
  text-align: left;
  font-weight: bold;
  color: #2c3e50;
  font-size: 13px;
  text-transform: uppercase;
}

.data-table td {
  padding: 15px;
  border-bottom: 1px solid #ecf0f1;
}

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

.data-table .empty-state {
  text-align: center;
  color: #7f8c8d;
}

.data-table .status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: bold;
  text-transform: uppercase;
}

.status-badge.draft { background-color: #95a5a6; color: white; }
.status-badge.sent { background-color: #3498db; color: white; }
.status-badge.viewed { background-color: #3498db; color: white; }
.status-badge.paid { background-color: #27ae60; color: white; }
.status-badge.overdue { background-color: #e74c3c; color: white; }
.status-badge.received { background-color: #f39c12; color: white; }
.status-badge.approved { background-color: #27ae60; color: white; }
.status-badge.scheduled { background-color: #9b59b6; color: white; }
.status-badge.pending { background-color: #f39c12; color: white; }
.status-badge.completed { background-color: #27ae60; color: white; }
.status-badge.failed { background-color: #e74c3c; color: white; }

/* Buttons */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  transition: all 0.3s;
  text-decoration: none;
  display: inline-block;
}

.btn-primary {
  background-color: #3498db;
  color: white;
}

.btn-primary:hover {
  background-color: #2980b9;
}

.btn-secondary {
  background-color: #95a5a6;
  color: white;
}

.btn-secondary:hover {
  background-color: #7f8c8d;
}

.btn-success {
  background-color: #27ae60;
  color: white;
}

.btn-success:hover {
  background-color: #229954;
}

.btn-danger {
  background-color: #e74c3c;
  color: white;
}

.btn-danger:hover {
  background-color: #c0392b;
}

.btn-small {
  padding: 6px 12px;
  font-size: 12px;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 5px;
  margin-top: 20px;
}

.pagination button {
  padding: 8px 12px;
  border: 1px solid #bdc3c7;
  background-color: white;
  color: #2c3e50;
  cursor: pointer;
  border-radius: 4px;
  font-size: 13px;
}

.pagination button:hover,
.pagination button.active {
  background-color: #3498db;
  color: white;
  border-color: #3498db;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.4);
  animation: fadeIn 0.3s;
}

.modal.show {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background-color: white;
  padding: 30px;
  border-radius: 8px;
  width: 90%;
  max-width: 600px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  position: relative;
}

.modal-content h2 {
  margin-bottom: 20px;
  color: #2c3e50;
}

.close {
  position: absolute;
  right: 20px;
  top: 15px;
  font-size: 28px;
  font-weight: bold;
  color: #7f8c8d;
  cursor: pointer;
  transition: color 0.3s;
}

.close:hover {
  color: #2c3e50;
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: bold;
  color: #2c3e50;
  font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #bdc3c7;
  border-radius: 4px;
  font-size: 14px;
  font-family: Arial, sans-serif;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

#invoiceForm,
#billForm,
#customerForm,
#paymentForm {
  display: grid;
  gap: 0;
}

#invoiceForm .form-group,
#billForm .form-group,
#customerForm .form-group,
#paymentForm .form-group {
  margin-bottom: 20px;
}

/* Reports Grid */
.reports-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.report-card {
  background: white;
  padding: 30px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  cursor: pointer;
  transition: all 0.3s;
  text-align: center;
}

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

.report-card h3 {
  color: #2c3e50;
  margin-bottom: 10px;
}

.report-card p {
  color: #7f8c8d;
  font-size: 13px;
}

/* Settings Form */
.settings-form {
  background: white;
  padding: 30px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.form-section {
  margin-bottom: 30px;
}

.form-section h3 {
  color: #2c3e50;
  margin-bottom: 20px;
  border-bottom: 2px solid #ecf0f1;
  padding-bottom: 10px;
}

/* Responsive Design */
@media (max-width: 768px) {
  .nav-container {
    padding: 15px;
  }

  .nav-menu {
    gap: 0;
  }

  .nav-link {
    padding: 10px;
    font-size: 13px;
  }

  .main-container {
    padding: 15px;
  }

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

  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .charts-grid {
    grid-template-columns: 1fr;
  }

  .filters {
    flex-direction: column;
  }

  .filters input,
  .filters select {
    width: 100%;
  }

  .data-table {
    font-size: 12px;
  }

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

  .modal-content {
    width: 95%;
  }

  .reports-grid {
    grid-template-columns: 1fr;
  }
}

/* Aging Breakdown */
#agingBreakdown {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}

.aging-item {
  background: #ecf0f1;
  padding: 15px;
  border-radius: 4px;
  text-align: center;
}

.aging-item .label {
  font-size: 12px;
  color: #7f8c8d;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.aging-item .amount {
  font-size: 18px;
  font-weight: bold;
  color: #2c3e50;
}

/* Action Buttons in Tables */
.action-buttons {
  display: flex;
  gap: 5px;
}

.action-buttons .btn {
  padding: 4px 10px;
  font-size: 11px;
}

/* Report Content */
#reportContent {
  background: white;
  padding: 25px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Loading Indicator */
.loading {
  text-align: center;
  padding: 20px;
  color: #7f8c8d;
}

.loading::after {
  content: '';
  display: inline-block;
  width: 20px;
  height: 20px;
  margin-left: 10px;
  border: 3px solid #ecf0f1;
  border-top: 3px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Alert Messages */
.alert {
  padding: 15px 20px;
  margin-bottom: 20px;
  border-radius: 4px;
  font-size: 14px;
}

.alert-success {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.alert-error {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.alert-warning {
  background-color: #fff3cd;
  color: #856404;
  border: 1px solid #ffeaa7;
}

.alert-info {
  background-color: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}
