/* Base styles */
:root {
  --primary-color: #3a5070;
  --secondary-color: #4c6b9c;
  --accent-color: #ff9900;
  --success-color: #28a745;
  --danger-color: #dc3545;
  --warning-color: #ffc107;
  --info-color: #17a2b8;
  --light-color: #f8f9fa;
  --dark-color: #343a40;
  --gray-color: #6c757d;
  --gray-light-color: #e9ecef;
  --border-radius: 0.25rem;
  --box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  --transition: all 0.3s ease-in-out;
}

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

body {
  font-family: 'Calibri', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: #333;
  background-color: #f8f9fa;
}

p {
  margin-bottom: 1rem;
  margin-left: 1.5em; /* Adds 20px margin from the left */
}



.container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  margin-bottom: 0.5rem;
  font-weight: 600;
  line-height: 1.2;
  color: #333;
}

h1 {
  font-size: 2.25rem;
}

h2 {
  font-size: 1.8rem;
}

h3 {
  font-size: 1.5rem;
}

p {
  margin-bottom: 1rem;
}

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--secondary-color);
  text-decoration: underline;
}

/* Navbar */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background-color: var(--primary-color);
  color: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.navbar-brand h1 {
  margin: 0;
  font-size: 1.75rem;
  color: white;
}

.navbar-brand a {
  color: white;
  text-decoration: none;
}

.beta-badge {
  font-size: 0.55rem;
  font-weight: 600;
  background-color: #2eaa52;
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  vertical-align: super;
  letter-spacing: 0.5px;
}

.beta-badge-footer {
  font-size: 0.65rem;
  font-weight: 600;
  background-color: #2eaa52;
  color: white;
  padding: 1px 5px;
  border-radius: 3px;
  letter-spacing: 0.5px;
  margin: 0 2px;
}

.navbar-menu {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.navbar-menu a {
  color: white;
  text-decoration: none;
  transition: var(--transition);
}

.navbar-menu a:hover {
  color: var(--accent-color);
}

/* Dropdown */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-toggle {
  color: white;
  cursor: pointer;
}

.dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  min-width: 160px;
  background-color: white;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
  z-index: 1;
  border-radius: var(--border-radius);
  overflow: hidden;
}

.dropdown-menu a {
  display: block;
  padding: 0.75rem 1rem;
  color: #333;
  text-decoration: none;
  transition: var(--transition);
}

.dropdown-menu a:hover {
  background-color: var(--gray-light-color);
  color: var(--primary-color);
}

.dropdown-menu.show {
  display: block;
}

.dropdown-item {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  clear: both;
  font-weight: 400;
  color: #212529;
  text-align: inherit;
  white-space: nowrap;
  background-color: transparent;
  border: 0;
  cursor: pointer;
  transition: var(--transition);
}

.dropdown-item:hover {
  background-color: var(--light-color);
  color: var(--primary-color);
}

/* Buttons */
.btn {
  display: inline-block;
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
  vertical-align: middle;
  user-select: none;
  border: 1px solid transparent;
  padding: 0.45rem 0.9rem;
  font-size: 0.9rem;
  line-height: 1.5;
  border-radius: var(--border-radius);
  transition: var(--transition);
  cursor: pointer;
}

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

.btn-primary:hover {
  color: white;
  background-color: var(--secondary-color);
  border-color: var(--secondary-color);
  text-decoration: none;
}

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

.btn-danger:hover {
  color: white;
  background-color: #c82333;
  border-color: #bd2130;
  text-decoration: none;
}

.btn-outline {
  color: var(--primary-color);
  background-color: transparent;
  border-color: var(--primary-color);
}

.btn-outline:hover {
  color: white;
  background-color: var(--primary-color);
  text-decoration: none;
}

.btn-sm {
  padding: 0.225rem 0.45rem;
  font-size: 0.79rem;
}

.btn-lg {
  padding: 0.54rem 1.08rem;
  font-size: 1.0rem;
}

.btn-block {
  display: block;
  width: 100%;
}

/* Forms */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: inline-block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.form-control {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  line-height: 1.5;
  color: #495057;
  background-color: white;
  background-clip: padding-box;
  border: 1px solid #ced4da;
  border-radius: var(--border-radius);
  transition: var(--transition);
}

