/* default: 4 columns on wide screens */
.spend-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

/* mobile: 1 column */
@media (max-width: 768px) {
  .spend-grid {
    grid-template-columns: 1fr;
  }
}

/* Card container */
.card-result {
  border: 1px solid #e5e7eb;
  padding: 16px;
  margin-bottom: 18px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

/* Toggle button */
.breakdown-toggle {
  margin-top: 10px;
  background: #f3f4f6;
  color: #111827;
  padding: 6px 12px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s ease;
}
.breakdown-toggle:hover {
  background: #e5e7eb;
}

/* Hidden breakdown container */
.breakdown-table {
  display: none;
  margin-top: 12px;
  overflow-x: auto; /* horizontal scroll on mobile if needed */
}

/* Table styling */
.cashback-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  text-align: center; /* center all cells */
}
.cashback-table thead {
  background: #f9fafb;
}
.cashback-table th,
.cashback-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #e5e7eb;
}
.cashback-table th {
  font-weight: 600;
  color: #374151;
}
.cashback-table td {
  color: #111827;
}
.cashback-table tr:hover td {
  background: #f3f4f6;
}

/* Responsive for mobile */
@media (max-width: 600px) {
  .cashback-table th,
  .cashback-table td {
    font-size: 12px; /* smaller font */
    padding: 6px 6px;
  }
  .breakdown-table {
    overflow-x: auto; /* allow horizontal scroll if needed */
  }
}


.cashback-table .totals td {
  background:#f9fafb;
  font-weight:700;
  border-top:2px solid #ddd;
}


#analysis-loading {
  display: none;
  text-align: center;
  margin: 12px 0;
  font-size: 16px;
}
#analysis-loading::after {
  content: "";
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-left: 6px;
  border: 2px solid #ccc;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
