/*
 * Buttons
 *
 * BEM-style component classes for buttons previously emitted by
 * `button_class` in app/helpers/links_helper.rb. The helper has been inlined;
 * the class names below are now written directly in ERB.
 *
 * Usage:
 *   class="btn btn--primary btn--medium"   (default style + size)
 *   class="btn btn--secondary btn--large"  (size only affects .btn--print today;
 *                                           other styles bake in their own padding)
 *
 * Cascade order matters: sizes are defined BEFORE styles so style padding wins.
 * Styles that omit padding (e.g. .btn--print) defer to the size modifier.
 */

.btn {
  display: inline-flex;
  align-items: center;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-weight: 500;
  line-height: 1rem;
  cursor: pointer;
  transition-property:
    color, background-color, border-color, box-shadow, transform, opacity;
  transition-duration: 150ms;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

.btn:focus {
  outline: 2px solid transparent;
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ------------------------------------------------------------------ */
/* Size modifiers                                                     */
/* Defined first so style modifiers can override padding/font-size.   */
/* ------------------------------------------------------------------ */

.btn--small {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  line-height: 1rem;
}

.btn--medium {
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
}

.btn--large {
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
}

/* ------------------------------------------------------------------ */
/* Style modifiers                                                    */
/* ------------------------------------------------------------------ */

/* Plain — neutral white button with grey border */
.btn--plain {
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-xl);
  border-color: var(--color-border-medium);
  background-color: var(--color-surface);
  color: var(--color-ink-light);
  box-shadow: var(--shadow-sm);
}

.btn--plain:hover {
  background-color: var(--color-surface-muted);
}

.btn--plain:focus-visible {
  box-shadow:
    var(--shadow-surface-outline),
    0 0 0 4px var(--color-border-medium);
}

/* Primary — indigo gradient. The "main" call to action. */
.btn--primary {
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-xl);
  background-image: linear-gradient(to right, var(--color-brand), var(--color-brand-strong));
  color: var(--color-ink-inverted);
  box-shadow: var(--shadow-md);
}

.btn--primary:hover {
  background-image: linear-gradient(to right, var(--color-brand-strong), rgb(var(--palette-indigo-700)));
  box-shadow: var(--shadow-lg);
}

.btn--primary:focus-visible {
  box-shadow:
    var(--shadow-surface-outline),
    0 0 0 4px rgb(var(--palette-indigo-400));
}

/* Secondary — green gradient. Used for "Save"/"Guardar" submit buttons. */
.btn--secondary {
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-xl);
  background-image: linear-gradient(to right, var(--color-success), var(--color-success-strong));
  color: var(--color-ink-inverted);
  box-shadow: var(--shadow-md);
}

.btn--secondary:hover {
  background-image: linear-gradient(to right, var(--color-success-strong), rgb(var(--palette-green-700)));
  box-shadow: var(--shadow-lg);
}

.btn--secondary:focus-visible {
  box-shadow:
    var(--shadow-surface-outline),
    0 0 0 4px rgb(var(--palette-green-400));
}

/* Edit — teal gradient. */
.btn--edit {
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-xl);
  background-image: linear-gradient(to right, rgb(var(--palette-teal-400)), rgb(var(--palette-teal-500)));
  color: var(--color-ink-inverted);
  box-shadow: var(--shadow-md);
}

.btn--edit:hover {
  background-image: linear-gradient(to right, rgb(var(--palette-teal-500)), rgb(var(--palette-teal-600)));
  box-shadow: var(--shadow-lg);
}

.btn--edit:focus-visible {
  box-shadow:
    var(--shadow-surface-outline),
    0 0 0 4px rgb(var(--palette-teal-300));
}

/* Action — soft indigo. Tertiary actions next to primary. */
.btn--action {
  display: flex;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  border-radius: var(--radius-xl);
  background-image: linear-gradient(to right, rgb(var(--palette-indigo-100)), rgb(var(--palette-indigo-200)));
  color: rgb(var(--palette-indigo-700));
  box-shadow: var(--shadow-sm);
}

.btn--action:hover {
  box-shadow: var(--shadow-md);
}

.btn--action:focus-visible {
  box-shadow:
    var(--shadow-surface-outline),
    0 0 0 4px rgb(var(--palette-indigo-300));
}