.form-control:focus {
  color: #495057;
  background-color: white;
  border-color: var(--primary-color);
  outline: 0;
  box-shadow: 0 0 0 0.2rem rgba(58, 80, 112, 0.25);
}

.form-text {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.875rem;
  color: var(--gray-color);
}

/* Cards */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  word-wrap: break-word;
  background-color: white;
  background-clip: border-box;
  border: 1px solid rgba(0, 0, 0, 0.125);
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  margin-bottom: 1.5rem;
}

.card-header {
  padding: 0.75rem 1.25rem;
  margin-bottom: 0;
  background-color: rgba(0, 0, 0, 0.03);
  border-bottom: 1px solid rgba(0, 0, 0, 0.125);
}

.card-body {
  flex: 1 1 auto;
  padding: 1.25rem;
}

/* Alerts */
.alert {
  position: relative;
  padding: 0.75rem 1.25rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
  border-radius: var(--border-radius);
}

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

.alert-danger {
  color: #721c24;
  background-color: #f8d7da;
  border-color: #f5c6cb;
}

.alert-warning {
  color: #856404;
  background-color: #fff3cd;
  border-color: #ffeeba;
}

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

/* Table */
.table-responsive {
  display: block;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  margin-bottom: 1rem;
  color: #212529;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 0.75rem;
  vertical-align: top;
  border-top: 1px solid #dee2e6;
}

.table thead th {
  vertical-align: bottom;
  border-bottom: 2px solid #dee2e6;
  background-color: var(--primary-color);
  color: white;
}

.table tbody tr:hover {
  background-color: rgba(0, 0, 0, 0.075);
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.25em 0.4em;
  font-size: 75%;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  vertical-align: baseline;
  border-radius: 0.25rem;
}

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

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

.badge-warning {
  color: #212529;
  background-color: var(--warning-color);
}

/* Project specific styles */
.dashboard-header,
.project-header,
.admin-header,
.page-header,
.tab-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr); /* Always 3 columns */
  gap: 1.5rem;
  margin-bottom: 2rem;
}

/* Responsive: 2 columns on medium screens, 1 on small */
@media (max-width: 1400px) {
  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

.project-card {
  background-color: white;
  border-radius: var(--border-radius);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  overflow: visible; /* Allow content to be visible */
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
  min-height: 400px; /* Minimum height for project cards with description */
}

.project-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}


/* Project Header Styling Update */
.project-header {
  padding: 1rem;
  background-color: var(--primary-color);
  color: white;
  margin-bottom: 0;
}

.project-header h1 {
  margin-bottom: 0.5rem;
  color: white; /* Change text color to white */
}

.project-title h1 {
  color: white; /* Ensure heading is white */
}

/* Description inside project-header (on dark background) */
.project-header .project-description {
  margin-top: 0.5rem;
  color: rgba(255, 255, 255, 0.9); /* White for dark header background */
  margin-left: 0;
}

.project-header h3 {
  margin: 0;
  color: white;
}

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

.project-body {
  padding: 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0; /* Allow flex children to shrink */
}

.project-stats {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  flex-shrink: 0; /* Don't shrink stats */
}

.stat {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--gray-color);
}

.project-last-modified {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--gray-color);
}

.project-dates {
  margin-top: auto; /* Push dates to the bottom of project-body */
  padding-top: 0.75rem;
  font-size: 0.8rem;
  color: #888;
  flex-shrink: 0; /* Don't shrink dates */
}

