/**
 * @file enhancements.css
 * @description Design enhancements untuk membuat website lebih minimalist, professional, responsive, dan addictive
 * @features Micro-interactions, smooth animations, dopamine triggers, professional polish
 * @version 1.0.0
 */

/* ========================================= */
/* ===   SMOOTH SCROLL & PAGE BEHAVIOR   === */
/* ========================================= */

html {
  scroll-behavior: smooth;
}

* {
  -webkit-tap-highlight-color: rgba(0, 170, 255, 0.1);
}

/* ========================================= */
/* ===      ENHANCED BUTTON STYLES       === */
/* ========================================= */

button, .btn, a.btn {
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Ripple effect on click */
button::before, .btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

button:active::before, .btn:active::before {
  width: 300px;
  height: 300px;
}

/* Enhanced hover states */
button:hover, .btn:hover, a.quick-link-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 170, 255, 0.3);
}

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

/* ========================================= */
/* ===       CARD MICRO-INTERACTIONS     === */
/* ========================================= */

.project-card, .product-card-wrapper, .kegiatan-card, .testimonial-card {
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

.project-card:hover, .product-card-wrapper:hover, .kegiatan-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 15px 35px rgba(0, 170, 255, 0.25);
  border-color: rgba(0, 170, 255, 0.5);
}

/* Subtle pulse animation for featured items */
@keyframes subtlePulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(0, 170, 255, 0.4);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(0, 170, 255, 0);
  }
}

.featured-badge {
  animation: subtlePulse 3s ease-in-out infinite;
}

/* ========================================= */
/* ===    REACTION BUTTON ENHANCEMENTS   === */
/* ========================================= */

.reaction-btn {
  position: relative;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.reaction-btn:hover {
  transform: scale(1.15);
}

.reaction-btn:active {
  transform: scale(0.95);
}

/* Success feedback animation when voted */
@keyframes successPop {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.3);
  }
  100% {
    transform: scale(1);
  }
}

.reaction-btn.voted {
  animation: successPop 0.5s ease;
}

/* Like/Dislike count animation */
@keyframes countUp {
  0% {
    transform: translateY(20px);
    opacity: 0;
  }
  50% {
    transform: translateY(-5px);
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

.like-count, .dislike-count {
  display: inline-block;
  transition: all 0.3s ease;
}

.reaction-btn.voted .like-count,
.reaction-btn.voted .dislike-count {
  animation: countUp 0.5s ease;
  font-weight: bold;
  color: var(--primary-color);
}

/* ========================================= */
/* ===      LOADING & SKELETON STATES    === */
/* ========================================= */

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

.skeleton-loading {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.05) 0%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(255, 255, 255, 0.05) 100%
  );
  background-size: 1000px 100%;
  animation: shimmer 2s infinite linear;
  border-radius: 8px;
}

/* ========================================= */
/* ===     ENHANCED FORM INTERACTIONS    === */
/* ========================================= */

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(0, 170, 255, 0.1);
  transform: scale(1.01);
  transition: all 0.3s ease;
}

/* Floating label effect */
.form-group {
  position: relative;
}

.form-group input:focus + label,
.form-group input:not(:placeholder-shown) + label {
  transform: translateY(-25px) scale(0.85);
  color: var(--primary-color);
}

.form-group label {
  position: absolute;
  left: 12px;
  top: 12px;
  transition: all 0.3s ease;
  pointer-events: none;
  color: var(--dark-text);
}

/* ========================================= */
/* ===      SCROLL REVEAL ANIMATIONS     === */
/* ========================================= */

.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

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

/* Stagger animation for lists */
.animate-on-scroll:nth-child(1) { transition-delay: 0.1s; }
.animate-on-scroll:nth-child(2) { transition-delay: 0.2s; }
.animate-on-scroll:nth-child(3) { transition-delay: 0.3s; }
.animate-on-scroll:nth-child(4) { transition-delay: 0.4s; }
.animate-on-scroll:nth-child(5) { transition-delay: 0.5s; }

/* ========================================= */
/* ===       NOTIFICATION SYSTEM         === */
/* ========================================= */

