/*
 * Boltex buttons in any new UI block use this class. Import /shared/button.css
 * once per page. Provide optional leading SVG and trailing .boltex-button-count.
 * For example: <button type="button" class="boltex-button">Сохранить</button>
 * For icon-only controls, use data-icon-only and an accessible label.
 * Context and theme may set the color variables. Keep geometry and type here.
 */
.boltex-button {
  --boltex-button-size: 32px;

  appearance: none;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--boltex-button-size);
  min-height: var(--boltex-button-size);
  padding: 0 13px;
  border: 1px solid var(--boltex-button-border, var(--premium-line, var(--boltex-button-default-border, #e8eaee)));
  border-radius: 6px;
  background: var(--boltex-button-bg, var(--premium-surface, var(--boltex-button-default-bg, #fff)));
  color: var(--boltex-button-color, var(--premium-ink, var(--boltex-button-default-color, #171717)));
  font: 500 11px/1 Inter, system-ui, sans-serif;
  letter-spacing: normal;
  white-space: nowrap;
  cursor: pointer;
}

.boltex-button[hidden] {
  display: none;
}

.boltex-button:hover:not(:disabled, [aria-disabled="true"], [aria-busy="true"]) {
  background: var(--boltex-button-hover-bg, var(--premium-hover, var(--boltex-button-default-hover, #eff1f4)));
  border-color: var(--boltex-button-hover-border, var(--boltex-button-border, var(--premium-line, var(--boltex-button-default-border, #e8eaee))));
  color: var(--boltex-button-hover-color, var(--boltex-button-color, var(--premium-ink, var(--boltex-button-default-color, #171717))));
}

.boltex-button:focus-visible {
  outline: 2px solid var(--boltex-button-focus, var(--premium-accent, Highlight));
  outline-offset: 2px;
}

.boltex-button:is(:disabled, [aria-disabled="true"]) {
  opacity: .6;
  cursor: not-allowed;
}

.boltex-button[aria-busy="true"] {
  cursor: progress;
}

.boltex-button > svg {
  width: 15px;
  height: 15px;
  flex: none;
}

.boltex-button-count {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  box-sizing: border-box;
  border-radius: 5px;
  background: var(--boltex-button-count-bg, var(--premium-soft, transparent));
  font-variant-numeric: tabular-nums;
}

.boltex-button[data-icon-only] {
  width: var(--boltex-button-size);
  padding: 0;
}

.boltex-button--primary {
  --boltex-button-bg: var(--premium-fill, #285747);
  --boltex-button-color: #fff;
  --boltex-button-border: var(--boltex-button-bg);
  --boltex-button-hover-bg: #285747;
}

.boltex-button--accent {
  --boltex-button-color: #285747;
  --boltex-button-bg: #edf5f1;
  --boltex-button-border: #9fb8ad;
  --boltex-button-hover-bg: #e3efe9;
}

.boltex-button--text {
  --boltex-button-bg: transparent;
  --boltex-button-border: transparent;
  --boltex-button-color: var(--premium-accent, var(--boltex-button-text-color, #36735c));
  --boltex-button-hover-bg: transparent;
}

.boltex-button--text:hover:not(:disabled, [aria-disabled="true"], [aria-busy="true"]) {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.boltex-button--danger {
  --boltex-button-color: #b54a44;
  --boltex-button-bg: #fbefee;
  --boltex-button-border: #edc7c4;
  --boltex-button-hover-bg: #f7e2e0;
}

html[data-theme="dark"] {
  --boltex-button-default-border: #333;
  --boltex-button-default-bg: #222;
  --boltex-button-default-color: #eee;
  --boltex-button-default-hover: #303030;
  --boltex-button-text-color: #94c4ad;
}

html[data-theme="dark"] .boltex-button--primary {
  --boltex-button-bg: #32735b;
}

html[data-theme="dark"] .boltex-button--accent {
  --boltex-button-color: #a1d4c2;
  --boltex-button-bg: #2b2b2b;
  --boltex-button-border: #34604d;
  --boltex-button-hover-bg: #1d3529;
}

html[data-theme="dark"] .boltex-button--danger {
  --boltex-button-color: #f2a6a1;
  --boltex-button-bg: #392525;
  --boltex-button-border: #67403d;
  --boltex-button-hover-bg: #4c2d2c;
}

@media (max-width: 620px) {
  .boltex-button {
    --boltex-button-size: 40px;
  }
}
