/* Button Component Styles */

/* Button Icons */
.btn__icon {
  width: 16px;
  height: 16px;
  margin-right: var(--space-xs);
  vertical-align: middle;
}

/* Base Button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  font-family: var(--font-family-primary);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-normal);
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  outline: none;
  position: relative;
  /* DONI-870: intentional — crops children to the border-radius. */
  overflow: hidden;
}

/* Focus styles — REMOVED by CHR-1 (DONI-555). Do not restore.
 *
 * This block was:
 *
 *   .btn:focus { outline: 2px solid var(--color-primary); outline-offset: 2px; }
 *
 * Two faults, and together they defeated FND-4 on the most common control
 * on the site:
 *
 * 1. `--color-primary` resolves to #f16b50 — the coral. On a coral button
 *    (`.btn--primary`) that is a coral ring on a coral field: measured
 *    1.00:1, i.e. INVISIBLE. This is the exact defect FND-4 was written to
 *    fix, and FND-4's own note calls out the coral button as the motivating
 *    case. It fixed `typography.css`'s `a:focus-visible` and did not catch
 *    this one.
 *
 * 2. `:focus`, not `:focus-visible`, at specificity (0,2,0) — so it beat
 *    the house rule `*:focus-visible` (0,1,0) AND painted a ring after a
 *    mouse click, which FND-4 deliberately designed against.
 *
 * Removing it is NOT sufficient on its own, and this is the subtle part.
 * `.btn { outline: none }` in the base rule above is specificity (0,1,0);
 * so is `*:focus-visible` in interaction.css. They tie — and buttons.css
 * is in the `component` group while interaction.css is in `base`, so
 * buttons.css loads LATER and wins the tie. Deleting only the `:focus`
 * block would therefore have left buttons with NO outline at all.
 *
 * So the house ring is restated here explicitly, from the house tokens.
 * That is exactly what interaction.css asks a component to do rather than
 * dropping to `outline: none`. It is written from the tokens, not from
 * literal values, so changing the ring centrally still changes it here.
 *
 * Verified with real Tab presses at 1440.
 */
.btn:focus-visible,
a.btn:focus-visible,
button.btn:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-outer);
  outline-offset: var(--focus-ring-width);
  box-shadow: 0 0 0 var(--focus-ring-width) var(--focus-ring-inner);
}

/* Disabled state */
.btn:disabled,
.btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Button Variants */

/* Primary Button */
.btn--primary {
  background-color: var(--color-primary);
  color: var(--color-white);
  border-color: var(--color-primary);
}

