html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
  background-color: #f8f9fa;
  font-family: 'Segoe UI', Arial, sans-serif;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  color: #343a40;
}

.table {
  background: #fff;
  border-radius: 0.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.navbar {
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

footer {
  background: #fff;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.05);
  padding: 1rem 0;
}

.form-control, .btn {
  border-radius: 0.3rem;
}

.ag-theme-balham .bigexpense-warning {
    background-color: sandybrown !important;
}

.ag-theme-balham .bigexpense-breach {
    background-color: lightcoral !important;
}

.ag-theme-balham .bigexpense-ok {
    background-color: mediumseagreen !important;
}

/* AG Grid Container Styles */
.ag-grid-container {
  width: 100%;
  margin-bottom: 2rem;
}

.ag-grid-wrapper {
  background: #fff;
  border-radius: 0.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  padding: 1rem;
  overflow: hidden;
}

.ag-grid-wrapper .ag-root-wrapper {
  border-radius: 0.3rem;
  border: 1px solid #dee2e6;
}

/* AG Grid Theme Customization */
.ag-theme-alpine {
  --ag-border-color: #dee2e6;
  --ag-header-background-color: #f8f9fa;
  --ag-odd-row-background-color: #ffffff;
  --ag-row-hover-color: #f0f8ff;
  --ag-selected-row-background-color: #e3f2fd;
  --ag-font-size: 14px;
  --ag-font-family: 'Segoe UI', Arial, sans-serif;
  
  /* Scrollbar styles */
  --ag-scrollbar-width: 12px;
  --ag-scrollbar-height: 12px;
}

/* Ensure scrollbars are always visible */
.ag-theme-alpine .ag-body-horizontal-scroll {
  opacity: 1 !important;
  visibility: visible !important;
}

.ag-theme-alpine .ag-body-vertical-scroll {
  opacity: 1 !important;
  visibility: visible !important;
}

/* Custom scrollbar styling for modern browsers */
.ag-theme-alpine .ag-body-horizontal-scroll::-webkit-scrollbar,
.ag-theme-alpine .ag-body-vertical-scroll::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

.ag-theme-alpine .ag-body-horizontal-scroll::-webkit-scrollbar-track,
.ag-theme-alpine .ag-body-vertical-scroll::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 6px;
}

.ag-theme-alpine .ag-body-horizontal-scroll::-webkit-scrollbar-thumb,
.ag-theme-alpine .ag-body-vertical-scroll::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 6px;
}

.ag-theme-alpine .ag-body-horizontal-scroll::-webkit-scrollbar-thumb:hover,
.ag-theme-alpine .ag-body-vertical-scroll::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* Floating filter styling */
.ag-theme-alpine .ag-floating-filter-input {
  padding: 4px 8px;
  font-size: 13px;
}

.ag-theme-alpine .ag-floating-filter-button {
  margin-left: 4px;
}

/* Grid controls styling */
.ag-grid-controls {
  padding: 0.75rem;
  background: #f8f9fa;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
}

.ag-grid-controls .btn {
  font-size: 0.875rem;
}

/* Ensure grid is scrollable */
.ag-theme-alpine .ag-root {
  overflow: visible;
}

.ag-theme-alpine .ag-body-viewport {
  overflow: auto !important;
}

.ag-theme-alpine .ag-center-cols-viewport {
  overflow-x: auto !important;
  overflow-y: auto !important;
}

/* Responsive AG Grid */
@media (max-width: 768px) {
  .ag-grid-wrapper {
    padding: 0.5rem;
  }
  
  .ag-theme-alpine {
    font-size: 12px;
    --ag-font-size: 12px;
  }
  
  .ag-theme-alpine .ag-header-cell-text {
    font-size: 12px;
  }
  
  .ag-grid-controls {
    padding: 0.5rem;
  }
  
  .ag-grid-controls .d-flex {
    flex-direction: column;
    gap: 0.5rem;
  }
}

