// ============================================
// Buttons
// ============================================

@use "variables" as *;

// Base Button
.jbs-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 400;
  color: #212529;
  text-align: center;
  text-decoration: none;
  vertical-align: middle;
  cursor: pointer;
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  background-color: transparent;
  border: 1px solid transparent;
  padding: 12px 25px;
  font-size: 1rem;
  border-radius: 0.25rem;
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
  transition: all 0.15s ease-in-out;
  line-height: 1;

  &:hover {
    color: $text-dark;
    text-decoration: none !important;
  }

  &:focus {
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba($primary-color, 0.25);
  }

  &:active {
    background-color: transparent;
    border-color: transparent;
    box-shadow: $box-shadow-sm;
  }

  &.disabled,
  &:disabled {
    pointer-events: none;
    opacity: 0.65;
  }
}

// Button Variants
.jbs-btn-primary {
  color: $text-white !important;
  background-color: var(--jbs_brand_color_4_opt);
  border-color: var(--jbs_brand_color_4_opt);

  &:hover {
    color: $text-white !important;
    background-color: var(--jbs_brand_color_5_opt);
    border-color: var(--jbs_brand_color_5_opt);
  }

  &:focus {
    color: $text-white;
    background-color: var(--jbs_brand_color_4_opt);
    border-color: var(--jbs_brand_color_4_opt);
    box-shadow: 0 0 0 0.2rem rgba(var(--jbs_brand_color_4_rgb), 0.5);
  }

  &:active {
    color: $text-white;
    background-color: var(--jbs_brand_color_4_opt);
    border-color: var(--jbs_brand_color_4_opt);
  }
}

