/* Modular Table Cards & Subtables */

.month-card {
  background: var(--surface-1);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 0px !important;
  box-shadow: var(--shadow-soft);
  transition: var(--transition-smooth);
}

.month-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  margin-bottom: 0;
}

.month-card-header[data-expanded="true"] {
  margin-bottom: 0.75rem !important;
}

.month-card-header:hover {
  color: var(--color-primary);
}

.subgroup-section {
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md);
  margin-bottom: 0px !important;
  overflow: visible; /* Crucial: allow row-level shadows to paint outside the subtable area */
}

.subgroup-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  cursor: pointer;
  user-select: none;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: none;
  font-weight: 600;
  font-size: 0.95rem;
}

.subgroup-section-header[data-expanded="true"] {
  border-bottom: 1px solid rgba(255, 255, 255, 0.03) !important;
}

.subgroup-section-header:hover {
  background: rgba(99, 102, 241, 0.05);
}

.receipts-subtable {
  width: 100%;
  border-collapse: collapse !important;
  border-spacing: 0;
  text-align: left;
  font-size: 0.9rem;
}

.receipts-subtable th {
  display: none; /* Hide header inside subtables; handled by container subgroup header */
}

.receipts-subtable td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-glow);
}

.receipts-subtable tr:last-child td {
  border-bottom: none;
}

.receipts-subtable tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

/* Outstanding glow highlight on the subtable cells (immune to collapse and container clipping) */
@keyframes glowing-pulse-text-yellow {
  0% {
    color: #ffffff;
    font-weight: normal;
    text-shadow: none;
  }
  50% {
    color: #facc15; /* yellow-400 */
    font-weight: bold;
    text-shadow: 0 0 8px rgba(250, 204, 21, 0.5);
  }
  100% {
    color: #ffffff;
    font-weight: normal;
    text-shadow: none;
  }
}

.last-receipt-glowing-highlight td {
  background-color: rgba(249, 115, 22, 0.08) !important;
  border-top: 2.5px solid #ff6b00 !important;
  border-bottom: 2.5px solid #ff6b00 !important;
  filter: drop-shadow(0 0 4px rgba(255, 107, 0, 0.7));
  animation: glowing-pulse-text-yellow 2s infinite ease-in-out;
}

.last-receipt-glowing-highlight td:first-child {
  border-left: 2.5px solid #ff6b00 !important;
}

.last-receipt-glowing-highlight td:last-child {
  border-right: 2.5px solid #ff6b00 !important;
}

/* Visibility Control helper */
.hidden {
  display: none !important;
}

/* Desktop Column Alignment System */
@media (min-width: 900px) {
  .table-container table,
  .receipts-subtable {
    table-layout: fixed !important;
    width: 100% !important;
  }
  
  .table-container table thead th:nth-child(1),
  .receipts-subtable td:nth-child(1) {
    width: 15% !important;
    box-sizing: border-box !important;
  }
  .table-container table thead th:nth-child(2),
  .receipts-subtable td:nth-child(2) {
    width: 35% !important;
    box-sizing: border-box !important;
  }
  .table-container table thead th:nth-child(3),
  .receipts-subtable td:nth-child(3) {
    width: 12% !important;
    box-sizing: border-box !important;
  }
  .table-container table thead th:nth-child(4),
  .receipts-subtable td:nth-child(4) {
    width: 16% !important;
    box-sizing: border-box !important;
  }
  .table-container table thead th:nth-child(5),
  .receipts-subtable td:nth-child(5) {
    width: 14% !important;
    box-sizing: border-box !important;
  }
  .table-container table thead th:nth-child(6),
  .receipts-subtable td:nth-child(6) {
    width: 8% !important;
    box-sizing: border-box !important;
    text-align: center !important;
  }
}

/* Mobile Highlight System */
@media (max-width: 899px) {
  /* Style the row element itself as a seamless rounded border box container */
  .table-container table tbody tr.last-receipt-glowing-highlight {
    display: flex !important;
    flex-wrap: wrap !important;
    border: 2.5px solid #ff6b00 !important;
    border-bottom: 2.5px solid #ff6b00 !important;
    border-radius: var(--radius-md, 8px) !important;
    background-color: rgba(249, 115, 22, 0.08) !important;
    filter: drop-shadow(0 0 5px rgba(255, 107, 0, 0.75)) !important;
    box-sizing: border-box !important;
    padding: 8px 12px !important;
    margin-bottom: 4px !important;
  }

  /* Clear the cell-specific highlight styles to prevent stepped borders and gaps */
  .table-container table tbody tr.last-receipt-glowing-highlight td {
    border: none !important;
    background: transparent !important;
    filter: none !important;
    padding: 0 !important; /* Let row layout manage padding */
  }
}


