/* ============================================
   ACHIEVEMENTS SECTION ENHANCEMENTS
   ============================================ */

/* Achievements Section Container */
#ach {
  position: relative;
  overflow: hidden;
}

#ach::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(239, 55, 36, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(239, 55, 36, 0.03) 0%, transparent 50%);
  pointer-events: none;
}

/* Masonry-style Grid Layout */
#ach .row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 25px;
  margin-top: 2rem !important;
}

#ach .row > [class*="col-"] {
  max-width: 100%;
  flex: none;
  padding: 0;
}

/* Achievement Card Base Styles */
#ach .card-service {
  position: relative;
  background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
  border: none;
  border-radius: 20px;
  padding: 30px 25px;
  height: 100%;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.08),
    0 5px 15px rgba(0, 0, 0, 0.05);
  transform-style: preserve-3d;
}

/* Ribbon/Badge Decoration */
#ach .card-service::before {
  content: '';
  position: absolute;
  top: 15px;
  right: -35px;
  width: 120px;
  height: 25px;
  background: linear-gradient(135deg, #ef3724 0%, #ff6b5b 100%);
  transform: rotate(45deg);
  box-shadow: 0 2px 10px rgba(239, 55, 36, 0.3);
  opacity: 0;
  transition: opacity 0.3s ease;
}

#ach .card-service.winner::before {
  opacity: 1;
}

#ach .card-service.winner::after {
  content: '★';
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 14px;
  color: #ffd700;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
  animation: starPulse 2s ease-in-out infinite;
  z-index: 10;
}

@keyframes starPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.2);
    opacity: 0.8;
  }
}

/* Gradient Background on Hover */
#ach .card-service::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg,
    rgba(239, 55, 36, 0.05) 0%,
    rgba(255, 107, 91, 0.08) 50%,
    rgba(239, 55, 36, 0.05) 100%);
  opacity: 0;
  transition: opacity 0.4s ease;
  border-radius: 20px;
  z-index: 0;
}

#ach .card-service:hover::after {
  opacity: 1;
}

#ach .card-service:hover {
  transform: translateY(-15px) scale(1.02);
  box-shadow:
    0 25px 50px rgba(239, 55, 36, 0.15),
    0 15px 30px rgba(0, 0, 0, 0.1);
}

/* Icon Container with Animation */
#ach .card-service .icon {
  position: relative;
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #fff 0%, #f0f0f0 100%);
  border-radius: 50%;
  box-shadow:
    0 8px 25px rgba(0, 0, 0, 0.1),
    inset 0 -2px 5px rgba(0, 0, 0, 0.05);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 1;
}

/* Decorative ring around icon */
#ach .card-service .icon::before {
  content: '';
  position: absolute;
  top: -5px;
  left: -5px;
  right: -5px;
  bottom: -5px;
  border-radius: 50%;
  border: 2px dashed rgba(239, 55, 36, 0.3);
  animation: iconRingSpin 20s linear infinite;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#ach .card-service:hover .icon::before {
  opacity: 1;
}

@keyframes iconRingSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Icon Rotation Animation on Hover */
#ach .card-service .icon img,
#ach .card-service .icon .icon-50 {
  width: 45px;
  height: 45px;
  object-fit: contain;
  transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#ach .card-service:hover .icon {
  background: linear-gradient(145deg, #ef3724 0%, #ff6b5b 100%);
  box-shadow:
    0 10px 30px rgba(239, 55, 36, 0.3),
    inset 0 -2px 5px rgba(0, 0, 0, 0.1);
  transform: scale(1.1);
}

#ach .card-service:hover .icon img,
#ach .card-service:hover .icon .icon-50 {
  transform: rotate(360deg) scale(1.1);
  filter: brightness(0) invert(1);
}

/* Trophy/Medal Glow Effect */
#ach .card-service .icon::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(239, 55, 36, 0.4) 0%, transparent 70%);
  transform: translate(-50%, -50%) scale(0);
  transition: transform 0.4s ease;
  border-radius: 50%;
}

#ach .card-service:hover .icon::after {
  transform: translate(-50%, -50%) scale(1.5);
  animation: trophyGlow 1.5s ease-in-out infinite;
}

@keyframes trophyGlow {
  0%, 100% {
    opacity: 0.6;
    transform: translate(-50%, -50%) scale(1.3);
  }
  50% {
    opacity: 0.3;
    transform: translate(-50%, -50%) scale(1.6);
  }
}

/* Caption Styles */
#ach .card-service .caption {
  position: relative;
  z-index: 1;
  text-align: center;
}

#ach .card-service .caption h4 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 10px;
  background: linear-gradient(135deg, #ef3724 0%, #ff6b5b 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  transition: all 0.3s ease;
}

#ach .card-service:hover .caption h4 {
  transform: scale(1.05);
}

