/* Shared Datakar tax calculator UI */

.tax-main {
  width: min(100%, 760px);
  margin: 2rem auto 2.5rem;
  padding-inline: 1rem;
  flex: 1;
}

.tax-hero {
  margin-bottom: 1.9rem;
}

.tax-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.55rem;
}

.tax-title-row h1 {
  margin: 0;
  font-size: clamp(1.55rem, 3vw, 2rem);
  line-height: 1.35;
}

.tax-quick-links {
  display: flex;
  align-items: center;
  gap: 0.72rem;
  flex: 0 0 auto;
  padding-top: 0.2rem;
}

.tax-language-toggle,
.tax-all-apps {
  border: 0;
  background: transparent;
  color: var(--dk-muted, #666);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.tax-language-toggle:hover,
.tax-language-toggle:focus-visible,
.tax-all-apps:hover,
.tax-all-apps:focus-visible {
  color: var(--dk-text, #222);
}

.tax-hero p {
  margin: 0;
  color: var(--dk-muted, #666);
  line-height: 1.75;
}

.tax-card {
  padding: clamp(1rem, 3vw, 1.45rem);
  border: 1px solid var(--dk-border, #e0e0e0);
  border-radius: 12px;
  background: var(--dk-surface, #fff);
}

.tax-card + .tax-card,
.tax-card + section,
section + .tax-card {
  margin-top: 1.35rem;
}

.tax-section-title {
  margin: 0 0 1rem;
  font-size: 1.18rem;
  line-height: 1.45;
}

.tax-form {
  display: grid;
  gap: 1rem;
}

.tax-field {
  display: grid;
  gap: 0.42rem;
}

.tax-field label,
.tax-field legend {
  font-weight: 700;
  line-height: 1.5;
}

.tax-field input,
.tax-field select {
  width: 100%;
  min-height: 48px;
  padding: 0.72rem 0.82rem;
  border: 1px solid var(--dk-border, #d8d8d8);
  border-radius: 9px;
  background: var(--dk-bg, #fafafa);
  color: var(--dk-text, #222);
  font: inherit;
  outline: none;
}

.tax-field input:focus,
.tax-field select:focus {
  border-color: color-mix(in srgb, var(--dk-text, #222) 45%, var(--dk-border, #ddd));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--dk-text, #222) 7%, transparent);
}

.tax-field-help,
.tax-rate-status,
.tax-caption,
.tax-note {
  margin: 0;
  color: var(--dk-muted, #666);
  font-size: 0.88rem;
  line-height: 1.65;
}

.tax-rate-status[data-state="success"]::before {
  content: "✓ ";
}

.tax-rate-status[data-state="error"] {
  font-weight: 700;
}

.currency-fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

.currency-fieldset legend {
  margin-bottom: 0.45rem;
  font-weight: 700;
}

.currency-switch {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
  border: 1px solid var(--dk-border, #ddd);
  border-radius: 10px;
  background: var(--dk-bg, #fafafa);
}

.currency-switch label {
  position: relative;
  min-width: 88px;
  cursor: pointer;
}

.currency-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.currency-switch span {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-inline: 0.78rem;
  border-radius: 7px;
  color: var(--dk-muted, #666);
  font-weight: 700;
}

.currency-switch input:checked + span {
  background: var(--dk-text, #222);
  color: var(--dk-surface, #fff);
}

.currency-switch input:focus-visible + span {
  outline: 2px solid var(--dk-text, #222);
  outline-offset: 2px;
}

.tax-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.7rem;
  padding-top: 0.15rem;
}

.tax-primary,
.tax-secondary {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.68rem 1.12rem;
  border-radius: 9px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.tax-primary {
  border: 1px solid var(--dk-text, #222);
  background: var(--dk-text, #222);
  color: var(--dk-surface, #fff);
}

.tax-primary:hover,
.tax-primary:focus-visible {
  opacity: 0.9;
}

.tax-secondary {
  border: 1px solid var(--dk-border, #ddd);
  background: transparent;
  color: var(--dk-text, #222);
}

.tax-secondary:hover,
.tax-secondary:focus-visible {
  background: color-mix(in srgb, var(--dk-text, #222) 6%, transparent);
}

.tax-details {
  border-top: 1px solid var(--dk-border, #ddd);
  padding-top: 0.9rem;
}

.tax-details summary {
  width: fit-content;
  cursor: pointer;
  font-weight: 700;
}

.tax-details-content {
  display: grid;
  gap: 0.9rem;
  padding-top: 0.9rem;
}

.tax-result-card {
  margin-top: 1.35rem;
  padding: clamp(1rem, 3vw, 1.45rem);
  border: 1px solid var(--dk-border, #ddd);
  border-radius: 12px;
  background: var(--dk-surface, #fff);
}

.tax-result-card[hidden] {
  display: none;
}

.tax-result-primary {
  display: grid;
  gap: 0.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--dk-border, #ddd);
}

.tax-result-primary span,
.tax-result-row span {
  color: var(--dk-muted, #666);
  font-size: 0.9rem;
}

.tax-result-primary strong {
  font-size: clamp(1.65rem, 4vw, 2.25rem);
  line-height: 1.25;
}

.tax-result-secondary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem 1rem;
  padding-top: 1rem;
}

.tax-result-row {
  display: grid;
  gap: 0.18rem;
}

.tax-result-row strong {
  line-height: 1.45;
}

.tax-rule {
  grid-column: 1 / -1;
  margin: 0.2rem 0 0;
  padding-top: 0.8rem;
  border-top: 1px solid var(--dk-border, #ddd);
  color: var(--dk-muted, #666);
  font-size: 0.9rem;
  line-height: 1.65;
}

.tax-inline-error {
  margin: 0;
  color: #a32727;
  font-size: 0.9rem;
  font-weight: 700;
}

.tax-info-section {
  margin-top: 1.6rem;
}

.tax-info-section h2 {
  margin: 0 0 0.65rem;
  font-size: 1.1rem;
}

.tax-info-section p {
  margin: 0;
  color: var(--dk-muted, #666);
  line-height: 1.75;
}

.tax-info-section a {
  color: inherit;
  font-weight: 700;
}

.tax-footer {
  padding: 1.1rem 1rem;
  border-top: 1px solid var(--dk-border, #ddd);
  color: var(--dk-muted, #666);
  text-align: center;
  font-size: 0.88rem;
}

@media (prefers-color-scheme: dark) {
  .currency-switch input:checked + span,
  .tax-primary {
    background: #f1f1f1 !important;
    color: #111111 !important;
    border-color: #f1f1f1 !important;
  }

  .tax-inline-error {
    color: #f1b3b3;
  }
}

@media (max-width: 620px) {
  .tax-main {
    margin-top: 1.25rem;
  }

  .tax-title-row {
    display: block;
  }

  .tax-quick-links {
    margin-top: 0.7rem;
    padding-top: 0;
  }

  .tax-result-secondary {
    grid-template-columns: 1fr;
  }
}