@media (max-width: 576px) {
  .ag-theme-alpine {
    font-size: 11px;
    --ag-font-size: 11px;
  }
  
  .ag-grid-wrapper {
    padding: 0.25rem;
  }
}

/* Improve column resize handle visibility */
.ag-theme-alpine .ag-header-cell-resize {
  width: 8px;
  background: transparent;
}

.ag-theme-alpine .ag-header-cell-resize:hover {
  background: #4285f4;
}

/* Better filter panel styling */
.ag-theme-alpine .ag-menu {
  border: 1px solid #dee2e6;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.ag-theme-alpine .ag-filter {
  padding: 8px;
}

/* Row selection styling */
.ag-theme-alpine .ag-row-selected {
  background-color: #e3f2fd !important;
}

.ag-theme-alpine .ag-row-selected:hover {
  background-color: #bbdefb !important;
}

/* Loading overlay */
.ag-theme-alpine .ag-overlay-loading-wrapper {
  background-color: rgba(255, 255, 255, 0.9);
}

/* Table with Scrollbars - Responsive Grid View */
.table-container-with-scroll {
  max-height: calc(100vh - 400px);
  min-height: 400px;
  overflow-y: auto;
  overflow-x: auto;
  border: 1px solid #dee2e6;
  border-radius: 0.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  background: white;
}

.table-container-with-scroll::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

.table-container-with-scroll::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 6px;
}

.table-container-with-scroll::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 6px;
}

.table-container-with-scroll::-webkit-scrollbar-thumb:hover {
  background: #555;
}

