/**
 * Modern Button System - Interactive with micro-animations
 */

@import './design-system.css';

/* Primary button with gradient */
.btn-primary {
  background: var(--gradient-primary);
  border: none;
  border-radius: var(--radius-full);
  color: white;
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  overflow: hidden;

  /* Smooth transitions */
  transition: all var(--transition-base);

  /* Subtle shadow */
  box-shadow:
    0 4px 12px rgba(102, 126, 234, 0.3),
    0 2px 6px rgba(0, 0, 0, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);

  /* Text rendering */
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
}

/* Ripple effect */
.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
  transform: scale(0);
  opacity: 0;
  transition: all 0.6s ease;
}

.btn-primary:active::before {
  transform: scale(2);
  opacity: 1;
  transition: all 0s;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow:
    0 8px 20px rgba(102, 126, 234, 0.4),
    0 4px 12px rgba(0, 0, 0, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-primary:active {
  transform: translateY(0) scale(0.98);
  box-shadow:
    0 2px 8px rgba(102, 126, 234, 0.3),
    0 1px 4px rgba(0, 0, 0, 0.12);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none;
}

/* Secondary button - glassmorphism */
.btn-secondary {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.08),
    rgba(255, 255, 255, 0.04)
  );
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
}

.btn-secondary:hover {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.12),
    rgba(255, 255, 255, 0.08)
  );
  border-color: rgba(99, 102, 241, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.15);
}

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

/* Danger button */
.btn-danger {
  background: linear-gradient(135deg, #f87171, #ef4444);
  border: none;
  border-radius: var(--radius-full);
  color: white;
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
  box-shadow:
    0 4px 12px rgba(239, 68, 68, 0.3),
    0 2px 6px rgba(0, 0, 0, 0.12);
}

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

.btn-danger:active {
  transform: translateY(0) scale(0.98);
}

/* Success button */
.btn-success {
  background: linear-gradient(135deg, #4ade80, #22c55e);
  border: none;
  border-radius: var(--radius-full);
  color: white;
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
  box-shadow:
    0 4px 12px rgba(34, 197, 94, 0.3),
    0 2px 6px rgba(0, 0, 0, 0.12);
}

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

/* Icon button variants */
.btn-icon-primary {
  background: var(--gradient-primary);
  border: none;
  color: white;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-base);
  box-shadow:
    0 4px 12px rgba(102, 126, 234, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn-icon-primary:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow:
    0 8px 20px rgba(102, 126, 234, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Floating action button */
.btn-fab {
  background: var(--gradient-primary);
  border: none;
  border-radius: 50%;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 24px;
  cursor: pointer;
  position: relative;
  overflow: hidden;

  /* Floating shadow */
  box-shadow:
    0 8px 24px rgba(102, 126, 234, 0.4),
    0 4px 12px rgba(0, 0, 0, 0.16);

  transition: all var(--transition-base);
}

.btn-fab::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.3), transparent 70%);
  transform: scale(0);
  opacity: 0;
  transition: all 0.6s ease;
}

.btn-fab:active::before {
  transform: scale(2);
  opacity: 1;
  transition: all 0s;
}

.btn-fab:hover {
  transform: translateY(-4px) scale(1.08);
  box-shadow:
    0 12px 32px rgba(102, 126, 234, 0.5),
    0 6px 16px rgba(0, 0, 0, 0.2);
}

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

/* Button group */
.btn-group {
  display: inline-flex;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  padding: 4px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-group .btn {
  border-radius: var(--radius-md);
  padding: 8px 20px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-group .btn.active {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.btn-group .btn:not(.active):hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

/* Loading state */
.btn.loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn.loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* Audio play button - prominent for mobile */
.audio-play-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 24px;
  min-width: 160px;
  background: linear-gradient(135deg, #4ade80, #22c55e);
  border: none;
  border-radius: var(--radius-lg, 12px);
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow:
    0 4px 12px rgba(34, 197, 94, 0.4),
    0 2px 6px rgba(0, 0, 0, 0.12);
  animation: audioButtonPulse 2s ease-in-out infinite;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.audio-play-btn .audio-icon {
  font-size: 24px;
  line-height: 1;
}

.audio-play-btn .audio-text {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.audio-play-btn .audio-hint {
  font-size: 11px;
  opacity: 0.85;
  font-weight: 400;
}

@keyframes audioButtonPulse {
  0%, 100% {
    box-shadow:
      0 4px 12px rgba(34, 197, 94, 0.4),
      0 2px 6px rgba(0, 0, 0, 0.12);
  }
  50% {
    box-shadow:
      0 6px 20px rgba(34, 197, 94, 0.6),
      0 4px 10px rgba(0, 0, 0, 0.15);
  }
}

.audio-play-btn:hover {
  transform: translateY(-2px);
  box-shadow:
    0 8px 24px rgba(34, 197, 94, 0.5),
    0 4px 12px rgba(0, 0, 0, 0.16);
}

.audio-play-btn:active {
  transform: translateY(0) scale(0.98);
}

.audio-play-btn.loading {
  animation: none;
  opacity: 0.8;
}

.audio-play-btn.success {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  animation: none;
}

.audio-play-btn.error {
  background: linear-gradient(135deg, #f87171, #ef4444);
  animation: none;
}

.audio-play-btn.fade-out {
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.3s ease;
}

.audio-play-btn:disabled {
  cursor: default;
  animation: none;
}

/* Mobile touch optimizations */
@media (max-width: 768px) {
  .btn-primary,
  .btn-secondary,
  .btn-danger,
  .btn-success {
    padding: 14px 32px;
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  .btn-fab {
    width: 64px;
    height: 64px;
    font-size: 28px;
  }

  /* Make audio button even more prominent on mobile */
  .audio-play-btn {
    min-width: 180px;
    padding: 16px 28px;
  }

  .audio-play-btn .audio-icon {
    font-size: 28px;
  }

  .audio-play-btn .audio-text {
    font-size: 16px;
  }

  .audio-play-btn .audio-hint {
    font-size: 12px;
  }
}
