/**
 * Button Component
 * shadcn-inspired button system with semantic variants and states
 */

/* Base Button Styles */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  white-space: nowrap;
  border-radius: 0.625rem;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  height: 32px;
  padding: 0 10px;
  transition: all var(--transition-fast);
  cursor: pointer;
  border: 1px solid transparent;
  font-family: var(--font-family-base);
  text-decoration: none;
  user-select: none;
  outline: none;
  line-height: 20px;
}

/* Focus Ring */
.btn:focus-visible {
  outline: 2px solid var(--color-ring);
  outline-offset: 2px;
}

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

/* Primary Button (dark bg, light text) */
.btn-primary {
  background: var(--color-primary);
  color: var(--color-primary-foreground);
}

.btn-primary:hover:not(:disabled) {
  opacity: 0.9;
}

/* Secondary Button (muted bg) */
.btn-secondary {
  background: var(--color-secondary);
  color: var(--color-secondary-foreground);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--color-bg-muted);
}

/* Destructive Button (light red bg, red text — shadcn v5 style) */
.btn-destructive {
  background: rgba(239, 68, 68, 0.1);
  color: var(--color-destructive);
}

.btn-destructive:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.15);
}

/* Ghost Button (transparent, hover fills) */
.btn-ghost {
  background: transparent;
  color: var(--color-foreground);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--color-muted);
}

/* Outline Button (border, white bg) */
.btn-outline {
  background: var(--color-background);
  color: var(--color-foreground);
  border-color: var(--color-border);
}

.btn-outline:hover:not(:disabled) {
  background: var(--color-muted);
}

/* Link Button (text only, underline on hover) */
.btn-link {
  background: transparent;
  color: var(--color-foreground);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.btn-link:hover:not(:disabled) {
  text-decoration: underline;
}

/* Size Variants */
.btn-xs {
  height: 24px;
  padding: 0 8px;
  font-size: 12px;
  border-radius: var(--radius-lg);
  line-height: 16px;
}

.btn-sm {
  height: 28px;
  padding: 0 10px;
  font-size: 12.8px;
  border-radius: var(--radius-lg);
  line-height: 19px;
}

.btn-lg {
  height: 36px;
  padding: 0 10px;
  font-size: var(--font-size-sm);
  line-height: 20px;
}

/* Icon Button */
.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
}

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

/* Toggle Button (shadcn outline toggle) */
.btn-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  white-space: nowrap;
  height: 32px;
  padding: 0 10px;
  border-radius: 0.625rem;
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-muted-foreground);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  font-family: var(--font-family-base);
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast);
  text-decoration: none;
  user-select: none;
  outline: none;
  line-height: 20px;
}

.btn-toggle:hover {
  background: var(--color-muted);
  color: var(--color-foreground);
}

.btn-toggle:focus-visible {
  outline: 2px solid var(--color-ring);
  outline-offset: 2px;
}

.btn-toggle:disabled,
.btn-toggle[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-toggle[aria-pressed="true"],
.btn-toggle--active {
  background: var(--color-muted);
  color: var(--color-foreground);
}

/* Action Button Variants (from 16-action-buttons.css) */
.btn-pay {
  background: transparent;
  color: var(--color-text-muted);
  border-color: var(--color-border-base);
}

.btn-pay:hover:not(:disabled) {
  color: var(--ctp-green);
  border-color: var(--ctp-green);
  background: color-mix(in srgb, var(--ctp-green) 10%, transparent);
}

.btn-paid {
  color: var(--ctp-green);
  background: color-mix(in srgb, var(--ctp-green) 12%, transparent);
  border-color: color-mix(in srgb, var(--ctp-green) 30%, transparent);
}

.btn-paid:hover:not(:disabled) {
  background: color-mix(in srgb, var(--ctp-green) 20%, transparent);
  border-color: var(--ctp-green);
}

.btn-checkin {
  background: transparent;
  color: var(--color-text-muted);
  border-color: var(--color-border-base);
}

.btn-checkin:hover:not(:disabled) {
  color: var(--ctp-blue);
  border-color: var(--ctp-blue);
  background: var(--color-focus-ring);
}

.btn-checked-in {
  background: var(--ctp-blue);
  color: white;
  border-color: var(--ctp-blue);
}

.btn-checked-in:hover:not(:disabled) {
  background: #1559d1;
  border-color: #1559d1;
}

.btn-danger {
  background: transparent;
  color: var(--color-text-muted);
  border-color: var(--color-border-base);
}

.btn-danger:hover:not(:disabled) {
  background: var(--ctp-red);
  color: white;
  border-color: var(--ctp-red);
}

.btn-danger:active:not(:disabled) {
  background: #b90d33;
  border-color: #b90d33;
}

/* In-progress action: keep full color, block extra clicks */
.btn.is-loading {
  pointer-events: none;
  cursor: wait;
}

.btn.is-loading:disabled,
.btn[disabled].is-loading {
  opacity: 1;
}

[data-photo-cropper] {
  position: relative;
}

[data-cropper-overlay] {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: color-mix(in srgb, var(--color-background, #fff) 72%, transparent);
  font-size: 1.125rem;
  font-weight: var(--font-weight-medium);
}

[data-cropper-overlay][hidden] {
  display: none !important;
}

[data-cropper-overlay] .fa-spin {
  font-size: 2rem;
}
