/* ==========================================================================
   Custom Portfolio Styles
   ========================================================================== */

/* ==========================================================================
   Base Animations and Keyframes
   ========================================================================== */

/* Animation keyframes */
@keyframes rotate360 {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

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

@keyframes blob {
  0% {
    transform: translate(0px, 0px) scale(1);
  }
  33% {
    transform: translate(30px, -50px) scale(1.1);
  }
  66% {
    transform: translate(-20px, 20px) scale(0.9);
  }
  100% {
    transform: translate(0px, 0px) scale(1);
  }
}

/* Modern animations and transitions */
.theme-transition {
  transition: background-color 0.3s ease, color 0.3s ease;
}

.rotate-animation {
  animation: rotate360 0.5s ease;
}

/* Loading animation */
#loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #ffffff;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.5s ease;
}

.dark #loader {
  background: #1e293b;
}

.loaded {
  opacity: 1;
  animation: fadeIn 0.5s ease;
}

/* Image lazy loading animation */
.fade-in {
  opacity: 1;
  transition: opacity 0.5s ease;
}

img[data-src] {
  opacity: 0;
}

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

/* Focus styles for accessibility */
*:focus {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

.dark *:focus {
  outline-color: #818cf8;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.dark ::-webkit-scrollbar-track {
  background: #1e293b;
}

::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* Card hover effects */
.group:hover .bg-white\/80 {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.dark .group:hover .bg-white\/80 {
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

/* Skill icon hover effects */
.skill-icon {
  transition: transform 0.3s ease;
}

.skill-icon:hover {
  transform: scale(1.1);
}

/* ==========================================================================
   Layout and Navigation Styles
   ========================================================================== */

/* Transition styles */
.transition-all {
  transition: all 0.3s ease;
}

/* Custom scrollbar for thumbnail gallery */
.scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

/* Touch-friendly navigation buttons */
.touch-manipulation {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Mobile modal improvements */
@media (max-width: 640px) {
  #projectDetailModal .relative {
    margin: 0;
  }

  /* Ensure modal doesn't exceed viewport */
  #projectDetailModal .max-h-\[95vh\] {
    max-height: 100vh;
  }

  /* Better touch targets */
  #projectDetailModal button {
    min-height: 44px;
    min-width: 44px;
  }
}

/* Smooth image transitions */
#modalMainImage {
  transition: opacity 0.2s ease-in-out;
}

/* Better thumbnail styling */
#thumbnailGallery img {
  flex-shrink: 0;
  border: 2px solid transparent;
  transition: all 0.2s ease;
}

/* JavaScript manipulated styles moved to CSS classes */
.image-fade-in {
  opacity: 0.7;
}

.image-fade-complete {
  opacity: 1;
}

.nav-btn-visible {
  opacity: 1 !important;
  display: block !important;
}

.nav-btn-faded {
  opacity: 0.5 !important;
  display: block !important;
}

.nav-btn-hidden {
  display: none !important;
}

.counter-visible {
  display: block !important;
}

.counter-hidden {
  display: none !important;
}

.modal-body-scroll-lock {
  overflow: hidden !important;
}

.hamburger-line-1-open {
  transform: rotate(45deg) translate(2px, 5px) !important;
}

.hamburger-line-2-open {
  opacity: 0 !important;
}

.hamburger-line-3-open {
  transform: rotate(-45deg) translate(2px, -5px) !important;
}

.hamburger-line-1-closed {
  transform: rotate(0) translate(0, 0) !important;
}

.hamburger-line-2-closed {
  opacity: 1 !important;
}

.hamburger-line-3-closed {
  transform: rotate(0) translate(0, 0) !important;
}

.loader-fade-out {
  opacity: 0 !important;
}

.loader-hidden {
  display: none !important;
}

/* Hamburger menu transition */
#hamburger span {
  transition: all 0.3s ease;
}

/* ==========================================================================
   JavaScript Dynamic Classes
   ========================================================================== */

/* Enhanced Skills Section Hover Effects */
.skill-item {
  position: relative;
  overflow: hidden;
}

.skill-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(147, 51, 234, 0.1),
    transparent
  );
  transition: left 0.6s ease;
  z-index: 1;
}

.skill-item:hover::before {
  left: 100%;
}

.skill-item .skill-card {
  position: relative;
  z-index: 2;
}

/* Enhanced skill icon animations */
.skill-item:hover img {
  transform: scale(1.1) rotate(12deg);
  filter: drop-shadow(0 8px 16px rgba(147, 51, 234, 0.3));
}