#ach .card-service .caption p {
  font-size: 0.9rem;
  color: #666;
  line-height: 1.6;
  margin: 0;
  transition: color 0.3s ease;
}

#ach .card-service:hover .caption p {
  color: #444;
}

/* Achievement Count Badge */
.achievement-count {
  display: inline-block;
  font-size: 2rem;
  font-weight: 800;
  color: #ef3724;
  margin-bottom: 5px;
}

/* Confetti Canvas Container */
#ach .card-service .confetti-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  border-radius: 20px;
  z-index: 100;
}

/* Shimmer Effect on Card */
#ach .card-service .shimmer {
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.4) 50%,
    transparent 100%
  );
  transform: skewX(-20deg);
  transition: left 0.6s ease;
  z-index: 2;
  pointer-events: none;
}

#ach .card-service:hover .shimmer {
  left: 150%;
}

/* Achievement Level Indicators */
#ach .card-service[data-level="gold"] {
  border-left: 4px solid #ffd700;
}

#ach .card-service[data-level="silver"] {
  border-left: 4px solid #c0c0c0;
}

#ach .card-service[data-level="bronze"] {
  border-left: 4px solid #cd7f32;
}

/* Floating particles in achievement cards */
#ach .card-service .particle {
  position: absolute;
  width: 6px;
  height: 6px;
  background: rgba(239, 55, 36, 0.3);
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#ach .card-service:hover .particle {
  opacity: 1;
  animation: floatParticle 3s ease-in-out infinite;
}

#ach .card-service .particle:nth-child(1) { top: 20%; left: 10%; animation-delay: 0s; }
#ach .card-service .particle:nth-child(2) { top: 60%; left: 85%; animation-delay: 0.5s; }
#ach .card-service .particle:nth-child(3) { top: 80%; left: 20%; animation-delay: 1s; }
#ach .card-service .particle:nth-child(4) { top: 30%; left: 90%; animation-delay: 1.5s; }

@keyframes floatParticle {
  0%, 100% {
    transform: translateY(0) scale(1);
    opacity: 0.3;
  }
  50% {
    transform: translateY(-20px) scale(1.5);
    opacity: 0.7;
  }
}

/* Celebration Animation for Winner Cards */
@keyframes celebrate {
  0% { transform: scale(1); }
  10% { transform: scale(1.05) rotate(-2deg); }
  20% { transform: scale(1.05) rotate(2deg); }
  30% { transform: scale(1.05) rotate(-2deg); }
  40% { transform: scale(1.05) rotate(2deg); }
  50% { transform: scale(1); }
  100% { transform: scale(1); }
}

#ach .card-service.celebrating {
  animation: celebrate 0.8s ease-in-out;
}

/* Scroll Reveal Animation for Achievement Cards */
#ach .card-service {
  opacity: 0;
  transform: translateY(50px) scale(0.9);
}

#ach .card-service.revealed {
  opacity: 1;
  transform: translateY(0) scale(1);
  transition: all 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Staggered reveal delays */
#ach .row:first-of-type > div:nth-child(1) .card-service { transition-delay: 0.1s; }
#ach .row:first-of-type > div:nth-child(2) .card-service { transition-delay: 0.2s; }
#ach .row:first-of-type > div:nth-child(3) .card-service { transition-delay: 0.3s; }
#ach .row:first-of-type > div:nth-child(4) .card-service { transition-delay: 0.4s; }
#ach .row:nth-of-type(2) > div:nth-child(1) .card-service { transition-delay: 0.5s; }
#ach .row:nth-of-type(2) > div:nth-child(2) .card-service { transition-delay: 0.6s; }
#ach .row:nth-of-type(2) > div:nth-child(3) .card-service { transition-delay: 0.7s; }
#ach .row:nth-of-type(2) > div:nth-child(4) .card-service { transition-delay: 0.8s; }
#ach .row:nth-of-type(2) > div:nth-child(5) .card-service { transition-delay: 0.9s; }

/* Responsive Masonry Grid */
@media (max-width: 1199.98px) {
  #ach .row {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 991.98px) {
  #ach .row {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }

  #ach .card-service {
    padding: 25px 20px;
  }
}

@media (max-width: 575.98px) {
  #ach .row {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  #ach .card-service .icon {
    width: 70px;
    height: 70px;
  }

  #ach .card-service .icon img,
  #ach .card-service .icon .icon-50 {
    width: 38px;
    height: 38px;
  }
}

/* Dark theme support */
.theme-dark #ach .card-service {
  background: linear-gradient(145deg, #2a2a2a 0%, #1f1f1f 100%);
}

.theme-dark #ach .card-service .caption p {
  color: #aaa;
}

.theme-dark #ach .card-service:hover .caption p {
  color: #ddd;
}

