/* ============================================
   VAT CALCULATOR — additions
      All classes namespaced .vat-*.
   ============================================ */

.vat-calculator {
  max-width: 920px;
  margin: 0 auto;
}

/* Year badge in title */
.vat-year-badge {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.2rem 0.6rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: var(--on-primary);
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 999px;
  vertical-align: middle;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* === Tabs === */
.vat-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.75rem;
}

.vat-tab {
  padding: 0.65rem 1.1rem;
  min-height: 44px;
  border-radius: 999px;
  border: 2px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.vat-tab:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.vat-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}

.vat-section {
  display: none;
  animation: fadeUp 0.2s ease;
}

.vat-section.active {
  display: block;
}

.vat-section-help {
  background: var(--surface);
  border-left: 3px solid var(--primary);
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-size: 0.9rem;
  color: var(--text);
  margin-bottom: 1.25rem;
}

/* === Country/Tier inputs row === */
.vat-country-row {
  display: grid;
  grid-template-columns: 2fr 1.2fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.vat-country-row .input-group { margin-bottom: 0; }

.vat-country-meta {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
}

/* === Operation toggle (segmented) === */
.vat-op-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin: 1.25rem 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.3rem;
}

.vat-op-btn {
  padding: 0.7rem 1rem;
  min-height: 44px;
  background: transparent;
  border: none;
  border-radius: calc(var(--radius) - 4px);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.vat-op-btn:hover { color: var(--text); }

.vat-op-btn.active {
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: 0 1px 3px rgba(var(--primary-rgb), 0.25);
}

/* === Result cards (single mode) === */
.vat-results {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.vat-result-card {
  padding: 1.1rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
  transition: var(--transition);
}

.vat-result-card-tax {
  border-color: var(--warning);
  background: rgba(var(--warning-rgb), 0.06);
}

.vat-result-card-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-color: transparent;
  color: var(--on-primary);
}

.vat-result-card-primary .vat-result-label,
.vat-result-card-primary .vat-result-value {
  color: var(--on-primary);
}

.vat-result-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.vat-result-rate {
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  margin-left: 0.3rem;
  opacity: 0.85;
}

.vat-result-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  word-break: break-word;
}

/* === Action buttons === */
.vat-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
  justify-content: center;
}

.vat-actions .btn {
  min-height: 44px;
  flex: 1 1 auto;
  min-width: 160px;
}

/* === Bulk mode === */
.vat-bulk-table-wrapper {
  overflow-x: auto;
  margin: 1rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.vat-bulk-table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.vat-bulk-table thead {
  background: var(--surface);
}

.vat-bulk-table th {
  text-align: left;
  padding: 0.65rem 0.75rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.vat-bulk-table td {
  padding: 0.4rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.vat-bulk-table tr:last-child td {
  border-bottom: none;
}

.vat-col-net, .vat-col-rate, .vat-col-tax, .vat-col-gross {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.vat-col-tax, .vat-col-gross {
  font-weight: 600;
  color: var(--text);
}

.vat-col-net    { width: 130px; }
.vat-col-rate   { width: 90px; }
.vat-col-tax    { width: 100px; }
.vat-col-gross  { width: 110px; }
.vat-col-action { width: 40px; text-align: center; }

.vat-bulk-input {
  width: 100%;
  padding: 0.45rem 0.6rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text);
  transition: var(--transition);
  font-variant-numeric: tabular-nums;
}

.vat-bulk-input:hover {
  background: var(--bg);
}

.vat-bulk-input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--bg);
}

.vat-bulk-net, .vat-bulk-rate { text-align: right; }

.vat-bulk-remove {
  width: 32px;
  height: 32px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  transition: var(--transition);
}

.vat-bulk-remove:hover {
  color: var(--danger);
  border-color: var(--danger);
  background: rgba(var(--danger-rgb), 0.08);
}

.vat-bulk-empty td {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
  font-style: italic;
}

.vat-bulk-add {
  margin-bottom: 1.25rem;
  width: 100%;
  min-height: 44px;
}

.vat-bulk-totals {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}

.vat-bulk-total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.45rem 0;
  border-bottom: 1px dashed var(--border);
}

.vat-bulk-total-row:last-child { border-bottom: none; }

.vat-bulk-total-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.vat-bulk-total-value {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.vat-bulk-total-grand {
  margin-top: 0.4rem;
  padding-top: 0.7rem;
  border-top: 2px solid var(--border);
  border-bottom: none;
}

.vat-bulk-total-grand .vat-bulk-total-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.vat-bulk-total-grand .vat-bulk-total-value {
  font-size: 1.4rem;
  color: var(--primary);
}

/* === Reverse mode === */
.vat-reverse-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.vat-reverse-result {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.vat-rev-rate-display, .vat-rev-tax-display {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.5rem 0;
}

.vat-rev-tax-display {
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
}

.vat-rev-rate-label, .vat-rev-tax-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.vat-rev-rate-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

.vat-rev-tax-value {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.vat-rev-match-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 0 0 0.6rem;
}

.vat-rev-match-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.5rem;
}

.vat-rev-match-card {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.8rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: var(--transition);
}

.vat-rev-match-card:hover { border-color: var(--primary); }

.vat-rev-match-body {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.vat-rev-match-body strong {
  font-size: 0.85rem;
  color: var(--text);
}

.vat-rev-match-body small {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.vat-rev-no-match {
  margin: 0;
  padding: 1rem;
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.875rem;
  text-align: center;
}

/* === All-rates table === */
.vat-search-row {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
}

.vat-search-row input {
  flex: 1;
}

.vat-rates-meta {
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.vat-rates-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.vat-rates-table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.vat-rates-table thead {
  background: var(--surface);
}

.vat-rates-table th {
  text-align: left;
  padding: 0.7rem 0.75rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.vat-rates-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.vat-col-country small.vat-rates-region {
  display: inline-block;
  margin-left: 0.4rem;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 400;
}

.vat-col-tax {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.vat-col-std {
  font-variant-numeric: tabular-nums;
  color: var(--primary);
  white-space: nowrap;
}

.vat-col-reduced, .vat-col-zero {
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  white-space: nowrap;
}

.vat-rates-empty {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
}

.vat-data-source {
  margin-top: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: right;
  font-style: italic;
}

/* === Mobile (< 700px) === */
@media (max-width: 700px) {
  .vat-country-row {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  .vat-results {
    grid-template-columns: 1fr;
  }
  .vat-reverse-grid {
    grid-template-columns: 1fr;
  }
  .vat-result-value { font-size: 1.3rem; }
  .vat-rev-rate-value { font-size: 1.5rem; }
  .vat-actions .btn { flex: 1 1 100%; }
  .vat-tab {
    flex: 1 1 calc(50% - 0.25rem);
    font-size: 0.85rem;
    padding: 0.55rem 0.75rem;
  }
  .vat-rev-match-grid {
    grid-template-columns: 1fr;
  }
  .vat-search-row {
    flex-direction: column;
    align-items: stretch;
  }
}

