/* ============================================================================
   DREAMDRAGON - BUTTON COMPONENTS
   ============================================================================ */

/* === BASE BUTTON === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-xl);
  font-family: var(--font-family-primary);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  line-height: 1;
  text-decoration: none;
  border: none;
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  user-select: none;
  min-height: 44px; /* Accessibility - minimum touch target */
}

.btn:focus-visible {
  outline: 2px solid var(--accent-neon);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

/* === PRIMARY BUTTON === */
.btn.primary {
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
  color: var(--text-main);
  box-shadow: 0 8px 20px rgba(124, 58, 237, 0.3);
  border: 1px solid transparent;
}

.btn.primary::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(124, 58, 237, 0.4);
}

.btn.primary:hover::before {
  opacity: 1;
}

.btn.primary:active {
  transform: translateY(0);
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
}

/* === SECONDARY BUTTON === */
.btn.secondary {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
}

.btn.secondary:hover {
  background: var(--bg-alt);
  border-color: var(--accent-purple);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.6);
}

.btn.secondary:active {
  transform: translateY(0);
}

/* === SUCCESS BUTTON === */
.btn.success {
  background: linear-gradient(135deg, var(--accent-neon), #16a34a);
  color: var(--text-main);
  box-shadow: 0 8px 20px rgba(34, 197, 94, 0.3);
}

.btn.success:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(34, 197, 94, 0.4);
}

/* === DANGER BUTTON === */
.btn.danger {
  background: linear-gradient(135deg, var(--accent-red), #dc2626);
  color: var(--text-main);
  box-shadow: 0 8px 20px rgba(239, 68, 68, 0.3);
}

.btn.danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(239, 68, 68, 0.4);
}

/* === WARNING BUTTON === */
.btn.warning {
  background: linear-gradient(135deg, var(--accent-orange), #ea580c);
  color: var(--text-main);
  box-shadow: 0 8px 20px rgba(249, 115, 22, 0.3);
}

.btn.warning:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(249, 115, 22, 0.4);
}

/* === GHOST BUTTON === */
.btn.ghost {
  background: transparent;
  color: var(--accent-purple);
  border: 1px solid var(--accent-purple);
}

.btn.ghost:hover {
  background: var(--accent-purple-soft);
  color: var(--text-main);
  transform: translateY(-1px);
}

/* === OUTLINE BUTTON === */
.btn.outline {
  background: transparent;
  color: var(--text-main);
  border: 2px solid var(--border-subtle);
}

.btn.outline:hover {
  background: var(--bg-card);
  border-color: var(--accent-purple);
  transform: translateY(-1px);
}

/* === LINK BUTTON === */
.btn.link {
  background: transparent;
  color: var(--accent-blue);
  border: none;
  padding: var(--space-sm);
  text-decoration: underline;
  text-underline-offset: 4px;
  min-height: auto;
}

.btn.link:hover {
  color: var(--accent-purple);
  text-decoration-color: var(--accent-purple);
  transform: none;
}

/* === BUTTON SIZES === */
.btn.small {
  padding: var(--space-sm) var(--space-lg);
  font-size: var(--font-size-xs);
  min-height: 36px;
  border-radius: var(--radius-lg);
}

.btn.large {
  padding: var(--space-lg) var(--space-2xl);
  font-size: var(--font-size-base);
  min-height: 52px;
  border-radius: var(--radius-2xl);
}

.btn.xl {
  padding: var(--space-xl) var(--space-3xl);
  font-size: var(--font-size-lg);
  min-height: 60px;
  border-radius: var(--radius-2xl);
}

/* === ICON BUTTONS === */
.btn.icon-only {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-lg);
}

.btn.icon-only.small {
  width: 36px;
  height: 36px;
}

.btn.icon-only.large {
  width: 52px;
  height: 52px;
}

.btn-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.btn.large .btn-icon {
  width: 18px;
  height: 18px;
}

.btn.xl .btn-icon {
  width: 20px;
  height: 20px;
}

/* === LOADING STATE === */
.btn.loading {
  color: transparent;
  cursor: wait;
  pointer-events: none;
}

.btn.loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: var(--radius-pill);
  animation: spin 1s linear infinite;
}

.btn.loading.large::after,
.btn.loading.xl::after {
  width: 18px;
  height: 18px;
}

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

/* === BUTTON GROUPS === */
.btn-group {
  display: inline-flex;
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.btn-group .btn {
  border-radius: 0;
  border-right: 1px solid var(--border-subtle);
}

.btn-group .btn:first-child {
  border-top-left-radius: var(--radius-xl);
  border-bottom-left-radius: var(--radius-xl);
}

.btn-group .btn:last-child {
  border-top-right-radius: var(--radius-xl);
  border-bottom-right-radius: var(--radius-xl);
  border-right: none;
}

.btn-group .btn:only-child {
  border-radius: var(--radius-xl);
  border-right: none;
}

/* === FLOATING ACTION BUTTON === */
.fab {
  position: fixed;
  bottom: var(--space-xl);
  right: var(--space-xl);
  width: 56px;
  height: 56px;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
  color: var(--text-main);
  border: none;
  box-shadow: 0 8px 25px rgba(124, 58, 237, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-dropdown);
  transition: all var(--transition-fast);
}

.fab:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 35px rgba(124, 58, 237, 0.5);
}

.fab:active {
  transform: translateY(-2px);
}

/* === RESPONSIVE === */
@media screen and (max-width: 768px) {
  .btn {
    padding: var(--space-md) var(--space-lg);
    min-height: 48px; /* Larger touch targets on mobile */
  }

  .btn.large {
    padding: var(--space-lg) var(--space-xl);
    font-size: var(--font-size-base);
    min-height: 56px;
  }

  .btn.xl {
    padding: var(--space-xl) var(--space-2xl);
    font-size: var(--font-size-lg);
    min-height: 64px;
  }

  .fab {
    bottom: var(--space-lg);
    right: var(--space-lg);
    width: 52px;
    height: 52px;
  }
}

@media screen and (max-width: 475px) {
  .btn-group {
    flex-direction: column;
  }

  .btn-group .btn {
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }

  .btn-group .btn:first-child {
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  }

  .btn-group .btn:last-child {
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
    border-bottom: none;
  }

  .fab {
    bottom: var(--space-md);
    right: var(--space-md);
  }
}

/* === SPECIAL EFFECTS === */
.btn.glow {
  position: relative;
}

.btn.glow::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: linear-gradient(45deg, var(--accent-purple), var(--accent-blue), var(--accent-neon), var(--accent-purple));
  background-size: 300% 300%;
  animation: gradient-shift 3s ease infinite;
  z-index: -1;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.btn.glow:hover::before {
  opacity: 1;
}

@keyframes gradient-shift {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

/* === COPY BUTTON SPECIFIC === */
.btn.copy-success {
  background: linear-gradient(135deg, var(--accent-neon), #16a34a);
  transform: scale(0.95);
}

.btn.copy-success::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-lg);
  animation: checkmark 0.5s ease-out;
}

@keyframes checkmark {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  50% {
    transform: scale(1.2);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}