.jbs-btn-secondary {
  color: $text-white;
  background-color: #6c757d !important;
  border-color: #6c757d !important;

  &:hover {
    color: $text-white;
    background-color: #5c636a;
    border-color: #565e64;
  }

  &:focus {
    color: $text-white;
    background-color: #5c636a;
    border-color: #565e64;
    box-shadow: 0 0 0 0.2rem rgba(#6c757d, 0.5);
  }

  &:active {
    color: $text-white;
    background-color: #5c636a;
    border-color: #565e64;
  }
}

.jbs-btn-success {
  color: $text-white;
  background-color: #198754;
  border-color: #198754;

  &:hover {
    color: $text-white;
    background-color: #157347;
    border-color: #146c43;
  }

  &:focus {
    color: $text-white;
    background-color: #157347;
    border-color: #146c43;
    box-shadow: 0 0 0 0.2rem rgba(#198754, 0.5);
  }

  &:active {
    color: $text-white;
    background-color: #157347;
    border-color: #146c43;
  }
}

.jbs-btn-danger {
  color: $text-white;
  background-color: #dc3545;
  border-color: #dc3545;
  display: inline-flex;
  align-items: center;
  gap: 4px;

  &:hover {
    color: $text-white;
    background-color: #bb2d3b !important;
    border-color: #b02a37 !important;
  }

  &:focus {
    color: $text-white;
    background-color: #bb2d3b;
    border-color: #b02a37;
    box-shadow: 0 0 0 0.2rem rgba(#dc3545, 0.5);
  }

  &:active {
    color: $text-white;
    background-color: #bb2d3b;
    border-color: #b02a37;
  }

  i {
    display: inline-flex;
  }
}

.jbs-btn-warning {
  color: #000;
  background-color: #ffc107;
  border-color: #ffc107;

  &:hover {
    color: #000;
    background-color: #ffca2c;
    border-color: #ffc720;
  }

  &:focus {
    color: #000;
    background-color: #ffca2c;
    border-color: #ffc720;
    box-shadow: 0 0 0 0.2rem rgba(#ffc107, 0.5);
  }

  &:active {
    color: #000;
    background-color: #ffca2c;
    border-color: #ffc720;
  }
}

.jbs-btn-info {
  color: #000;
  background-color: #0dcaf0;
  border-color: #0dcaf0;

  &:hover {
    color: #000;
    background-color: #31d2f2;
    border-color: #25cff2;
  }

  &:focus {
    color: #000;
    background-color: #31d2f2;
    border-color: #25cff2;
    box-shadow: 0 0 0 0.2rem rgba(#0dcaf0, 0.5);
  }

  &:active {
    color: #000;
    background-color: #31d2f2;
    border-color: #25cff2;
  }
}

.jbs-btn-light {
  color: #000;
  background-color: #f8f9fa;
  border-color: #f8f9fa;

  &:hover {
    color: #000;
    background-color: #d3d4d5;
    border-color: #c6c7c8;
  }

  &:focus {
    color: #000;
    background-color: #d3d4d5;
    border-color: #c6c7c8;
    box-shadow: 0 0 0 0.2rem rgba(#f8f9fa, 0.5);
  }

  &:active {
    color: #000;
    background-color: #d3d4d5;
    border-color: #c6c7c8;
  }
}

.jbs-btn-dark {
  color: $text-white;
  background-color: $text-dark;
  border-color: $text-dark;

  &:hover {
    color: $text-white;
    background-color: #1c1e21;
    border-color: #1a1e21;
  }

  &:focus {
    color: $text-white;
    background-color: #1c1e21;
    border-color: #1a1e21;
    box-shadow: 0 0 0 0.2rem rgba(#212529, 0.5);
  }

  &:active {
    color: $text-white;
    background-color: #1c1e21;
    border-color: #1a1e21;
  }
}

// Button Sizes
.jbs-btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
  border-radius: 0.2rem;
}

.jbs-btn-lg {
  padding: 0.5rem 1rem;
  font-size: 1.125rem;
  border-radius: 0.375rem;
}

// Button Block
.jbs-btn-block {
  display: block;
  width: 100%;
}

// Button Close
.jbs-btn-close {
  box-sizing: content-box;
  width: 1em;
  height: 1em;
  padding: 0.25em 0.25em;
  color: #000;
  background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath d='M.293.293a1 1 0 011.414 0L8 6.586 14.293.293a1 1 0 111.414 1.414L9.414 8l6.293 6.293a1 1 0 01-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 01-1.414-1.414L6.586 8 .293 1.707a1 1 0 010-1.414z'/%3e%3c/svg%3e") center / 1em auto no-repeat;
  border: 0;
  border-radius: 0.25rem;
  opacity: 0.5;

  &:hover {
    color: #000;
    text-decoration: none;
    opacity: 0.75;
  }

  &:focus {
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(#0d6efd, 0.25);
    opacity: 1;
  }

  &:disabled,
  &.disabled {
    pointer-events: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
    opacity: 0.25;
  }
}

.jbs-btn-close-white {
  filter: invert(1) grayscale(100%) brightness(200%);
}


// Choice Gate: Register button (Priority 2 - Solid Dark Green / White Text)
.jbs-btn-register {
  color: #ffffff !important;
  background-color: var(--jbs_brand_color_2_opt, #244034);
  border-color: var(--jbs_brand_color_2_opt, #244034);
  justify-content: center;
  font-weight: 500;
  cursor: pointer;

  &:hover {
    color: #ffffff;
    background-color: #1a2f26;
    border-color: #1a2f26;
  }

  &:focus {
    color: #ffffff;
    background-color: #1a2f26;
    border-color: #1a2f26;
    box-shadow: 0 0 0 0.2rem rgba(36, 64, 52, 0.25);
  }

  &:active {
    color: #ffffff;
    background-color: #15241d;
  }
}

// Choice Gate: Continue as Guest button (Priority 3 - Custom Grey Palette)
.jbs-btn-guest {
  background-color: #bbc0c4;
  color: #212529;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.3s ease;

  &:hover {
    background-color: #a8adb2;
  }

  &:focus {
    color: #5f6368;
    background-color: #e8eaed;
    box-shadow: 0 0 0 0.2rem rgba(189, 193, 198, 0.5);
  }

  &:active {
    color: #3c4043;
    background-color: #e0e3e6;
  }
}