/* ==========================================================================
   RLBC Unified Button System (.rl-btn, .rl-chip, .rl-icon-btn, .rl-btn-group)
   ========================================================================== */

/* Base Button Component */
.rl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--rl-btn-h, 48px);
  padding: 0 24px;
  border-radius: var(--rl-radius, 6px);
  font-family: var(--rl-font, 'Ubuntu', system-ui, sans-serif);
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.01em;
  text-transform: none;
  text-decoration: none;
  border: 1.5px solid transparent;
  box-sizing: border-box;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 150ms ease, transform 150ms ease, opacity 150ms ease;
  position: relative;
}

/* Small Button Modifier */
.rl-btn--sm {
  height: var(--rl-btn-h-sm, 40px);
  padding: 0 18px;
  font-size: 14px;
}

/* Full Width Button Modifier */
.rl-btn--full {
  width: 100%;
}

/* Trailing and Leading SVG Icons */
.rl-btn svg {
  flex-shrink: 0;
  pointer-events: none;
}

.rl-btn svg.rl-btn__arrow,
.rl-btn > svg:last-child {
  width: 16px;
  height: 16px;
  transition: transform 150ms ease;
}

.rl-btn:hover svg.rl-btn__arrow,
.rl-btn:hover > svg:last-child {
  transform: translateX(3px);
}

/* 1. Primary Variant */
.rl-btn--primary {
  background-color: var(--rl-red, #B0001B);
  color: #FFFFFF;
  border-color: var(--rl-red, #B0001B);
}

.rl-btn--primary:hover {
  background-color: var(--rl-red-hover, #8E0016);
  border-color: var(--rl-red-hover, #8E0016);
  color: #FFFFFF;
}

/* 2. Secondary Variant (on light backgrounds) */
.rl-btn--secondary {
  background-color: transparent;
  color: var(--rl-navy, #062B33);
  border-color: var(--rl-navy, #062B33);
}

.rl-btn--secondary:hover {
  background-color: var(--rl-navy, #062B33);
  color: #FFFFFF;
}

/* 3. Ghost Variant (on dark / photo backgrounds) */
.rl-btn--ghost {
  background-color: rgba(255, 255, 255, 0.08);
  color: #FFFFFF;
  border-color: rgba(255, 255, 255, 0.55);
}

.rl-btn--ghost:hover {
  background-color: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.85);
  color: #FFFFFF;
}

/* 4. Text Link Variant (card links, Learn More, Express Interest) */
.rl-btn--text {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 0;
  border: 0;
  background: transparent;
  color: var(--rl-red, #B0001B);
  font-family: var(--rl-font, 'Ubuntu', system-ui, sans-serif);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  white-space: normal;
  box-sizing: border-box;
}

.rl-btn--text:hover {
  color: var(--rl-red-hover, #8E0016);
  text-decoration: underline;
}

.on-dark .rl-btn--text,
.rl-btn--text.on-dark {
  color: var(--rl-gold);
}

.on-dark .rl-btn--text:hover,
.rl-btn--text.on-dark:hover {
  color: #FFFFFF;
}

/* 5. Filter Chip (.rl-chip) */
.rl-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--rl-radius, 6px);
  font-family: var(--rl-font, 'Ubuntu', system-ui, sans-serif);
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.01em;
  background-color: #FFFFFF;
  color: var(--rl-ink, #1F2D33);
  border: 1px solid var(--rl-line, #D5DDE0);
  box-sizing: border-box;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  -webkit-appearance: none;
  appearance: none;
  text-decoration: none;
  transition: all 150ms ease;
}

.rl-chip:hover {
  border-color: var(--rl-navy, #062B33);
}

.rl-chip[aria-pressed="true"],
.rl-chip.is-active {
  background-color: var(--rl-navy, #062B33);
  color: #FFFFFF;
  border-color: var(--rl-navy, #062B33);
}

/* 6. Icon Button (.rl-icon-btn) */
.rl-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--rl-line, #D5DDE0);
  background-color: #FFFFFF;
  color: var(--rl-navy, #062B33);
  box-sizing: border-box;
  padding: 0;
  cursor: pointer;
  user-select: none;
  -webkit-appearance: none;
  appearance: none;
  text-decoration: none;
  font-family: var(--rl-font, 'Ubuntu', system-ui, sans-serif);
  font-size: 16px;
  line-height: 1;
  transition: all 150ms ease;
}

.rl-icon-btn:hover {
  border-color: var(--rl-navy, #062B33);
  background-color: #F5F7F8;
}

.on-dark .rl-icon-btn,
.rl-icon-btn.on-dark {
  background-color: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.35);
  color: #FFFFFF;
}

.on-dark .rl-icon-btn:hover,
.rl-icon-btn.on-dark:hover {
  background-color: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.65);
}

/* 7. Button Groups (.rl-btn-group) */
.rl-btn-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

@media (max-width: 480px) {
  .rl-btn-group {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .rl-btn-group > .rl-btn {
    width: 100%;
  }
}

/* 8. Focus States */
.rl-btn:focus-visible,
.rl-chip:focus-visible,
.rl-icon-btn:focus-visible {
  outline: 3px solid var(--rl-navy, #062B33);
  outline-offset: 2px;
}

.on-dark .rl-btn:focus-visible,
.on-dark .rl-chip:focus-visible,
.on-dark .rl-icon-btn:focus-visible,
.rl-btn--ghost:focus-visible {
  outline: 3px solid var(--rl-gold);
  outline-offset: 2px;
}

/* 9. Disabled and Loading States */
.rl-btn:disabled,
.rl-btn[aria-disabled="true"],
.rl-chip:disabled,
.rl-chip[aria-disabled="true"],
.rl-icon-btn:disabled,
.rl-icon-btn[aria-disabled="true"] {
  opacity: 0.55;
  pointer-events: none;
  cursor: not-allowed;
}

.rl-btn.is-loading,
.rl-btn[aria-busy="true"] {
  opacity: 0.75;
  pointer-events: none;
  cursor: wait;
}

.rl-btn.is-loading::before,
.rl-btn[aria-busy="true"]::before {
  content: '';
  width: 16px;
  height: 16px;
  margin-right: 8px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  display: inline-block;
  animation: rl-btn-spin 0.6s linear infinite;
}

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