.btn--primary:hover:not(:disabled) {
  background-color: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn--primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

/* Secondary Button */
.btn--secondary {
  background-color: var(--color-white);
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.btn--secondary:hover:not(:disabled) {
  background-color: var(--color-primary);
  color: var(--color-white);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn--secondary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}


/* Secondary Button */
.btn--tertiary {
  background-color: var(--color-white);
  color: var(--color-primary);
  border-color: var(--color-primary);
  border-radius: 999px !important;
  font-weight: 700;
}

.btn--tertiary:hover:not(:disabled) {
  background-color: var(--color-primary);
  color: var(--color-white);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn--tertiary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

/* Outline Button */
.btn--outline {
  background-color: transparent;
  color: var(--color-secondary);
  border-color: var(--color-secondary);
}

.btn--outline:hover:not(:disabled) {
  background-color: var(--color-secondary);
  color: var(--color-white);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Ghost Button */
.btn--ghost {
  background-color: transparent;
  color: var(--color-primary);
  border-color: transparent;
}

.btn--ghost:hover:not(:disabled) {
  background-color: var(--color-gray-100);
  color: var(--color-primary-dark);
}

/* Dark Button */
.btn--dark {
  background-color: var(--color-secondary);
  color: var(--color-white);
  border-color: var(--color-secondary);
}

.btn--dark:hover:not(:disabled) {
  background-color: var(--color-secondary-dark);
  border-color: var(--color-secondary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Light Button */
.btn--light {
  background-color: var(--color-gray-100);
  color: var(--color-text-primary);
  border-color: var(--color-gray-200);
}

.btn--light:hover:not(:disabled) {
  background-color: var(--color-gray-200);
  border-color: var(--color-gray-300);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Button Sizes */

/* Small */
.btn--sm {
  padding: var(--space-xs) var(--space-md);
  font-size: var(--font-size-sm);
  border-radius: var(--radius-sm);
}

/* Large */
.btn--lg {
  padding: var(--space-md) var(--space-xl);
  font-size: var(--font-size-lg);
  border-radius: var(--radius-lg);
}

/* Extra Large */
.btn--xl {
  padding: var(--space-lg) var(--space-2xl);
  font-size: var(--font-size-xl);
  border-radius: var(--radius-lg);
}

/* Button States */

/* Full Width */
.btn--block {
  display: flex;
  width: 100%;
}

/* Round Button */
.btn--round {
  border-radius: var(--radius-full);
  padding-left: var(--space-xl);
  padding-right: var(--space-xl);
}

/* Icon Button */
.btn--icon-only {
  padding: var(--space-sm);
  aspect-ratio: 1;
}

/* Button with Icon */
.btn__icon {
  width: 1.25em;
  height: 1.25em;
  fill: currentColor;
  flex-shrink: 0;
}

/* Loading State */
.btn--loading {
  color: transparent;
  pointer-events: none;
}

.btn--loading::after {
  content: '';
  position: absolute;
  width: 1em;
  height: 1em;
  top: 50%;
  left: 50%;
  margin-left: -0.5em;
  margin-top: -0.5em;
  border: 2px solid var(--color-white);
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Button Group */
.btn-group {
  display: inline-flex;
  vertical-align: middle;
}

.btn-group > .btn {
  position: relative;
  flex: 0 1 auto;
  border-radius: 0;
}

.btn-group > .btn:first-child {
  border-top-left-radius: var(--radius-md);
  border-bottom-left-radius: var(--radius-md);
}

.btn-group > .btn:last-child {
  border-top-right-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
}

.btn-group > .btn:not(:first-child) {
  margin-left: -2px;
}

.btn-group > .btn:hover,
.btn-group > .btn:focus {
  z-index: 1;
}

/* Responsive Button */
@media (max-width: 767px) {
  .btn--responsive {
    width: 100%;
    display: flex;
  }
}

/* Enhanced Button Styles from Figma */

/* Outline Button Override for Figma Design */
.btn--outline {
  background-color: var(--color-white);
  color: var(--color-primary);
  border: 3px solid var(--color-primary);
  font-family: var(--font-agenda);
  font-size: 20px;
  font-weight: 700;
  border-radius: 999px;
  padding: 11px 24px 11px 24px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  transition: all var(--transition-fast);
}

.btn--outline:hover {
  background-color: var(--color-primary);
  color: var(--color-white);
}

/* Primary Button Override for Figma Design */
.btn--primary {
  background-color: var(--color-primary);
  color: var(--color-white)!important;
  border: none;
  font-family: var(--font-agenda);
  font-size: 20px;
  font-weight: 700;
  border-radius: 999px;
  padding: 11px 24px 13px 24px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  transition: all var(--transition-fast);
}

.btn--primary:hover {
  background-color: var(--color-primary-dark);
}

/* Size Overrides for Figma Design */
.btn--sm {
  padding: 6px 16px 8px 16px;
  font-size: 14px;
}

.btn--lg {
  padding: 11px 24px 13px 24px;
  font-size: 20px;
}

/* Button Icon */
.btn__icon {
  width: 24px;
  height: 24px;
}

.btn__icon.arrow {
  width: 10px;
  height: 15px;
}

.btn span {
  line-height: 1;
}

.rotate-180 {
  transform: rotate(180deg);
}
