/**
 * Button Components CSS
 * Premium interactive buttons with micro-interactions
 */

/* ============================================
   BASE BUTTON
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  line-height: 1;
  text-decoration: none;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: 
    transform var(--duration-sm) var(--ease-out),
    box-shadow var(--duration-sm) var(--ease-out),
    background var(--duration-sm) var(--ease-out),
    color var(--duration-sm) var(--ease-out);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

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

.btn:active {
  transform: scale(0.98);
}

/* ============================================
   BUTTON VARIANTS
   ============================================ */

/* Primary */
.btn--primary {
  background: var(--color-accent-primary);
  color: white;
}

.btn--primary:hover {
  background: color-mix(in srgb, var(--color-accent-primary) 85%, black);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md), var(--shadow-glow-sm);
}

/* Secondary */
.btn--secondary {
  background: var(--color-accent-secondary);
  color: var(--color-text-primary);
}

.btn--secondary:hover {
  background: color-mix(in srgb, var(--color-accent-secondary) 85%, black);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Ghost */
.btn--ghost {
  background: transparent;
  color: var(--color-text-primary);
  border: 2px solid currentColor;
}

.btn--ghost:hover {
  background: var(--color-accent-primary);
  color: white;
  border-color: var(--color-accent-primary);
  transform: translateY(-2px);
}

/* Outline */
.btn--outline {
  background: transparent;
  color: var(--color-accent-primary);
  border: 2px solid var(--color-accent-primary);
}

.btn--outline:hover {
  background: var(--color-accent-primary);
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow-sm);
}

/* Glass */
.btn--glass {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--color-text-primary);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn--glass:hover {
  background: rgba(255, 255, 255, 1);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* Dark */
.btn--dark {
  background: var(--color-black);
  color: white;
}

.btn--dark:hover {
  background: var(--color-bg-tertiary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* ============================================
   BUTTON SIZES
   ============================================ */

.btn--sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  border-radius: var(--radius-md);
}

.btn--lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-lg);
  border-radius: var(--radius-xl);
}

.btn--xl {
  padding: var(--space-5) var(--space-10);
  font-size: var(--text-xl);
  border-radius: var(--radius-xl);
}

/* ============================================
   ICON BUTTONS
   ============================================ */

.btn--icon {
  padding: var(--space-3);
  border-radius: var(--radius-full);
}

.btn--icon.btn--sm {
  padding: var(--space-2);
}

.btn--icon.btn--lg {
  padding: var(--space-4);
}

/* ============================================
   MAGNETIC BUTTON
   Follows cursor on hover
   ============================================ */

.btn--magnetic {
  position: relative;
  will-change: transform;
}

/* JS handles the magnetic effect */

/* ============================================
   SOCIAL BUTTONS
   ============================================ */

.social-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: transparent;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  position: relative;
  transition: 
    transform var(--duration-sm) var(--ease-spring),
    background var(--duration-sm) var(--ease-out);
}

.social-btn::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: var(--radius-xl);
  background: var(--color-accent-secondary);
  opacity: 0;
  transition: opacity var(--duration-sm) var(--ease-out);
  z-index: -1;
}

.social-btn:hover {
  transform: translateY(-3px);
}

.social-btn:hover::before {
  opacity: 1;
}

.social-btn svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
  transition: fill var(--duration-sm) var(--ease-out);
}

/* Social brand colors on hover */
.social-btn--github:hover {
  color: #333;
}

.social-btn--linkedin:hover {
  color: #0077B5;
}

.social-btn--twitter:hover {
  color: #1DA1F2;
}

.social-btn--scholar:hover {
  color: #4285F4;
}

.social-btn--email:hover {
  color: var(--color-accent-primary);
}

.social-btn--instagram:hover {
  color: #E4405F;
}

/* ============================================
   CHIP/FILTER BUTTONS
   ============================================ */

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-4);
  background: transparent;
  border: 2px solid var(--color-accent-primary);
  border-radius: var(--radius-full);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--color-accent-primary);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  transition: 
    all var(--duration-sm) var(--ease-out);
}

.chip:hover {
  background: var(--color-accent-primary);
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow-sm);
}

.chip.active {
  background: var(--color-accent-primary);
  color: white;
  box-shadow: var(--shadow-glow-sm);
}

.chip--sm {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
}

/* ============================================
   FLOATING ACTION BUTTON
   ============================================ */

.fab {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  width: 56px;
  height: 56px;
  background: var(--color-accent-primary);
  color: white;
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg), var(--shadow-glow-sm);
  transition: 
    transform var(--duration-sm) var(--ease-spring),
    box-shadow var(--duration-sm) var(--ease-out);
  z-index: var(--z-sticky);
}

.fab:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-xl), var(--shadow-glow-md);
}

.fab:active {
  transform: scale(0.95);
}

.fab svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

/* ============================================
   COPY BUTTON (Email copy)
   ============================================ */

.copy-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--color-surface);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: 
    background var(--duration-sm) var(--ease-out),
    border-color var(--duration-sm) var(--ease-out);
}

.copy-btn:hover {
  background: var(--color-surface-hover);
  border-color: var(--color-accent-primary);
}

.copy-btn__icon {
  width: 16px;
  height: 16px;
  transition: transform var(--duration-sm) var(--ease-spring);
}

.copy-btn:hover .copy-btn__icon {
  transform: scale(1.1);
}

.copy-btn.copied {
  border-color: var(--color-success);
  color: var(--color-success);
}

.copy-btn.copied .copy-btn__icon {
  animation: check-pop 0.3s var(--ease-spring);
}

@keyframes check-pop {
  0% { transform: scale(0); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* Toast notification for copy */
.copy-toast {
  position: fixed;
  bottom: var(--space-8);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: var(--space-3) var(--space-6);
  background: var(--color-bg-secondary);
  color: var(--color-text-inverse);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  opacity: 0;
  pointer-events: none;
  transition: 
    transform var(--duration-md) var(--ease-spring),
    opacity var(--duration-md) var(--ease-out);
  z-index: var(--z-tooltip);
}

.copy-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================================
   SCROLL BUTTONS
   ============================================ */

.scroll-to-top {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  width: 48px;
  height: 48px;
  background: var(--color-surface);
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: 
    opacity var(--duration-md) var(--ease-out),
    visibility var(--duration-md) var(--ease-out),
    transform var(--duration-md) var(--ease-out),
    background var(--duration-sm) var(--ease-out);
  z-index: var(--z-sticky);
}

.scroll-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.scroll-to-top:hover {
  background: var(--color-accent-primary);
  color: white;
  transform: translateY(-4px);
}

.scroll-to-top svg {
  width: 20px;
  height: 20px;
}

/* ============================================
   BUTTON GROUP
   ============================================ */

.btn-group {
  display: inline-flex;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.btn-group .btn {
  border-radius: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.2);
}

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

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

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
  .btn--lg {
    padding: var(--space-3) var(--space-6);
    font-size: var(--text-base);
  }
  
  .fab {
    width: 48px;
    height: 48px;
    bottom: var(--space-4);
    right: var(--space-4);
  }
  
  .scroll-to-top {
    width: 44px;
    height: 44px;
    bottom: var(--space-4);
    right: var(--space-4);
  }
}

/* ============================================
   REDUCED MOTION
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  .btn:hover,
  .social-btn:hover,
  .chip:hover,
  .fab:hover,
  .scroll-to-top:hover {
    transform: none;
  }
  
  .copy-btn.copied .copy-btn__icon {
    animation: none;
  }
}
