/* ============================================
   Visual Enhancements CSS
   - Smooth scroll animations
   - Skeleton loaders
   - Toast notifications
   - Back-to-top button
   - Copy buttons for code blocks
   ============================================ */

/* Smooth Scroll */
html {
  scroll-behavior: smooth;
}

/* Fade-in Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.fade-in {
  animation: fadeIn 0.6s ease-out forwards;
}

.fade-in-up {
  animation: fadeInUp 0.6s ease-out forwards;
}

.slide-in-left {
  animation: slideInLeft 0.6s ease-out forwards;
}

.slide-in-right {
  animation: slideInRight 0.6s ease-out forwards;
}

.scale-in {
  animation: scaleIn 0.6s ease-out forwards;
}

/* Stagger animation delays */
.stagger-1 {
  animation-delay: 0.1s;
  opacity: 0;
}
.stagger-2 {
  animation-delay: 0.2s;
  opacity: 0;
}
.stagger-3 {
  animation-delay: 0.3s;
  opacity: 0;
}
.stagger-4 {
  animation-delay: 0.4s;
  opacity: 0;
}
.stagger-5 {
  animation-delay: 0.5s;
  opacity: 0;
}

/* Intersection Observer animations */
.animate-on-scroll {
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.animate-on-scroll:not(.visible) {
  opacity: 0;
  transform: translateY(30px);
}

.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================
   Skeleton Loaders
   ============================================ */

@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-secondary) 0%,
    var(--bg-tertiary) 50%,
    var(--bg-secondary) 100%
  );
  background-size: 1000px 100%;
  animation: shimmer 2s infinite;
  border-radius: 8px;
}

.skeleton-text {
  height: 16px;
  margin: 8px 0;
  border-radius: 4px;
}

.skeleton-title {
  height: 24px;
  width: 60%;
  margin: 12px 0;
}

.skeleton-card {
  height: 200px;
  border-radius: 12px;
}

.skeleton-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.skeleton-button {
  height: 40px;
  width: 120px;
  border-radius: 8px;
}

/* Skeleton card layout */
.skeleton-project-card {
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
}

.skeleton-project-card .skeleton-circle {
  margin-bottom: 1rem;
}

.skeleton-project-card .skeleton-title {
  width: 80%;
  margin-bottom: 0.5rem;
}

.skeleton-project-card .skeleton-text {
  width: 100%;
}

.skeleton-project-card .skeleton-text:last-child {
  width: 70%;
}

/* ============================================
   Toast Notifications
   ============================================ */

.toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 400px;
  pointer-events: none;
}

.toast {
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 300px;
  pointer-events: auto;
  animation: slideInRight 0.3s ease-out;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.toast.hiding {
  animation: slideOutRight 0.3s ease-out forwards;
}

@keyframes slideOutRight {
  to {
    transform: translateX(450px);
    opacity: 0;
  }
}

.toast-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: 600;
  margin: 0 0 4px 0;
  font-size: 14px;
}

.toast-message {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
  flex-shrink: 0;
}

.toast-close:hover {
  background: var(--bg-secondary);
  color: var(--text);
}

/* Toast variants */
.toast.success {
  border-color: #00ff9d;
}

.toast.success .toast-icon {
  color: #00ff9d;
}

.toast.error {
  border-color: #ff4757;
}

.toast.error .toast-icon {
  color: #ff4757;
}

.toast.warning {
  border-color: #ffa502;
}

.toast.warning .toast-icon {
  color: #ffa502;
}

.toast.info {
  border-color: #3498db;
}

.toast.info .toast-icon {
  color: #3498db;
}

/* ============================================
   Back to Top Button
   ============================================ */

.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 16px rgba(0, 255, 157, 0.3);
  transition: all 0.3s ease;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
}

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

.back-to-top:hover {
  background: var(--accent-hover);
  transform: translateY(-5px);
  box-shadow: 0 6px 20px rgba(0, 255, 157, 0.5);
}

.back-to-top:active {
  transform: translateY(-2px);
}

/* ============================================
   Code Block Copy Buttons
   ============================================ */

.code-block-wrapper {
  position: relative;
  margin: 1rem 0;
}

.copy-code-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--bg-secondary);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  z-index: 10;
  font-family: inherit;
  font-weight: 500;
}

.copy-code-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text);
  border-color: var(--accent);
}

.copy-code-btn.copied {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

.copy-code-btn i {
  font-size: 14px;
}

/* Ensure code blocks have proper positioning */
pre {
  position: relative;
}

div.highlight,
figure.highlight {
  position: relative;
}

/* ============================================
   Hover Effects & Micro-interactions
   ============================================ */

.hover-lift {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.hover-glow {
  transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
  box-shadow: 0 0 20px rgba(0, 255, 157, 0.3);
}

.hover-scale {
  transition: transform 0.2s ease;
}

.hover-scale:hover {
  transform: scale(1.05);
}

/* Pulse animation for attention */
@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.pulse {
  animation: pulse 2s ease-in-out infinite;
}

/* ============================================
   Mobile Responsiveness
   ============================================ */

@media (max-width: 768px) {
  .toast-container {
    right: 10px;
    left: 10px;
    max-width: none;
  }

  .toast {
    min-width: auto;
  }

  .back-to-top {
    bottom: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
    font-size: 18px;
  }

  .copy-code-btn {
    font-size: 11px;
    padding: 5px 10px;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .back-to-top {
    transition: opacity 0.3s ease, visibility 0.3s ease;
  }
}