/* Destroy — pink gradient. Destructive actions. */
.btn--destroy {
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-xl);
  background-image: linear-gradient(to right, rgb(var(--palette-pink-400)), rgb(var(--palette-pink-500)));
  color: var(--color-ink-inverted);
  box-shadow: var(--shadow-md);
}

.btn--destroy:hover {
  background-image: linear-gradient(to right, rgb(var(--palette-pink-500)), rgb(var(--palette-pink-600)));
  box-shadow: var(--shadow-lg);
}

.btn--destroy:focus-visible {
  box-shadow:
    var(--shadow-surface-outline),
    0 0 0 4px rgb(var(--palette-pink-300));
}

.btn--soft-blue {
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  background-color: rgb(var(--palette-blue-100));
  color: rgb(var(--palette-blue-700));
  font-size: 0.75rem;
}

.btn--soft-blue:hover {
  background-color: rgb(var(--palette-blue-50));
}

.btn--soft-blue:focus-visible {
  border-color: rgb(var(--palette-blue-300));
  box-shadow: 0 0 0 3px rgb(var(--palette-blue-200));
}

.btn--soft-success {
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  background-color: rgb(var(--palette-emerald-100));
  color: rgb(var(--palette-emerald-700));
  font-size: 0.875rem;
}

.btn--soft-success:hover {
  background-color: rgb(var(--palette-mint-50));
}

.btn--soft-success:focus-visible {
  border-color: rgb(var(--palette-emerald-300));
  box-shadow: 0 0 0 3px rgb(var(--palette-emerald-200));
}

.btn--soft-success:active {
  background-color: rgb(var(--palette-emerald-200));
}

.btn--soft-pink {
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  background-color: rgb(var(--palette-pink-100));
  color: rgb(var(--palette-pink-700));
  font-size: 0.75rem;
}

.btn--soft-pink:hover {
  background-color: rgb(var(--palette-pink-50));
}

.btn--soft-pink:focus-visible {
  border-color: rgb(var(--palette-pink-300));
  box-shadow: 0 0 0 3px rgb(var(--palette-pink-200));
}

.btn--soft-teal {
  background-color: rgb(var(--palette-teal-100));
  color: rgb(var(--palette-teal-700));
}

.btn--soft-teal:hover {
  background-color: rgb(var(--palette-teal-50));
}

.btn--soft-teal:focus-visible {
  border-color: rgb(var(--palette-teal-300));
  box-shadow: 0 0 0 3px rgb(var(--palette-teal-200));
}

.btn--soft-teal:active {
  background-color: rgb(var(--palette-teal-200));
}

.btn--soft-red {
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  background-color: rgb(var(--palette-red-100));
  color: rgb(var(--palette-red-700));
  font-size: 0.75rem;
}

.btn--soft-red:hover {
  background-color: rgb(var(--palette-red-50));
}

.btn--soft-red:focus-visible {
  border-color: rgb(var(--palette-red-300));
  box-shadow: 0 0 0 3px rgb(var(--palette-red-200));
}

.btn__icon {
  inline-size: 1rem;
  block-size: 1rem;
  margin-inline-start: -0.25rem;
  margin-inline-end: 0.5rem;
}

/* Print — minimal white button with inset ring. Padding comes from size. */
.btn--print {
  border-radius: var(--radius-md);
  background-color: var(--color-surface);
  color: var(--color-ink);
  font-weight: 600;
  box-shadow:
    inset 0 0 0 1px var(--color-border-medium),
    var(--shadow-sm);
}

.btn--print:hover {
  background-color: var(--color-surface-muted);
}

.btn--filter-toggle {
  padding: 0.5rem 1rem;
  border-color: var(--color-border-medium);
  border-radius: var(--radius-md);
  background-color: var(--color-surface);
  color: var(--color-ink-light);
  font-size: 0.875rem;
  line-height: 1rem;
}

.btn--filter-toggle:hover {
  color: var(--color-ink-lighter);
}

.btn--filter-toggle:focus {
  border-color: rgb(var(--palette-blue-300));
  box-shadow: 0 0 0 3px rgb(var(--palette-blue-200));
}

.btn--filter-toggle:active {
  background-color: var(--color-surface-muted);
  color: var(--color-ink);
}

.btn__icon--medium {
  inline-size: 1.25rem;
  block-size: 1.25rem;
}

.btn__icon--large {
  inline-size: 1.5rem;
  block-size: 1.5rem;
}

.high5-filter-action {
  margin-inline-end: 1rem;
}
