/* Modern Base Styles */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --secondary: #64748b;
  --success: #10b981;
  --background: #f8fafc;
  --surface: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --border: #e2e8f0;
  --hover: #f1f5f9;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --radius: 12px;
  --transition: all 0.2s ease;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen, Ubuntu, Cantarell, "Open Sans", sans-serif;
  background-color: var(--surface);
  color: var(--text-primary);
  /* line-height: 1.6; */
  padding: 10px;
}

/* Header Styles */

.container {
  width: 100%; 
}

/* Enhanced Header Styles */
.dashboard-header {
  background: var(--surface);
  padding: 2rem 2.5rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 2rem; 
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

/* .dashboard-header::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 120px;
  height: 120px;
  background: var(--primary-light);
  border-radius: 0 0 0 100%;
  z-index: 0;
  opacity: 0.6;
}

.dashboard-header::after {
  content: "";
  position: absolute;
  top: -20px;
  right: -20px;
  width: 80px;
  height: 80px;
  background: var(--primary-light);
  border-radius: 50%;
  z-index: 0;
  opacity: 0.4;
} */

.header-content {
  position: relative;
  z-index: 1;
}

.header-titles h1 {
  font-size: 2.25rem;
  margin: 0;
  color: var(--text-primary);
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 1rem;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.header-titles h1 i {
  font-size: 2rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  padding: 12px;
  border-radius: 50%;
  background-color: var(--primary-light);
  box-shadow: 0 4px 12px rgba(67, 97, 238, 0.2);
  transition: var(--transition);
}

/* .header-titles h1:hover i {
  transform: rotate(10deg) scale(1.05);
  box-shadow: 0 6px 16px rgba(67, 97, 238, 0.3);
} */

.header-titles h2 {
  font-size: 1.25rem;
  margin: 0.75rem 0 0 0.25rem;
  font-weight: 400;
  color: var(--text-secondary);
  position: relative;
  display: inline-block;
}

/* .header-titles h2::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 0;
  width: 40px;
  height: 3px;
  background: var(--primary);
  border-radius: 3px;
  transition: var(--transition);
} */

.header-titles:hover h2::after {
  width: 100%;
}

/* Subtle animation on header hover */
/* .dashboard-header:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
} */

/* Control Bar */
.control-bar {
       display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.25rem;
    padding: 1.25rem;
    background: var(--surface);
    margin: 0 0 1rem 0;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm) var(--shadow-sm) var(--shadow-sm);
}

.search-container {
  flex: 1;
  min-width: 280px;
  max-width: 450px;
}

.search-input {
  position: relative;
  width: 100%;
}

.search-input i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  z-index: 1;
}

.search-input input {
  width: 100%;
  padding: 12px 16px 12px 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  transition: var(--transition);
  background: var(--background);
}

.search-input input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.date-filter {
  display: flex;
  align-items: center;
  gap: 12px;
}

.date-filter input {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  background: var(--background);
  transition: var(--transition);
}

.date-filter input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.date-filter button {
  padding: 12px 20px;
  background-color: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  transition: var(--transition);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}

.date-filter button:hover {
  background-color: var(--primary-dark);
  transform: translateY(-1px);
}

.action-buttons {
  display: flex;
  gap: 12px;
}

.download-button {
  padding: 12px 20px;
  background-color: var(--success);
  color: white;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

.download-button:hover {
  background-color: #0da271;
  transform: translateY(-1px);
}

/* Table Wrapper */
.table-wrapper {
  width: 100%;
  position: relative;
  margin: 0 0 24px 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 640px;
}

/* Table Container */
.table-container {
  width: 100%;
  overflow: auto;
  flex-grow: 1;
}

/* Table Styles */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
}

thead {
  position: sticky;
  top: 0;
  z-index: 10;
}

th {
  background-color: #f8fafc;
  color: var(--text-primary);
  font-weight: 600;
  text-align: left;
  padding: 14px;
  border-bottom: 2px solid var(--border);
  position: relative;
}