.project-date {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.project-date i {
  width: 14px;
  text-align: center;
  color: #aaa;
}

.project-footer {
  padding: 1rem;
  background-color: #f9f9f9;
  border-top: 1px solid #eee;
}

/* Description inside project-body (on white background) */
.project-body .project-description {
  margin: 0.5rem 0;
  padding: 0.5rem;
  color: #555;
  font-size: 0.875rem;
  line-height: 1.5;
  background-color: #f8f9fa;
  border-radius: 4px;
  min-height: 50px;
  max-height: 70px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.project-body .project-description.text-muted {
  background-color: transparent;
  font-style: italic;
  min-height: auto;
}


.title-container {
  display: flex;
  flex-direction: column;
}

.subtitle {
  margin-top: -0.25rem;
  margin-bottom: 0.75rem;
  font-size: 1.1rem;
}

.project-name {
  font-weight: 600;
  color: var(--primary-color);
}

.item-name {
  font-style: italic;
}





.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  background-color: white;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
}

.empty-state-icon {
  margin-bottom: 1.5rem;
  color: var(--primary-color);
}

.empty-state h2,
.empty-state h3 {
  margin-bottom: 1rem;
}

.empty-state p {
  margin-bottom: 1.5rem;
  color: var(--gray-color);
}

.tabs {
  display: flex;
  overflow: hidden;
  margin-bottom: 1rem;
  border: 1px solid #ddd;
  border-radius: var(--border-radius);
  background-color: #f1f1f1;
}

.tab-button {
  background-color: inherit;
  border: none;
  outline: none;
  cursor: pointer;
  padding: 0.75rem 1rem;
  transition: 0.3s;
  font-size: 1rem;
  flex: 1;
}

.tab-button:hover {
  background-color: #ddd;
}

.tab-button.active {
  background-color: var(--primary-color);
  color: white;
}

/* Custom tab content for admin pages - renamed to avoid Bootstrap conflict */
.admin-tab-content {
  display: none;
  padding: 1rem;
  border: 1px solid #ddd;
  border-radius: var(--border-radius);
  background-color: white;
}

.actions {
  display: flex;
  gap: 0.5rem;
}

.admin-header h1 {
  margin-bottom: 0;
}

.error-page {
  text-align: center;
  padding: 5rem 1rem;
  max-width: 600px;
  margin: 0 auto;
}

.error-code {
  font-size: 6rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 2rem;
}

.error-page h1 {
  margin-bottom: 1rem;
}

.error-page p {
  margin-bottom: 2rem;
  color: var(--gray-color);
}

/* Original Energy APP styles */
.tabela_poczatkowa {
  border-collapse: collapse;
  width: 100%;
}

.tabela_poczatkowa td, .tabela_poczatkowa th {
  border: 1px solid #dddddd;
  text-align: left;
  padding: 8px;
}

.tabela_poczatkowa tr:nth-child(even) {
  background-color: #f2f2f2;
}

.zatwierdz {
  background-color: #4CAF50;
  border: none;
  color: white;
  padding: 10px 20px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-size: 16px;
  margin: 4px 2px;
  cursor: pointer;
}

.wybor_kalkulacji {
  background-color: #4CAF50;
  border: none;
  color: white;
  padding: 10px 20px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-size: 16px;
  margin: 4px 2px;
  cursor: pointer;
}

.custom-table-container {
  width: 100%;
  overflow-x: auto;
  padding: 0;
  margin: 0;
}

.custom-table {
  width: 400%;
  min-width: 400%;
  border-collapse: collapse;
  border-spacing: 0;
  margin: 0;
  padding: 0;
  font-family: 'Calibri', Arial, sans-serif;
  font-size: 12px;
}

.tabela_wyniki {
  border-collapse: collapse;
  width: 100%;
}

.tabela_wyniki td, .tabela_wyniki th {
  border: 1px solid #ddd;
  padding: 8px;
}

.tabela_wyniki tr:nth-child(even){background-color: #f2f2f2;}

.tabela_wyniki tr:hover {background-color: #ddd;}

.tabela_wyniki th {
  padding-top: 12px;
  padding-bottom: 12px;
  text-align: left;
  background-color: #3a5070;
  color: white;
}

.table-container {
  overflow-x: auto;
}

/* Footer */
footer {
  background-color: var(--primary-color);
  color: white;
  text-align: center;
  padding: 1rem 0;
  margin-top: 2rem;
}

footer p {
  margin-bottom: 0.25rem;
}

footer .footer-links a {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-size: 0.875rem;
}

footer .footer-links a:hover {
  color: white;
  text-decoration: underline;
}

.table-container.fixed-height {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid #ddd;
  border-radius: var(--border-radius);
}

/* Make the table use separate borders instead of collapse */
.table-container.fixed-height table,
.table-container.fixed-height .tabela_wyniki,
.table-container.fixed-height .custom-table {
  border-collapse: separate;
  border-spacing: 0;
}

/* Properly position sticky headers */
.table-container.fixed-height table thead th,
.table-container.fixed-height .tabela_wyniki thead th,
.table-container.fixed-height .custom-table thead th,
.table-container.fixed-height table th.sticky-header,
.table-container.fixed-height .tabela_wyniki th.sticky-header,
.table-container.fixed-height .custom-table th.sticky-header,
.table-container.fixed-height .sticky-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background-color: #3a5070;
  color: white;
  /* Add shadows to make headers stand out */
  box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.4);
}

/* Fix for first row in data tables without thead */
.table-container.fixed-height table tr:first-child th,
.table-container.fixed-height .tabela_wyniki tr:first-child th,
.table-container.fixed-height .custom-table tr:first-child th {
  position: sticky;
  top: 0;
  z-index: 10;
  background-color: #3a5070;
  color: white;
}

/* Ensure horizontal scrolling works with sticky headers */
.table-container.fixed-height {
  overflow-x: auto;
}

/* Make sure borders look nice */
.table-container.fixed-height th,
.table-container.fixed-height td {
  border: 1px solid #ddd;
}

/* Chart styling */
.chart-container {
  position: relative;
  margin: auto;
  height: 400px;
  width: 100%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 15px;
  background-color: white;
}

.card-header {
  background-color: #f8f9fa;
  border-bottom: 1px solid rgba(0, 0, 0, 0.125);
  padding: 0.75rem 1.25rem;
  position: relative;
}

/* Navbar-styled header and footer for cards and tables */
.navbar-styled-header {
  background-color: var(--primary-color, #3a5070) !important;
  color: white !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.2);
}

.navbar-styled-header h2,
.navbar-styled-header h3,
.navbar-styled-header h4,
.navbar-styled-header h5,
.navbar-styled-header h6 {
  color: white !important;
}

.navbar-styled-footer {
  background-color: var(--primary-color, #3a5070) !important;
  color: white !important;
}

.navbar-styled-footer th,
.navbar-styled-footer td {
  color: white !important;
  background-color: var(--primary-color, #3a5070) !important;
}

/* Power metrics styling */
.power-metrics {
  display: flex;
  flex-wrap: wrap;
  margin: -5px;
}

.metric {
  flex: 1 0 calc(50% - 10px);
  padding: 8px;
  margin: 5px;
  background-color: #f8f9fa;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s, box-shadow 0.2s;
}

.metric:hover {
  transform: translateY(-2px);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
}

.metric-title {
  font-size: 0.8rem;
  font-weight: bold;
  margin-bottom: 5px;
}

.metric-value {
  font-size: 1.1rem;
  font-weight: 500;
}

.text-primary {
  color: #3a86ff !important;
}

.text-danger {
  color: #ff006e !important;
}

.text-warning {
  color: #ffbe0b !important;
}

.text-success {
  color: #06d6a0 !important;
}

/* Make charts responsive on small screens */
@media (max-width: 768px) {
  .chart-container {
      height: 300px;
  }
  
  .col-md-8, .col-md-4 {
      flex: 0 0 100%;
      max-width: 100%;
  }
  
  .power-summary-chart .row {
      flex-direction: column;
  }
  
  .total-metrics {
      margin-top: 20px;
  }
}

/* Common tooltip styling */
.chart-tooltip {
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  border-radius: 4px;
  padding: 8px;
  font-size: 14px;
  pointer-events: none;
}

/* ======================================
   Tags Input Component
   Multi-group "Grupa urzadzen" field
   ====================================== */

.tags-input-container {
  position: relative;
  width: 100%;
}

.tags-display {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.375rem;
  border: 1px solid #ced4da;
  border-radius: 0.375rem;
  background-color: #fff;
  min-height: 38px;
  cursor: text;
}

.tags-display:focus-within {
  border-color: #86b7fe;
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.tag-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  background-color: var(--primary-color, #3a5070);
  color: #fff;
  border-radius: 0.25rem;
  font-size: 0.875rem;
  line-height: 1;
}

.tag-badge .tag-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  padding: 0;
  margin-left: 0.125rem;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  font-size: 0.625rem;
  transition: background-color 0.15s;
}

.tag-badge .tag-remove:hover {
  background: rgba(255, 255, 255, 0.4);
}

.tags-autocomplete {
  flex: 1;
  min-width: 120px;
  border: none;
  outline: none;
  padding: 0.25rem;
  font-size: 0.875rem;
  background: transparent;
}

.tags-autocomplete::placeholder {
  color: #adb5bd;
}

.tags-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1050;
  background: #fff;
  border: 1px solid #ced4da;
  border-top: none;
  border-radius: 0 0 0.375rem 0.375rem;
  max-height: 200px;
  overflow-y: auto;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.tags-suggestion-item {
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: background-color 0.15s;
}

.tags-suggestion-item:hover {
  background-color: #f8f9fa;
}

.tags-suggestion-item.tags-suggestion-add {
  border-top: 1px solid #e9ecef;
  background-color: #f8fff8;
}

.tags-suggestion-item.tags-suggestion-add:hover {
  background-color: #e8f5e9;
}

/* ======================================
   Table Sorting Component
   Sortable column headers for device tables
   ====================================== */

.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
}

.sort-icon {
  display: inline-block;
  margin-left: 5px;
  opacity: 0.4;
  font-size: 0.75em;
}

.sort-icon::after {
  content: '\2195'; /* ↕ up-down arrow */
}

.sortable.asc .sort-icon {
  opacity: 1;
}

.sortable.asc .sort-icon::after {
  content: '\25B2'; /* ▲ up arrow */
}

.sortable.desc .sort-icon {
  opacity: 1;
}

.sortable.desc .sort-icon::after {
  content: '\25BC'; /* ▼ down arrow */
}

/* ============================================
   GROUPED SUMMARY TABLE STYLES
   ============================================ */

/* Group header row - device type label */
.table-grouped .table-group-header {
  background-color: #e9ecef;
  border-top: 2px solid var(--primary-color, #3a5070);
}

.table-grouped .table-group-header td {
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
}

.table-grouped .group-header-cell {
  background-color: #e9ecef;
}

/* Device rows within group - slight indent */
.table-grouped .table-group-row td:first-child {
  padding-left: 1.5rem;
}

/* Group subtotal row */
.table-grouped .table-group-subtotal {
  background-color: #f8f9fa;
  border-bottom: 1px solid #dee2e6;
}

.table-grouped .table-group-subtotal td {
  font-style: italic;
  color: #495057;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

/* Grand total row (SUMA) - wysokia specyficzność */
.table-grouped .table-summary-total,
.table .table-summary-total,
table.table-grouped tbody tr.table-summary-total {
  background-color: #3a5070 !important;
  color: #ffffff !important;
  font-weight: bold;
}

.table-grouped .table-summary-total td,
.table .table-summary-total td,
table.table-grouped tbody tr.table-summary-total td {
  background-color: #3a5070 !important;
  color: #ffffff !important;
  border-top: 2px solid #2c3e50;
}

/* Hover effects for grouped tables */
.table-grouped .table-group-row:hover {
  background-color: rgba(0, 123, 255, 0.075);
}

.table-grouped .table-group-subtotal:hover {
  background-color: #e9ecef;
}

/* Badge in group header */
.table-grouped .table-group-header .badge {
  font-size: 0.75rem;
  font-weight: normal;
}

/* ============================================
   COLLAPSIBLE GROUP STYLES
   ============================================ */

/* Make group header clickable */
.table-grouped .table-group-header {
  cursor: pointer;
  user-select: none;
}

.table-grouped .table-group-header:hover {
  background-color: #dee2e6;
}

/* Collapse icon animation */
.table-grouped .table-group-header .collapse-icon {
  transition: transform 0.2s ease;
  display: inline-block;
}

.table-grouped .table-group-header[aria-expanded="false"] .collapse-icon {
  transform: rotate(-90deg);
}

/* Smooth collapse transition for table rows */
.table-grouped tr.collapse {
  transition: none;
}

.table-grouped tr.collapse:not(.show) {
  display: none;
}

