/**
 * Services Section - Glassmorphism & Premium Effects
 * Cards con efecto de vidrio esmerilado y animaciones avanzadas
 * Versión: 2.0
 */

/* ========================================
   SERVICE CARDS CON GLASSMORPHISM
   ======================================== */

.service-card {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: all 0.5s var(--ease-in-out-smooth);
  position: relative;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

/* Borde decorativo superior */
.service-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--piano-gold-gradient);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.6s var(--ease-in-out-smooth);
  z-index: 10;
}

.service-card:hover::before {
  transform: scaleX(1);
}

/* Efecto de brillo en hover */
.service-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  transition: left 0.7s ease;
  pointer-events: none;
  z-index: 5;
}

.service-card:hover::after {
  left: 100%;
}

/* Hover state */
.service-card:hover {
  transform: translateY(-15px) scale(1.02);
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(212, 175, 55, 0.5);
  box-shadow:
    0 20px 60px rgba(212, 175, 55, 0.25),
    0 0 0 1px rgba(212, 175, 55, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

/* ========================================
   SERVICE IMAGE MEJORADA
   ======================================== */

.service-image {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg,
    rgba(212, 175, 55, 0.1) 0%,
    rgba(248, 249, 250, 1) 100%);
}

.service-image img {
  transition: transform 0.6s var(--ease-in-out-smooth);
  will-change: transform;
}

.service-card:hover .service-image img {
  transform: scale(1.1) rotate(2deg);
}

/* Overlay con gradiente */
.service-image::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(44, 44, 44, 0.1) 100%
  );
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
  z-index: 2;
}

.service-card:hover .service-image::before {
  opacity: 1;
}

/* ========================================
   SERVICE ICON OVERLAY
   ======================================== */

.service-icon-overlay {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  border: 2px solid rgba(212, 175, 55, 0.3);
  transition: all 0.4s var(--ease-in-out-smooth);
  z-index: 3;
}

.service-card:hover .service-icon-overlay {
  transform: scale(1.15) rotate(10deg);
  background: var(--piano-gold-gradient);
  border-color: var(--piano-gold);
  box-shadow: 0 10px 30px rgba(212, 175, 55, 0.5);
}

.service-icon-overlay i {
  transition: color 0.3s ease;
}

.service-card:hover .service-icon-overlay i {
  color: var(--piano-dark) !important;
}

/* ========================================
   CARD BODY
   ======================================== */

.service-card .card-body {
  position: relative;
  z-index: 4;
  background: transparent;
}

/* Título del servicio */
.service-card .card-title {
  position: relative;
  transition: color 0.3s ease;
}

.service-card:hover .card-title {
  color: var(--piano-gold) !important;
}

/* Descripción */
.service-card .card-text {
  transition: color 0.3s ease;
  line-height: 1.7;
}

.service-card:hover .card-text {
  color: var(--piano-dark) !important;
}

/* ========================================
   BADGE DE PRECIO
   ======================================== */

.service-card .badge {
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.service-card .bg-piano-gold {
  background: var(--piano-gold-gradient) !important;
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
  border: none;
  animation: pulse 3s ease-in-out infinite;
}

.service-card:hover .bg-piano-gold {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(212, 175, 55, 0.5);
}

/* ========================================
   BOTÓN MEJORADO
   ======================================== */

.service-card .btn-piano-primary {
  position: relative;
  overflow: hidden;
  transition: all 0.4s var(--ease-in-out-smooth);
  font-weight: 700;
  box-shadow: 0 5px 20px rgba(212, 175, 55, 0.3);
}

.service-card:hover .btn-piano-primary {
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(212, 175, 55, 0.5);
}

/* Efecto ripple en el botón */
.service-card .btn-piano-primary::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.service-card .btn-piano-primary:active::after {
  width: 300px;
  height: 300px;
}

/* ========================================
   VARIANTE: FEATURED SERVICE
   ======================================== */

.service-card.featured {
  background: linear-gradient(
    135deg,
    rgba(212, 175, 55, 0.15) 0%,
    rgba(255, 255, 255, 0.9) 100%
  );
  border: 2px solid rgba(212, 175, 55, 0.4);
}

.service-card.featured::before {
  transform: scaleX(1);
}

.service-card.featured .card-title::after {
  content: '⭐';
  margin-left: 0.5rem;
  font-size: 0.8em;
}

/* ========================================
   LOADING SKELETON
   ======================================== */

.service-card.loading {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.7) 25%,
    rgba(255, 255, 255, 0.9) 50%,
    rgba(255, 255, 255, 0.7) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 2s linear infinite;
}

/* ========================================
   ANIMACIÓN DE ENTRADA ESCALONADA
   ======================================== */

.service-card {
  opacity: 0;
  transform: translateY(30px);
  animation: fadeInScale 0.6s ease forwards;
}

.service-card:nth-child(1) {
  animation-delay: 0.1s;
}

.service-card:nth-child(2) {
  animation-delay: 0.2s;
}

.service-card:nth-child(3) {
  animation-delay: 0.3s;
}

.service-card:nth-child(4) {
  animation-delay: 0.4s;
}

.service-card:nth-child(5) {
  animation-delay: 0.5s;
}

.service-card:nth-child(6) {
  animation-delay: 0.6s;
}

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

/* ========================================
   BADGE FLICKER ANIMADO
   ======================================== */

.service-card .badge-animated {
  animation: badgeFlicker 2s ease-in-out infinite;
}

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

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

@media (max-width: 991.98px) {
  .service-card:hover {
    transform: translateY(-10px) scale(1.01);
  }

  .service-icon-overlay {
    width: 50px;
    height: 50px;
  }

  .service-icon-overlay i {
    font-size: 1.5rem !important;
  }
}

@media (max-width: 767.98px) {
  .service-card {
    margin-bottom: 1.5rem;
  }

  .service-card:hover {
    transform: translateY(-5px);
  }

  .service-icon-overlay {
    top: 0.75rem;
    right: 0.75rem;
    width: 45px;
    height: 45px;
  }

  .service-icon-overlay i {
    font-size: 1.25rem !important;
  }
}

@media (max-width: 575.98px) {
  .service-card .card-body {
    padding: 1.25rem !important;
  }

  .service-card .card-title {
    font-size: 1.15rem;
  }

  .service-card .card-text {
    font-size: 0.9rem;
    min-height: 50px !important;
  }
}

/* ========================================
   GLASSMORPHISM DARK MODE (OPCIONAL)
   ======================================== */

@media (prefers-color-scheme: dark) {
  .service-card {
    background: rgba(44, 44, 44, 0.7);
    border-color: rgba(212, 175, 55, 0.2);
  }

  .service-card:hover {
    background: rgba(44, 44, 44, 0.9);
    border-color: rgba(212, 175, 55, 0.5);
  }

  .service-icon-overlay {
    background: rgba(44, 44, 44, 0.95);
  }

  .service-card:hover .service-icon-overlay {
    background: var(--piano-gold-gradient);
  }
}

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

.service-card,
.service-image img,
.service-icon-overlay {
  will-change: transform;
}

/* Reducir animaciones en dispositivos de bajo rendimiento */
@media (prefers-reduced-motion: reduce) {
  .service-card,
  .service-card *,
  .service-card::before,
  .service-card::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
