/*
 * Design System - Buttons
 *
 * Button styles with hand-drawn borders and color splash hover states
 */

.btn {
  display: inline-block;
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  padding: var(--space-sm) var(--space-base);
  background: rgba(255, 255, 255, 0.6);
  border: none;
  cursor: pointer;
  position: relative;
  color: var(--ink-dark);
  border-radius: var(--border-radius-lg);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.7),
    2px 2px 0 rgba(0, 0, 0, 0.08);
  transition: background var(--transition-base);
  text-decoration: none;
  text-align: center;
}

.btn:hover {
  opacity: 1;
}

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

/* Size variants */
.btn-sm {
  font-size: var(--font-size-sm);
  padding: var(--space-xs) var(--space-md);
}

.btn-lg {
  font-size: var(--font-size-lg);
  padding: var(--space-md) var(--space-lg);
}

/* Style variants */
.btn-primary {
  background: linear-gradient(135deg,
    rgba(245, 237, 220, 0.9) 0%,
    rgba(238, 228, 208, 0.9) 100%);
  color: var(--ink-dark);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.12);
}

.btn-primary:hover {
  background: linear-gradient(135deg,
    rgba(238, 228, 208, 0.95) 0%,
    rgba(230, 218, 195, 0.95) 100%);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink-dark);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.95);
}

.btn-success {
  background: linear-gradient(135deg, var(--ui-green) 0%, var(--ui-green-dark) 100%);
  border-color: var(--ui-green-accent);
  color: var(--ink-dark);
  font-weight: var(--font-weight-semibold);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.15);
}

.btn-success:hover {
  background: linear-gradient(135deg, var(--ui-green-dark) 0%, var(--ui-green-accent) 100%);
  border-color: var(--ui-green-accent);
}

.btn-danger {
  font-weight: var(--font-weight-bold);
  border: 2px solid var(--ink-dark);
}

.btn-danger:hover {
  background: var(--ink-dark);
  color: var(--paper-bg);
}

.btn-link {
  background: transparent;
  border: none;
  box-shadow: none;
  color: var(--ink-medium);
  text-decoration: underline;
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--font-size-sm);
}

.btn-link:hover {
  color: var(--ink-dark);
  background: transparent;
  text-decoration: underline;
}

/* Hand-drawn SVG border */
.btn .btn-border {
  position: absolute;
  inset: -2px;
  width: calc(100% + 4px);
  height: calc(100% + 4px);
  pointer-events: none;
  z-index: 0;
}

.btn-text {
  position: relative;
  z-index: 1;
}

/* Button color splash rules are generated dynamically in _color_family_styles.html.erb */

/* Watercolor blur effect on hover */
.btn::before {
  content: '';
  position: absolute;
  inset: -4px;
  opacity: 0;
  filter: blur(10px);
  transition: opacity var(--transition-base);
  z-index: -1;
  border-radius: var(--border-radius-xl);
}

/* Button blur ::before backgrounds are generated dynamically in _color_family_styles.html.erb */

.btn:hover::before {
  opacity: 0.6;
}

/* Close button */
.btn-close {
  background: transparent;
  border: none;
  font-size: var(--font-size-xl);
  line-height: 1;
  cursor: pointer;
  padding: 0;
  color: var(--ink-medium);
}

.btn-close:hover {
  color: var(--ink-dark);
}

/* ============================================
   Mobile Responsive Styles
   ============================================ */

@media (max-width: 768px) {
  /* Buttons - ensure adequate touch targets with proper centering */
  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-sm) var(--space-base);
    font-size: var(--font-size-sm);
    min-height: 44px; /* iOS recommended minimum touch target */
    line-height: 1.2;
  }

  /* Small buttons - still need to be tappable */
  .btn-sm {
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--font-size-xs);
    min-height: 36px;
  }

  /* Icon buttons - larger touch targets */
  .btn-icon {
    padding: var(--space-sm);
    min-width: 44px;
    min-height: 44px;
  }

  /* Button groups - stack on mobile if needed */
  .btn-group {
    flex-wrap: wrap;
  }
}