@keyframes slideInDown {
  from {
    transform: translateY(-100px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes slideOutUp {
  from {
    transform: translateY(0);
    opacity: 1;
  }
  to {
    transform: translateY(-100px);
    opacity: 0;
  }
}

.notification {
  animation: slideInDown 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.notification.hiding {
  animation: slideOutUp 0.3s ease-in-out;
}

/* ========================================= */
/* ===      ENHANCED IMAGE LOADING       === */
/* ========================================= */

img {
  transition: transform 0.3s ease;
}

/* DISABLED: Lazy loading opacity caused images to not appear
img[loading="lazy"] {
  opacity: 0;
}

img.loaded {
  opacity: 1;
}
*/

img:hover {
  transform: scale(1.02);
}

/* ========================================= */
/* ===       NAVIGATION ENHANCEMENTS     === */
/* ========================================= */

nav a {
  position: relative;
  transition: color 0.3s ease;
}

nav a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--primary-color);
  transition: width 0.3s ease, left 0.3s ease;
}

nav a:hover::after,
nav a.active::after {
  width: 100%;
  left: 0;
}

/* ========================================= */
/* ===      SEARCH BAR ENHANCEMENTS      === */
/* ========================================= */

.search-bar {
  position: relative;
}

.search-bar::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50px;
  padding: 2px;
  background: linear-gradient(45deg, transparent, var(--primary-color), transparent);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.search-bar:focus-within::before {
  opacity: 1;
  animation: rotate 3s linear infinite;
}

@keyframes rotate {
  100% {
    transform: rotate(360deg);
  }
}

/* ========================================= */
/* ===      MODAL ENHANCEMENTS           === */
/* ========================================= */

.modal, .project-modal, #identity-modal {
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.modal-content, .project-modal-content, .identity-modal-content {
  animation: modalSlideUp 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes modalSlideUp {
  from {
    transform: translateY(100px) scale(0.9);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

/* ========================================= */
/* ===      PROGRESS INDICATORS          === */
/* ========================================= */

/* Scroll progress bar */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-color), #00ffff);
  z-index: 99999;
  transition: width 0.1s ease;
  box-shadow: 0 0 10px var(--primary-color);
}

/* ========================================= */
/* ===      BADGE & TAG ENHANCEMENTS     === */
/* ========================================= */

.tech-badge, .modal-tech-item, .status-badge {
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  cursor: default;
}

.tech-badge:hover, .modal-tech-item:hover {
  transform: translateY(-3px) scale(1.1);
  box-shadow: 0 5px 15px rgba(0, 170, 255, 0.3);
}

/* ========================================= */
/* ===      CAROUSEL ENHANCEMENTS        === */
/* ========================================= */

.carousel-nav-btn {
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.carousel-nav-btn:hover {
  transform: scale(1.2);
  background-color: var(--primary-color);
  box-shadow: 0 5px 20px rgba(0, 170, 255, 0.5);
}

.carousel-nav-btn:active {
  transform: scale(0.9);
}

/* ========================================= */
/* ===      SOCIAL MEDIA ENHANCEMENTS    === */
/* ========================================= */

.social-media a {
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.social-media a:hover {
  transform: translateY(-5px) rotate(5deg) scale(1.2);
  box-shadow: 0 8px 20px rgba(0, 170, 255, 0.4);
}

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

#open-chatbot-btn {
  transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  animation: floatBounce 3s ease-in-out infinite;
}

@keyframes floatBounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

#open-chatbot-btn:hover {
  transform: scale(1.15) rotate(15deg);
  box-shadow: 0 10px 30px rgba(0, 170, 255, 0.5);
  animation: none;
}

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

@media (max-width: 768px) {
  /* Reduce animation intensity on mobile for better performance */
  .project-card:hover, .product-card-wrapper:hover {
    transform: translateY(-4px) scale(1.01);
  }

  /* Disable hover effects on touch devices */
  @media (hover: none) {
    button:hover, .btn:hover, a.quick-link-item:hover {
      transform: none;
      box-shadow: none;
    }
  }
}

/* ========================================= */
/* ===      ACCESSIBILITY ENHANCEMENTS   === */
/* ========================================= */

/* Focus visible for keyboard navigation */
*:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Reduced motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ========================================= */
/* ===      PERFORMANCE OPTIMIZATIONS    === */
/* ========================================= */

/* Use GPU acceleration for smooth animations */
.project-card, .product-card-wrapper, .kegiatan-card,
button, .btn, .reaction-btn, .carousel-nav-btn {
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* Remove will-change after animation completes to free up resources */
.project-card:not(:hover), .product-card-wrapper:not(:hover) {
  will-change: auto;
}