/* Group headers styling */
thead tr:first-child th {
  background-color: var(--primary-light);
  color: var(--primary);
  text-align: center;
  font-weight: 700;
  font-size: 15px;
  padding: 13px 10px;
  border-bottom: 2px solid var(--border);
}

/* Column headers styling */
thead tr:nth-child(2) th {
  background-color: #f8fafc;
  border-bottom: 2px solid var(--border);
  font-weight: 600;
}

td {
  padding: 10px;
  border-bottom:1px solid rgba(0, 0, 0, 0.1);
  color: var(--text-primary);
  font-size: 14px;
}

tr {
  transition: background-color 0.1s ease;
}

tr:nth-child(even) {
  background-color: #fafafa;
}

tr:hover {
  background-color: var(--primary-light);
}

/* Visual separator between sections */
th:nth-child(5),
td:nth-child(5) {
  border-right:2px solid #b9c2cf;
  background-color: rgba(0, 0, 0, 0.02);
}

/* Loading State */
#loading {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.95);
  z-index: 100;
  text-align: center;
  color: var(--text-secondary);
  flex-direction: column;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(4px);
}

.loading-spinner {
  border: 3px solid var(--primary-light);
  border-top: 3px solid var(--primary);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Pagination Styles */
.ag-pagination {
  display: flex;
  justify-content: end;
  align-items: center;
  padding: 4px 4px;
  background-color: #f8fafc;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 16px;
}

.page-size-selector {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
}

.page-size-selector select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  height: 38px;
  background-color: var(--surface);
  transition: var(--transition);
  font-size: 14px;
}

.page-size-selector select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.pagination-info {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pagination-btn {
  padding: 8px 12px;
  background-color: white;
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
  min-width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
}

.pagination-btn:hover:not(:disabled) {
  background-color: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

.pagination-btn:disabled {
  color: #cbd5e1;
  cursor: not-allowed;
  background-color: #f8fafc;
}

/* Page Input */
.page-input {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-primary);
  margin: 0 8px;
  font-weight: 500;
}

.page-input span {
  font-weight: 600;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .control-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .search-container {
    max-width: 100%;
  }

  .date-filter {
    justify-content: space-between;
    width: 100%;
  }

  .action-buttons {
    justify-content: flex-end;
    width: 100%;
  }
}

@media (max-width: 768px) {
  body {
    padding: 16px;
  }

  .dashboard-header {
    padding: 1.25rem;
  }

  .header-content {
    flex-direction: column;
    align-items: flex-start;
  }

  .control-bar {
    padding: 1.25rem;
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }

  .date-filter {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .date-filter input {
    width: 100%;
  }

  .action-buttons {
    justify-content: stretch;
  }

  .action-buttons button {
    flex: 1;
    justify-content: center;
  }

  .ag-pagination {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .pagination-controls {
    justify-content: center;
    order: 1;
  }

  .page-size-selector {
    justify-content: center;
    order: 2;
  }

  .pagination-info {
    text-align: center;
    order: 3;
  }

  table {
    font-size: 13px;
  }

  th,
  td {
    padding: 14px 12px;
  }
}

@media (max-width: 480px) {
  .header-titles h1 {
    font-size: 1.5rem;
  }

  .header-titles h2 {
    font-size: 1rem;
  }

  .pagination-controls {
    flex-wrap: wrap;
    justify-content: center;
  }

  .page-input {
    order: -1;
    width: 100%;
    justify-content: center;
    margin-bottom: 10px;
  }

  th,
  td {
    padding: 12px 10px;
    font-size: 13px;
  }
}

/* Scrollbar styling */
.table-container::-webkit-scrollbar {
  height: 8px;
  width: 8px;
}

.table-container::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Status indicators */
.status-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 8px;
}

.status-active {
  background-color: var(--success);
}

.status-pending {
  background-color: #f59e0b;
}

.status-completed {
  background-color: var(--primary);
}

/* Badge styles */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.badge-primary {
  background-color: var(--primary-light);
  color: var(--primary);
}

.badge-success {
  background-color: #d1fae5;
  color: #065f46;
}

.badge-warning {
  background-color: #fef3c7;
  color: #92400e;
}
