/*
 * Shared interaction primitives. Legacy .btn aliases remain supported while
 * new UI can use the explicit .g-button family.
 */
/*
 * Unclassified links inherit their component context. Readable-copy links use
 * text-links.css; buttons/navigation/cards own explicit variants. This avoids
 * the historical bright-blue fallback leaking into brand names and UI labels.
 */
a { color: inherit; text-decoration: none; }
a:hover { color: inherit; text-decoration: none; }

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--g-color-accent, #53b5ed);
  outline-offset: 2px;
}

/* Legacy named-button family default retained for existing templates. */
[class*="btn-"] {
  color: #fff;
  transition: .3s ease-in-out;
}

.btn {
  display: inline-block;
  max-width: 100%;
  height: var(--g-control-height);
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--g-radius-control);
  color: var(--g-color-link);
  text-align: center;
  white-space: nowrap;
  vertical-align: middle;
  user-select: none;
}

a.btn,
.g-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  min-height: var(--g-control-height);
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--g-radius-control);
  color: var(--g-color-link);
  font-family: var(--g-font-body);
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  vertical-align: middle;
  user-select: none;
}
.btn:hover, .g-button:hover { text-decoration: none; }
.btn:disabled { opacity: .5; }
.g-button:disabled, .g-button[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }

/* Canonical primary action: promoted from the accepted Bonus Listing CTA. */
.btn--p,
.g-button--primary {
  width: 100%;
  border-color: rgba(102, 148, 232, .75);
  border-radius: 13px;
  background: linear-gradient(180deg, #a3c5ff 0%, #83aefa 100%);
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .45),
    0 7px 16px rgba(90, 133, 219, .20);
  font-size: 14px;
  font-weight: 850;
  line-height: 1;
  transition:
    background .16s ease,
    border-color .16s ease,
    box-shadow .16s ease,
    transform .16s ease;
}
.btn--p:hover,
.g-button--primary:hover {
  border-color: rgba(102, 148, 232, .85);
  background: linear-gradient(180deg, #99bcfa 0%, #769fef 100%);
  color: #fff;
  text-decoration: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .38),
    0 10px 22px rgba(90, 133, 219, .30);
  transform: translateY(-1px);
}
.btn--p:active,
.g-button--primary:active { transform: translateY(0); }
.btn--p:focus-visible,
.g-button--primary:focus-visible {
  outline: 0;
  color: #fff;
  box-shadow:
    0 0 0 3px rgba(131, 174, 250, .24),
    inset 0 1px 0 rgba(255, 255, 255, .45),
    0 7px 16px rgba(90, 133, 219, .20);
}

.btn--outp,
.g-button--secondary {
  width: 100%;
  border-color: var(--g-color-accent);
  background: #fff;
  color: var(--g-color-accent);
  font-size: 14px;
  font-weight: 500;
}
.btn--outp:hover { border-color: transparent; background: rgba(83, 181, 237, .9); color: #fff; }
.g-button--secondary:hover { border-color: transparent; background: var(--g-color-accent-hover); color: #fff; }

.btn--g { width: 100%; background: #8c96a1; color: #fff; font-weight: 700; }
.btn--g:hover { background: rgba(83, 181, 237, .9); color: #fff; }
.btn--load { width: 206px; height: 44px; border-color: #91a8cb; color: #91a8cb; }
.btn--load:hover { border-color: rgba(83, 181, 237, .9); background: rgba(83, 181, 237, .9); color: #fff; }

/* Existing form markup alias. New interfaces should prefer .g-* controls. */
.field {
  display: block;
  width: 100%;
  padding: 15px;
  font-size: 14px;
  font-weight: 300;
  line-height: 1.25;
  color: var(--g-color-text);
  background-color: #fff;
  background-clip: padding-box;
  border: 1px solid transparent;
  border-radius: var(--g-radius-control);
}
.field::placeholder {
  color: #211e1e;
  opacity: 1;
}
.field::-ms-expand {
  background-color: transparent;
  border: none;
}
.field::-moz-focusring {
  color: transparent;
  text-shadow: 0 0 0 var(--g-color-text);
}
.field:disabled,
.field[readonly] {
  opacity: 1;
}
textarea.field {
  height: 130px;
  resize: none;
}
.field-icon,
.field-icon-text {
  position: absolute;
  bottom: 0;
  width: 14px;
  height: 14px;
  z-index: 2;
}
.field-icon {
  top: 0;
  left: 20px;
  margin: auto;
}
.field-icon-text {
  top: 21px;
  left: 20px;
}
.field--icon {
  padding-left: 40px;
}

.g-control,
.g-input,
.g-select,
.g-textarea {
  width: 100%;
  min-height: var(--g-control-height);
  border: var(--g-border-standard);
  border-radius: var(--g-radius-control);
  background: var(--g-color-surface);
  color: var(--g-color-text-strong);
  font: inherit;
}
.g-input, .g-select { padding: 0 var(--g-space-4); }
.g-textarea { min-height: 120px; padding: var(--g-space-3) var(--g-space-4); resize: vertical; }
.g-control:disabled, .g-input:disabled, .g-select:disabled, .g-textarea:disabled { opacity: .55; cursor: not-allowed; }

.g-badge,
.g-pill,
.g-status {
  display: inline-flex;
  align-items: center;
  gap: var(--g-space-2);
  min-height: 28px;
  padding: 4px 10px;
  border: var(--g-border-standard);
  border-radius: var(--g-radius-pill);
  background: var(--g-color-surface);
  color: var(--g-color-text-muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
}
.g-status--positive { color: var(--g-color-positive); }
.g-status--warning { color: var(--g-color-warning); }
.g-status--negative { color: var(--g-color-negative); }

/* Legacy quick-filter variant retained until the listing control pass. */
.btn--qf { width: 88px; height: 36px; color: #211e1e; border-color: transparent; }
.btn--qf.ps-r::after {
  content: "";
  position: relative;
  top: 10px;
  margin-left: 8px;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid #91a8cb;
  border-radius: 2px;
  transition: .3s ease-in-out;
}

/* Legacy responsive contracts retained while their templates migrate to named variants. */
@media (min-width: 768px) {
  .btn--outp { font-size: 18px; }
}
@media (max-width: 767.98px) {
  .field:not(.field--icon) { padding: 14px 20px; }
  .btn { height: 46px; }
}
@media (min-width: 992px) {
  .btn--qf { width: 100%; background-color: var(--g-color-page); }
  .btn--qf:hover { border-color: var(--g-color-accent); color: var(--g-color-accent); background-color: #fff; }
  .btn--qf.ps-r::after { top: 12px; }
  .btn--qf.ps-r:hover::after { border-top-color: var(--g-color-accent); }
}
