/* ==========================================================================
   tax-setup.css — HSN / SAC Master Directory & Tax Grid Styling
   Supports full theme integration, high density, and responsive layouts.
   ========================================================================== */

/* Page Shell & Layout */
.tax-setup-page {
  padding: 0 0 1.5rem 0;
  max-width: 100%;
  margin: 0;
  box-sizing: border-box;
}

/* Metric Ribbon / KPI Stats Grid (Standardized to match Financial Setup tile strip) */
.tax-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.tax-stat-card {
  background: var(--surface-2, var(--panel2, #f8fafc));
  border: 1px solid var(--border, var(--line, #e2e8f0));
  border-left: 3px solid var(--primary, var(--accent, #1f5fbf)) !important;
  border-radius: var(--r, 6px);
  padding: 8px 14px;
  min-height: 74px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  box-sizing: border-box;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  position: relative;
  overflow: hidden;
}

.tax-stat-card:hover {
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.08);
}

.tax-stat-card--primary,
.tax-stat-card--goods,
.tax-stat-card--services,
.tax-stat-card--standard,
.tax-stat-card--exempt {
  border-left: 3px solid var(--primary, var(--accent, #1f5fbf)) !important;
}

.tax-stat-card__label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted, #64748b);
  line-height: 1.2;
  margin-bottom: 2px;
}

.tax-stat-card__value {
  font-size: 19px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--text, #18212f);
}

.tax-stat-card--primary .tax-stat-card__value,
.tax-stat-card--goods .tax-stat-card__value,
.tax-stat-card--services .tax-stat-card__value,
.tax-stat-card--standard .tax-stat-card__value,
.tax-stat-card--exempt .tax-stat-card__value {
  color: var(--text, #18212f);
}

.tax-stat-card__desc {
  font-size: 10.5px;
  line-height: 1.2;
  color: var(--muted, #64748b);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
  font-size: 0.78rem;
  color: var(--muted, #64748b);
  margin-top: 4px;
}

/* Master Card Container */
.tax-card {
  background: var(--panel, var(--surface-1, #ffffff));
  border: 1px solid var(--line, var(--border, #e2e8f0));
  border-radius: var(--radius-lg, 10px);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  overflow: hidden;
}

/* Toolbar & Search Bar */
.tax-toolbar {
  padding: 1.1rem 1.5rem;
  background: var(--toolbar-bg, var(--panel2, var(--surface-2, #f8fafc)));
  border-bottom: 1px solid var(--line, var(--border, #e2e8f0));
}

.tax-toolbar__row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
}

.tax-search-box {
  position: relative;
  flex: 1;
  min-width: 280px;
  max-width: 520px;
}

.tax-search-box__icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  color: var(--muted, #94a3b8);
  pointer-events: none;
}

.tax-search-box__input {
  width: 100%;
  padding-left: 2.6rem;
  padding-right: 2.2rem;
  height: 40px;
  border-radius: var(--radius, 8px);
  border: 1px solid var(--line, var(--border, #cbd5e1));
  background: var(--panel, #ffffff);
  color: var(--text, #0f172a);
  font-size: 0.92rem;
  box-sizing: border-box;
  transition: all 0.2s ease;
}

.tax-search-box__input:focus {
  outline: none;
  border-color: var(--accent, var(--primary, #2563eb));
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.tax-search-box__clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 1rem;
  color: var(--muted, #94a3b8);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tax-search-box__clear:hover {
  color: var(--text, #0f172a);
  background: var(--hover, rgba(0, 0, 0, 0.05));
}

/* Filters & Selects */
.tax-filter-group {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.tax-filter-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.86rem;
}

.tax-filter-item__label {
  color: var(--muted, #64748b);
  font-weight: 500;
}

.tax-filter-item__select {
  height: 38px;
  border-radius: var(--radius, 6px);
  padding: 0 0.85rem;
  font-size: 0.88rem;
  border: 1px solid var(--line, var(--border, #cbd5e1));
  background: var(--panel, #ffffff);
  color: var(--text, #0f172a);
  cursor: pointer;
}

.tax-filter-item__select:focus {
  outline: none;
  border-color: var(--accent, var(--primary, #2563eb));
}

/* Results Metadata Bar */
.tax-meta-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.85rem;
  font-size: 0.84rem;
  color: var(--muted, #64748b);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tax-meta-bar__count {
  font-weight: 600;
  color: var(--text, #0f172a);
}

/* Data Grid / Table Styling */
.tax-table-container {
  overflow-x: auto;
  min-height: 280px;
}

.tax-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  text-align: left;
}

.tax-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--head, var(--panel2, #f1f5f9));
  color: var(--muted, #475569);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 0.85rem 1.1rem;
  border-bottom: 2px solid var(--line, var(--border, #e2e8f0));
  white-space: nowrap;
}

.tax-table tbody tr {
  border-bottom: 1px solid var(--line, var(--border, #e2e8f0));
  transition: background-color 0.12s ease;
}

.tax-table tbody tr:nth-child(even) {
  background: var(--alt, rgba(0, 0, 0, 0.015));
}

.tax-table tbody tr:hover {
  background: var(--hover, rgba(37, 99, 235, 0.05));
}

.tax-table tbody td {
  padding: 0.85rem 1.1rem;
  vertical-align: top;
  color: var(--text, #1e293b);
  line-height: 1.4;
}

/* Code Badge & Copy Button */
.hsn-code-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.hsn-code-text {
  font-family: var(--font-mono, monospace);
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--accent, var(--primary, #1e40af));
  letter-spacing: 0.5px;
  background: rgba(37, 99, 235, 0.08);
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid rgba(37, 99, 235, 0.16);
}

.hsn-copy-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted, #94a3b8);
  padding: 3px 5px;
  border-radius: 4px;
  font-size: 0.85rem;
  transition: all 0.15s ease;
  line-height: 1;
}

.hsn-copy-btn:hover {
  color: var(--accent, #2563eb);
  background: rgba(37, 99, 235, 0.1);
  transform: scale(1.1);
}

.hsn-custom-pill {
  font-size: 0.68rem;
  font-weight: 700;
  color: #7c3aed;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.25);
  padding: 1px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  margin-top: 4px;
  display: inline-block;
}

/* Classification Type Badges */
.hsn-type-tag {
  display: inline-block;
  font-weight: 600;
  font-size: 0.74rem;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.hsn-type-tag--goods {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.hsn-type-tag--services {
  background: rgba(139, 92, 246, 0.12);
  color: #7c3aed;
  border: 1px solid rgba(139, 92, 246, 0.25);
}

/* Chapter & Heading */
.hsn-chapter-title {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text, #0f172a);
}

.hsn-chapter-subtitle {
  font-size: 0.78rem;
  color: var(--muted, #64748b);
  margin-top: 2px;
  line-height: 1.3;
}

/* Description & Highlight */
.hsn-desc-text {
  font-size: 0.9rem;
  color: var(--text, #1e293b);
  line-height: 1.45;
}

.hsn-desc-highlight {
  background: #fef08a;
  color: #854d0e;
  padding: 0 2px;
  border-radius: 2px;
  font-weight: 600;
}

.hsn-notes-callout {
  font-size: 0.78rem;
  color: var(--muted, #64748b);
  margin-top: 5px;
  padding: 3px 8px;
  background: var(--panel2, rgba(0, 0, 0, 0.03));
  border-left: 3px solid var(--accent, #2563eb);
  border-radius: 0 4px 4px 0;
  font-style: italic;
}

/* Tax Rate Badges */
.hsn-rate-pill {
  display: inline-block;
  font-weight: 700;
  font-size: 0.9rem;
  font-family: var(--font-mono, monospace);
  padding: 3px 10px;
  border-radius: 12px;
  line-height: 1.2;
}

.hsn-rate-pill--18 { background: rgba(245, 158, 11, 0.12); color: #d97706; border: 1px solid rgba(245, 158, 11, 0.25); }
.hsn-rate-pill--12 { background: rgba(16, 185, 129, 0.12); color: #059669; border: 1px solid rgba(16, 185, 129, 0.25); }
.hsn-rate-pill--5  { background: rgba(6, 182, 212, 0.12);  color: #0891b2; border: 1px solid rgba(6, 182, 212, 0.25); }
.hsn-rate-pill--28 { background: rgba(239, 68, 68, 0.12);  color: #dc2626; border: 1px solid rgba(239, 68, 68, 0.25); }
.hsn-rate-pill--0  { background: rgba(107, 114, 128, 0.12); color: #4b5563; border: 1px solid rgba(107, 114, 128, 0.25); }

.hsn-split-subtext {
  font-size: 0.74rem;
  color: var(--muted, #64748b);
  margin-top: 3px;
  font-family: var(--font-mono, monospace);
  white-space: nowrap;
}

/* UQC Unit Code */
.hsn-uqc-tag {
  font-family: var(--font-mono, monospace);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted, #475569);
  background: var(--panel2, rgba(0, 0, 0, 0.04));
  padding: 2px 7px;
  border-radius: 4px;
  display: inline-block;
}

/* Action Buttons */
.hsn-action-group {
  display: flex;
  gap: 0.4rem;
  justify-content: flex-end;
}

.hsn-action-btn {
  padding: 4px 10px;
  font-size: 0.82rem;
  border-radius: var(--radius, 5px);
  cursor: pointer;
  transition: all 0.15s ease;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Empty State */
.tax-empty-state {
  padding: 4rem 1.5rem;
  text-align: center;
}

.tax-empty-state__icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
  opacity: 0.85;
}

.tax-empty-state__title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text, #0f172a);
  margin: 0 0 0.5rem 0;
}

.tax-empty-state__desc {
  color: var(--muted, #64748b);
  font-size: 0.92rem;
  max-width: 480px;
  margin: 0 auto 1.5rem auto;
  line-height: 1.5;
}

/* Loading State */
.tax-loading-state {
  padding: 4rem 1.5rem;
  text-align: center;
  color: var(--muted, #64748b);
}

.tax-loading-spinner {
  font-size: 2rem;
  display: inline-block;
  animation: taxSpin 1s infinite linear;
}

@keyframes taxSpin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Responsive Styles */
@media (max-width: 900px) {
  .tax-setup-page {
    padding: 1rem;
  }
  .tax-toolbar__row {
    flex-direction: column;
    align-items: stretch;
  }
  .tax-search-box {
    max-width: 100%;
  }
  .tax-filter-group {
    justify-content: space-between;
  }
}