.skill-item img {
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Skill card background glow effect */
.skill-item:hover .skill-card {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 20px 40px rgba(147, 51, 234, 0.15),
    0 8px 16px rgba(59, 130, 246, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transform: translateY(-8px) scale(1.05);
}

.dark .skill-item:hover .skill-card {
  background: rgba(31, 41, 55, 0.95);
  box-shadow: 0 20px 40px rgba(147, 51, 234, 0.25),
    0 8px 16px rgba(59, 130, 246, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Skill name enhanced animation */
.skill-item:hover .skill-name {
  color: #7c3aed;
  transform: translateY(-2px);
}

.dark .skill-item:hover .skill-name {
  color: #a855f7;
}

.skill-name {
  transition: all 0.3s ease;
}

/* Enhanced underline animation */
.skill-underline {
  height: 2px;
  background: linear-gradient(90deg, #7c3aed, #3b82f6, #06b6d4);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.skill-item:hover .skill-underline {
  transform: scaleX(1);
}

/* Filter button enhanced effects */
.filter-btn {
  position: relative;
  overflow: hidden;
}

.filter-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(147, 51, 234, 0.2),
    transparent
  );
  transition: left 0.4s ease;
  z-index: 0;
}

.filter-btn:hover::before {
  left: 100%;
}

.filter-btn span {
  position: relative;
  z-index: 1;
}

.filter-btn:hover {
  background: rgba(147, 51, 234, 0.1);
  color: #7c3aed;
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 8px 16px rgba(147, 51, 234, 0.2);
}

.dark .filter-btn:hover {
  background: rgba(147, 51, 234, 0.15);
  color: #a855f7;
}

.filter-btn.active {
  background: linear-gradient(135deg, #7c3aed, #3b82f6);
  color: white;
  transform: scale(1.05);
  box-shadow: 0 8px 16px rgba(147, 51, 234, 0.3);
}

/* Staggered animation for skill items */
.skill-item:nth-child(1) {
  animation-delay: 0.1s;
}
.skill-item:nth-child(2) {
  animation-delay: 0.2s;
}
.skill-item:nth-child(3) {
  animation-delay: 0.3s;
}
.skill-item:nth-child(4) {
  animation-delay: 0.4s;
}
.skill-item:nth-child(5) {
  animation-delay: 0.5s;
}
.skill-item:nth-child(6) {
  animation-delay: 0.6s;
}

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

.skill-item:hover img {
  animation: skillPulse 2s infinite;
}

/* ==========================================================================
   About Cards Modern Hover Effects
   ========================================================================== */

/* Enhanced card hover effects */
.about-card {
  position: relative;
  overflow: hidden;
  transform-style: preserve-3d;
  transition: all 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.about-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    rgba(139, 92, 246, 0.1) 0%,
    rgba(59, 130, 246, 0.1) 50%,
    rgba(147, 51, 234, 0.1) 100%
  );
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: 1;
}

.about-card:hover::before {
  opacity: 1;
}

.about-card:hover {
  transform: translateY(-12px) rotateX(5deg) rotateY(5deg);
  box-shadow: 0 25px 50px rgba(139, 92, 246, 0.3),
    0 0 0 1px rgba(139, 92, 246, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.dark .about-card:hover {
  box-shadow: 0 25px 50px rgba(139, 92, 246, 0.4),
    0 0 0 1px rgba(139, 92, 246, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* Card image effects */
.about-card-image {
  position: relative;
  overflow: hidden;
  transition: all 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.about-card-image::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    rgba(139, 92, 246, 0.2) 0%,
    rgba(59, 130, 246, 0.2) 100%
  );
  opacity: 0;
  transition: opacity 0.4s ease;
}

.about-card:hover .about-card-image::after {
  opacity: 1;
}

.about-card:hover .about-card-image img {
  transform: scale(1.15) rotate(2deg);
  filter: brightness(1.1) contrast(1.1);
}

/* Card content effects */
.about-card-content {
  position: relative;
  z-index: 2;
  transition: all 0.4s ease;
}

.about-card:hover .about-card-content {
  transform: translateY(-8px);
}

.about-card-title {
  position: relative;
  overflow: hidden;
  transition: all 0.4s ease;
}

.about-card-title::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(135deg, #8b5cf6, #3b82f6);
  transition: width 0.4s ease;
}

.about-card:hover .about-card-title::before {
  width: 100%;
}

/* Magnetic hover effect */
.about-card-magnetic {
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

/* Glow effect */
.about-card-glow {
  position: relative;
}

.about-card-glow::after {
  content: "";
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(
    135deg,
    rgba(139, 92, 246, 0.8),
    rgba(59, 130, 246, 0.8),
    rgba(147, 51, 234, 0.8)
  );
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: -1;
  filter: blur(8px);
}

.about-card-glow:hover::after {
  opacity: 1;
}

/* Animated gradient background */
.about-card-gradient {
  position: relative;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.9),
    rgba(255, 255, 255, 0.8)
  );
  background-size: 200% 200%;
  animation: gradientShift 8s ease infinite;
}

.dark .about-card-gradient {
  background: linear-gradient(
    135deg,
    rgba(31, 41, 55, 0.9),
    rgba(55, 65, 81, 0.8)
  );
  background-size: 200% 200%;
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Icon hover effects */
.about-card-icon {
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.about-card:hover .about-card-icon {
  transform: scale(1.2) rotate(5deg);
  filter: drop-shadow(0 4px 8px rgba(139, 92, 246, 0.3));
}

/* Text reveal animation */
.about-card-text {
  transition: all 0.4s ease;
  transform: translateY(10px);
  opacity: 0.8;
}

.about-card:hover .about-card-text {
  transform: translateY(0);
  opacity: 1;
}

/* Ripple effect */
.about-card-ripple {
  position: relative;
  overflow: hidden;
}

.about-card-ripple::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(139, 92, 246, 0.1);
  transition: all 0.6s ease;
  transform: translate(-50%, -50%);
}

.about-card-ripple:hover::before {
  width: 300px;
  height: 300px;
}

/* Additional responsive and accessibility improvements */
@media (max-width: 768px) {
  .about-card:hover {
    transform: translateY(-8px) rotateX(2deg) rotateY(2deg);
  }

  .about-card:hover .about-card-content {
    transform: translateY(-4px);
  }
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  .about-card,
  .about-card-image img,
  .about-card-content,
  .about-card-icon {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }

  .about-card:hover {
    transform: none !important;
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.2) !important;
  }
}

/* Enhanced focus states for accessibility */
.about-card:focus-within {
  outline: 2px solid #6366f1;
  outline-offset: 4px;
  transform: translateY(-4px);
}

/* Skill tags hover effects */
.about-card span {
  transition: all 0.3s ease;
}

.about-card:hover span {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