thead.sticky-top {
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.sortable:hover {
  background-color: rgba(64, 64, 64, 0.4) !important;
  cursor: pointer;
}

.sortable:active {
  background-color: rgba(64, 64, 64, 0.6) !important;
}

.table-hover tbody tr:hover {
  background-color: #f0f8ff;
}

@media (max-width: 768px) {
  .table-container-with-scroll {
    max-height: calc(100vh - 500px);
  }
}

/* Stats Summary Styling */
.card-body .row.text-center h3 {
  font-weight: 600;
  font-size: 1.75rem;
}

.card-body .row.text-center h6 {
  font-size: 0.875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card-body .row.text-center .col-md-3 {
  padding: 0.5rem;
}

@media (max-width: 768px) {
  .card-body .row.text-center h3 {
    font-size: 1.5rem;
  }
  
  .card-body .row.text-center h6 {
    font-size: 0.75rem;
  }
}

/* Column Filter Styling */
.column-actions {
  display: flex;
  gap: 0.5rem;
  margin-left: 0.5rem;
}

.sort-icon, .filter-icon {
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s, color 0.2s;
}

.sort-icon:hover, .filter-icon:hover {
  opacity: 1;
}

.filter-icon.active-filter {
  opacity: 1;
  color: #ffc107;
}

.filter-icon.filter-active {
  color: #0d6efd;
  opacity: 1;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

.column-filters {
  background-color: rgba(52, 58, 64, 0.95) !important;
}

.column-filters th {
  padding: 0.5rem !important;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.column-filters input,
.column-filters select {
  background-color: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #212529;
  font-size: 0.875rem;
}

.column-filters input[type="date"] {
  font-size: 0.75rem;
  padding: 0.25rem 0.375rem;
}

.column-filters input::placeholder {
  color: #6c757d;
  opacity: 0.8;
}

.column-filters input:focus,
.column-filters select:focus {
  background-color: #fff;
  border-color: #0d6efd;
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.column-filters .btn-outline-light {
  border-color: rgba(255, 255, 255, 0.3);
}

.column-filters .btn-outline-light:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.5);
}

/* Responsive adjustments for column filters */
@media (max-width: 768px) {
  .column-actions {
    gap: 0.25rem;
  }
  
  .sort-icon, .filter-icon {
    font-size: 0.875rem;
  }
  
  .column-filters input,
  .column-filters select {
    font-size: 0.75rem;
    padding: 0.25rem;
  }
}

/* Responsive Typography */
@media (max-width: 576px) {
  h1 {
    font-size: 1.75rem;
  }
  h2, h4 {
    font-size: 1.5rem;
  }
}

/* Responsive Table Wrapper */
.table-responsive-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1rem;
}

/* Mobile Table Styles */
@media (max-width: 768px) {
  .table {
    font-size: 0.875rem;
  }
  
  .table thead {
    display: none;
  }
  
  .table tbody tr {
    display: block;
    margin-bottom: 1rem;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  }
  
  .table tbody td {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem;
    border: none;
    border-bottom: 1px solid #f0f0f0;
  }
  
  .table tbody td:last-child {
    border-bottom: none;
  }
  
  .table tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    margin-right: 1rem;
    color: #495057;
  }
  
  .table tbody td:last-child {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .table tbody td:last-child .btn {
    width: 100%;
  }
}

/* Form Responsive Styles */
.form-container {
  max-width: 100%;
}

@media (min-width: 768px) {
  .form-container {
    max-width: 600px;
  }
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

/* Responsive Buttons */
.btn-group-responsive {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

@media (min-width: 576px) {
  .btn-group-responsive {
    flex-direction: row;
  }
}

/* Filter Form Responsive */
.filter-form-responsive .col-md-3,
.filter-form-responsive .col-md-2 {
  margin-bottom: 0.75rem;
}

@media (max-width: 767px) {
  .filter-form-responsive .col-md-3,
  .filter-form-responsive .col-md-2 {
    width: 100%;
  }
}

/* Header Actions Responsive */
.header-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 576px) {
  .header-actions {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

.header-actions h1 {
  margin-bottom: 0;
}

/* Pagination Responsive */
.pagination {
  flex-wrap: wrap;
  gap: 0.25rem;
}

.pagination .page-item {
  margin: 0.125rem;
}

@media (max-width: 576px) {
  .pagination {
    font-size: 0.875rem;
  }
  
  .pagination .page-link {
    padding: 0.375rem 0.625rem;
  }
}

/* Login Form Responsive */
.login-container {
  max-width: 100%;
  padding: 1.5rem;
  background: #fff;
  border-radius: 0.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  margin: 2rem auto;
}

@media (min-width: 576px) {
  .login-container {
    max-width: 400px;
  }
}

.login-container .form-group {
  margin-bottom: 1.25rem;
}

.login-container label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.login-container input[type="text"],
.login-container input[type="password"] {
  width: 100%;
  padding: 0.625rem;
  border: 1px solid #ced4da;
  border-radius: 0.3rem;
}

.login-container input[type="checkbox"] {
  margin-right: 0.5rem;
}

.login-container button[type="submit"] {
  width: 100%;
  padding: 0.75rem;
  margin-top: 1rem;
}

/* Footer Responsive */
@media (max-width: 576px) {
  footer .container {
    text-align: center !important;
  }
  
  footer {
    font-size: 0.875rem;
  }
}

/* Navbar Responsive Improvements */
@media (max-width: 991px) {
  .navbar-collapse {
    margin-top: 1rem;
  }
  
  .navbar-nav {
    padding: 0.5rem 0;
  }
  
  .navbar-nav .nav-item {
    padding: 0.25rem 0;
  }
}

/* Container Responsive Padding */
@media (max-width: 576px) {
  .container {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
}

/* Card Responsive */
.card-responsive {
  padding: 1rem;
}

@media (min-width: 768px) {
  .card-responsive {
    padding: 1.5rem;
  }
}

/* Action Buttons Responsive */
.action-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

@media (max-width: 576px) {
  .action-buttons {
    flex-direction: column;
  }
  
  .action-buttons .btn {
    width: 100%;
  }
}



