/*
 * Teryt24 address widget — the stylesheet.
 *
 * Optional: the widget works without it (the markup is plain and
 * functional), but without it the combobox lists have no positioning and
 * the result grid has no structure.
 *
 * Every rule is scoped under .t24-* so it cannot leak into the host
 * page's own styles, and every colour is a custom property a host page
 * can override:
 *
 *   .t24-form {
 *     --t24-bg: #ffffff;
 *     --t24-fg: #1c2420;
 *     --t24-muted: #5c6b63;
 *     --t24-border: #d7e0db;
 *     --t24-accent: #2f6f4f;
 *     --t24-ok: #1d7a4c;
 *     --t24-warn: #8a5a00;
 *     --t24-bad: #a32626;
 *     --t24-radius: 8px;
 *   }
 */

.t24-form {
  --t24-bg: #ffffff;
  --t24-fg: #1c2420;
  --t24-muted: #5c6b63;
  --t24-border: #d7e0db;
  --t24-accent: #2f6f4f;
  --t24-ok: #1d7a4c;
  --t24-warn: #8a5a00;
  --t24-bad: #a32626;
  --t24-radius: 8px;

  color: var(--t24-fg);
  font: inherit;
  max-width: 34rem;
  position: relative;
}

.t24-hint {
  color: var(--t24-muted);
  font-size: 0.9rem;
  margin: 0 0 1rem;
}

.t24-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.9rem;
  position: relative;
}

.t24-label {
  font-size: 0.85rem;
  font-weight: 600;
}

.t24-input {
  background: var(--t24-bg);
  border: 1px solid var(--t24-border);
  border-radius: var(--t24-radius);
  color: inherit;
  font: inherit;
  padding: 0.55rem 0.7rem;
  width: 100%;
}

.t24-input:focus-visible {
  border-color: var(--t24-accent);
  outline: 2px solid color-mix(in srgb, var(--t24-accent) 35%, transparent);
  outline-offset: 1px;
}

.t24-input:disabled {
  background: color-mix(in srgb, var(--t24-fg) 4%, transparent);
  color: var(--t24-muted);
}

.t24-field-status {
  color: var(--t24-muted);
  font-size: 0.78rem;
  min-height: 1.1em;
}

.t24-list {
  background: var(--t24-bg);
  border: 1px solid var(--t24-border);
  border-radius: var(--t24-radius);
  list-style: none;
  margin: 0;
  max-height: 15rem;
  overflow-y: auto;
  padding: 0;
  position: absolute;
  top: 100%;
  width: 100%;
  z-index: 30;
}

.t24-list[hidden] {
  display: none;
}

.t24-list-item {
  margin: 0;
}

.t24-option {
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.45rem 0.7rem;
  text-decoration: none;
}

.t24-option:hover,
.t24-option[aria-selected="true"] {
  background: color-mix(in srgb, var(--t24-accent) 12%, transparent);
}

.t24-option-name {
  font-weight: 600;
}

.t24-option-context {
  color: var(--t24-muted);
  font-size: 0.78rem;
}

.t24-button {
  background: var(--t24-accent);
  border: 1px solid var(--t24-accent);
  border-radius: var(--t24-radius);
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  padding: 0.55rem 1.1rem;
}

.t24-button:disabled {
  cursor: progress;
  opacity: 0.6;
}

.t24-status {
  color: var(--t24-muted);
  font-size: 0.88rem;
  min-height: 1.2em;
}

.t24-result:empty {
  display: none;
}

.t24-verdict {
  border-radius: var(--t24-radius);
  font-weight: 700;
  margin: 0.5rem 0 0.75rem;
  padding: 0.5rem 0.7rem;
}

.t24-verdict-valid {
  background: color-mix(in srgb, var(--t24-ok) 14%, transparent);
  color: var(--t24-ok);
}

.t24-verdict-corrected {
  background: color-mix(in srgb, var(--t24-warn) 14%, transparent);
  color: var(--t24-warn);
}

.t24-verdict-ambiguous,
.t24-verdict-incomplete {
  background: color-mix(in srgb, var(--t24-muted) 16%, transparent);
  color: var(--t24-fg);
}

.t24-verdict-invalid {
  background: color-mix(in srgb, var(--t24-bad) 14%, transparent);
  color: var(--t24-bad);
}

.t24-result-grid {
  display: grid;
  gap: 0.2rem 1rem;
  grid-template-columns: max-content 1fr;
  margin-bottom: 0.75rem;
}

.t24-result-name {
  color: var(--t24-muted);
  font-size: 0.82rem;
}

.t24-result-value {
  font-size: 0.9rem;
}

.t24-match {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.75rem;
}

.t24-chip {
  background: color-mix(in srgb, var(--t24-fg) 6%, transparent);
  border-radius: 999px;
  font-size: 0.72rem;
  padding: 0.15rem 0.55rem;
}

.t24-chip-exact {
  background: color-mix(in srgb, var(--t24-ok) 14%, transparent);
  color: var(--t24-ok);
}

.t24-chip-normalized,
.t24-chip-partial {
  background: color-mix(in srgb, var(--t24-warn) 16%, transparent);
  color: var(--t24-warn);
}

.t24-chip-ambiguous {
  background: color-mix(in srgb, var(--t24-bad) 12%, transparent);
  color: var(--t24-bad);
}

.t24-issues,
.t24-candidates {
  background: color-mix(in srgb, var(--t24-fg) 4%, transparent);
  border-radius: var(--t24-radius);
  margin-bottom: 0.75rem;
  padding: 0.6rem 0.8rem;
}

.t24-issues-heading,
.t24-candidates-heading {
  font-size: 0.85rem;
  font-weight: 700;
  margin: 0 0 0.4rem;
}

.t24-issues-list,
.t24-candidates-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.t24-issue {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  margin-bottom: 0.45rem;
}

.t24-issue-code {
  background: color-mix(in srgb, var(--t24-fg) 8%, transparent);
  border-radius: 4px;
  font-size: 0.72rem;
  padding: 0.05rem 0.35rem;
  align-self: flex-start;
}

.t24-issue-text {
  font-size: 0.85rem;
}

.t24-candidate {
  background: none;
  border: 1px solid var(--t24-border);
  border-radius: var(--t24-radius);
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
  padding: 0.3rem 0.6rem;
  text-align: left;
  width: 100%;
}

.t24-candidate:hover {
  border-color: var(--t24-accent);
}

.t24-candidates-note {
  color: var(--t24-muted);
  font-size: 0.78rem;
  margin: 0.4rem 0 0;
}
