/* Button component shared styles and legacy mappings for existing pages. */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: 6px;
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  color: var(--text-color-text, #ffffff);
  font-family: 'Inter', sans-serif;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.button__content {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.button__icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.button--xsm .button__icon {
  width: 14px;
  height: 14px;
}

.button__label,
.button__price {
  color: inherit;
}

.button--lg {
  padding: 14px 30px;
  font-size: 12px;
  line-height: 18px;
  font-weight: 600;
}

.button--md {
  padding: 11px 22px;
  font-size: 12px;
  line-height: 18px;
  font-weight: 600;
}

.button--sm {
  padding: 6px 12px;
  font-size: 12px;
  line-height: 18px;
  font-weight: 500;
}

.button--xsm {
  padding: 6px 12px;
  font-size: 11px;
  line-height: 16px;
  font-weight: 500;
}

.button--primary,
.button--primary.button--state-default,
.button--primary.button--state-pressed {
  background: var(--surface-primarybuttonbg, #2b9ff4);
  border-color: transparent;
}

.button--primary:hover,
.button--primary.button--state-hover {
  background: var(--surface-primarybuttonbghover, #0b7fd4);
}

.button--secondary,
.button--secondary.button--state-default,
.button--secondary.button--state-pressed {
  background: var(--surface-page, #2e2e2e);
  border-color: var(--surface-border, #464646);
}

.button--secondary:hover,
.button--secondary.button--state-hover {
  border-color: var(--surface-borderhover, #747474);
}

.button:active,
.button.button--state-pressed {
  transform: translateY(0);
}

.button[disabled],
.button.is-disabled {
  opacity: 0.55;
  pointer-events: none;
}

.button--pill {
  border-radius: 100px;
}

/* Legacy mappings moved from page CSS files */
.btn-join {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 100%;
  background: var(--surface-primarybuttonbg, #2b9ff4);
  color: var(--text-color-text, #ffffff);
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 500;
  line-height: 16px;
  cursor: pointer;
  text-decoration: none;
  font-family: 'Inter', sans-serif;
  transition: background-color 0.16s ease;
}

.btn-join:hover {
  background: var(--surface-primarybuttonbghover, #0b7fd4);
}

.btn-join img {
  width: 14px;
  height: 14px;
}

.search-input-btn {
  width: 339px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: 1px solid var(--surface-border, #464646);
  border-radius: 100px;
  padding: 10px 15px;
  height: 40px;
  color: var(--text-color-text, #ffffff);
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 400;
  cursor: pointer;
  will-change: transform;
  transition: border-color 0.24s ease, background-color 0.24s ease, box-shadow 0.24s ease, transform 0.2s ease;
}

.filter-btn:hover {
  border-color: var(--surface-borderhover, #747474);
  background: rgba(255, 255, 255, 0.03);
  transform: translateY(-1px);
}

.filter-btn:active {
  transform: translateY(0);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.14);
}

.filter-btn:focus-visible {
  outline: none;
  border-color: var(--primary-default, #2b9ff4);
  box-shadow: 0 0 0 2px rgba(43, 159, 244, 0.35);
}

.filter-btn.is-open {
  border-color: var(--primary-default, #2b9ff4);
  background: rgba(43, 159, 244, 0.08);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.24);
}

.filter-btn img.icon {
  width: 14px;
  height: 14px;
}

.filter-btn img.chevron {
  width: 14px;
  height: 14px;
  transform: rotate(90deg);
  transition: transform 0.22s cubic-bezier(0.2, 0.9, 0.2, 1);
}

@media (prefers-reduced-motion: reduce) {
  .filter-btn,
  .filter-btn img.chevron {
    transition: none;
  }

  .filter-btn:hover,
  .filter-btn:active {
    transform: none;
    box-shadow: none;
  }
}

.detail-buy-link,
.detail-preview-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 1 0 0;
  min-width: 0;
  border-radius: 6px;
  padding: 11px 22px;
  font-size: 12px;
  line-height: 18px;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  color: #ffffff;
  font-family: 'Inter', sans-serif;
  transition: background-color 0.16s ease, border-color 0.16s ease;
}

.detail-buy-link {
  background: var(--surface-primarybuttonbg, #2b9ff4);
}

.detail-buy-link:hover {
  background: var(--surface-primarybuttonbghover, #0b7fd4);
}

.detail-preview-link {
  border: 1px solid var(--surface-border, #464646);
  background: var(--surface-page, #2e2e2e);
}

.detail-preview-link:hover {
  border-color: var(--surface-borderhover, #747474);
}

.detail-btn-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Light theme button parity */
[data-theme="light"] .button--primary,
[data-theme="light"] .button--primary.button--state-default,
[data-theme="light"] .button--primary.button--state-pressed,
[data-theme="light"] .btn-join,
[data-theme="light"] .detail-buy-link {
  color: #ffffff;
}

[data-theme="light"] .button--primary .button__icon,
[data-theme="light"] .btn-join img,
[data-theme="light"] .detail-buy-link .detail-btn-icon {
  filter: brightness(0) saturate(100%) invert(1);
}

[data-theme="light"] .button--secondary,
[data-theme="light"] .button--secondary.button--state-default,
[data-theme="light"] .button--secondary.button--state-pressed,
[data-theme="light"] .detail-preview-link {
  background: var(--surface-page);
  color: var(--text-color-text);
  border-color: var(--surface-border);
}

[data-theme="light"] .button--secondary:hover,
[data-theme="light"] .button--secondary.button--state-hover,
[data-theme="light"] .detail-preview-link:hover {
  background: var(--surface-page);
  border-color: var(--surface-borderhover);
}

[data-theme="light"] .button--secondary .button__icon,
[data-theme="light"] .detail-preview-link .detail-btn-icon {
  filter: brightness(0) saturate(100%);
}

[data-theme="light"] .filter-btn img.icon,
[data-theme="light"] .filter-btn img.chevron {
  filter: invert(1);
}
