/* ===== SERVICES COMPONENT ===== */

.services {
  background: transparent;
  position: relative;
  overflow: hidden;
  padding-bottom: 4rem; /* Space for navigation controls */
}

/* Asegurar padding en servicios para móvil con valores fijos */
.services .container {
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

@media (max-width: 640px) {
  .services .container {
    padding-left: 2rem !important; /* Padding fijo en móvil */
    padding-right: 2rem !important;
  }
}

@media (max-width: 480px) {
  .services .container {
    padding-left: 3rem !important; /* Padding fijo máximo */
    padding-right: 3rem !important;
  }
}

@media (max-width: 375px) {
  .services .container {
    padding-left: 2.5rem !important; /* Ajuste para móviles muy pequeños */
    padding-right: 2.5rem !important;
  }
}

/* Ensure services content is always visible, even if AOS is present */
.services [data-aos] {
  opacity: 1 !important;
  transform: none !important;
}

/* Elegant Navigation Controls - Similar to projects carousel */
.services-controls {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 1rem;
  z-index: 10;
  background: rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-full);
  padding: 0.5rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.services-nav {
  width: 45px;
  height: 45px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-normal);
  backdrop-filter: blur(10px);
  font-size: var(--fs-base);
}

.services-nav:hover {
  background: var(--primary-gradient);
  border-color: var(--primary-color);
  transform: scale(1.1);
  color: white;
  box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.services-nav:active {
  transform: scale(0.95);
}

/* Clase específica para forzar spacing en móvil */
.mobile-spacing {
  box-sizing: border-box !important;
}

@media (max-width: 640px) {
  .mobile-spacing {
    margin: 0 2rem !important;
    padding: 0 !important;
    width: calc(100% - 4rem) !important;
  }
}

@media (max-width: 480px) {
  .mobile-spacing {
    margin: 0 2.5rem !important;
    width: calc(100% - 5rem) !important;
  }
}

@media (max-width: 375px) {
  .mobile-spacing {
    margin: 0 1.5rem !important;
    width: calc(100% - 3rem) !important;
  }
}

/* Responsive: botones centrados en móvil */
@media (max-width: 640px) {
  .services-controls {
    justify-content: center !important; /* Centrar en móvil */
    margin-left: 1rem !important; /* Margen backup */
    margin-right: 1rem !important; /* Margen backup */
  }
  
  .services-controls .btn {
    padding: var(--space-2xs) var(--space-xs); /* Más compactos */
    font-size: var(--fs-xs); /* Texto más pequeño */
    min-width: 36px; /* Tamaño más pequeño */
    height: 36px; /* Altura más pequeña */
    display: flex;
    align-items: center;
    justify-content: center;
    border-width: 1px;
  }
}

.services::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 50%;
  height: 100%;
  background: radial-gradient(circle at 80% 20%, rgba(102, 126, 234, 0.05) 0%, transparent 50%);
  pointer-events: none;
}

/* Service Card */
.service-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 2px solid transparent;
  border-radius: var(--radius-xl);
  padding: var(--space-lg);
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: all var(--transition-normal);
  cursor: pointer;
  height: auto;
  min-height: 240px;
  display: flex;
  flex-direction: column;
  background-clip: padding-box;
}

/* Content overlay for better readability */
.service-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  border-radius: var(--radius-xl);
  z-index: 1;
  transition: background var(--transition-normal);
}

.service-card:hover::after {
  background: rgba(0, 0, 0, 0.2);
}

/* Elegant gradient borders for each category */
.service-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: var(--radius-xl);
  padding: 2px;
  background: linear-gradient(135deg, var(--primary-color), transparent, var(--primary-color));
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: xor;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  opacity: 0.3;
  transition: opacity var(--transition-normal);
  z-index: -1;
}

/* Category-specific gradient borders */
.service-card.entertainment::before {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #667eea 100%);
}

.service-card.education::before {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 50%, #4facfe 100%);
}

.service-card.medical::before {
  background: linear-gradient(135deg, #43e97b 0%, #38f9d7 50%, #43e97b 100%);
}

.service-card.realestate::before {
  background: linear-gradient(135deg, #fa709a 0%, #fee140 50%, #fa709a 100%);
}

.service-card.restaurant::before {
  background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 50%, #ff9a9e 100%);
}

.service-card.transport::before {
  background: linear-gradient(135deg, #a8edea 0%, #fed6e3 50%, #a8edea 100%);
}


.service-card:hover {
  transform: translateY(-10px) scale(1.02);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
}

.service-card:hover::before {
  opacity: 1;
  animation: borderGlow 2s ease-in-out infinite alternate;
}

@keyframes borderGlow {
  0% { opacity: 0.8; }
  100% { opacity: 1; }
}

/* Enhanced hover effects with category-specific glows */
.service-card.entertainment:hover {
  box-shadow: 0 25px 50px rgba(102, 126, 234, 0.4);
}

.service-card.education:hover {
  box-shadow: 0 25px 50px rgba(79, 172, 254, 0.4);
}

.service-card.medical:hover {
  box-shadow: 0 25px 50px rgba(67, 233, 123, 0.4);
}

.service-card.realestate:hover {
  box-shadow: 0 25px 50px rgba(250, 112, 154, 0.4);
}

.service-card.restaurant:hover {
  box-shadow: 0 25px 50px rgba(255, 154, 158, 0.4);
}

.service-card.transport:hover {
  box-shadow: 0 25px 50px rgba(168, 237, 234, 0.4);
}

/* Service Icon */
.service-icon {
  width: 64px;
  height: 64px;
  background: var(--primary-gradient);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-md);
  font-size: var(--fs-xl);
  color: white;
  box-shadow: var(--shadow-glow);
  transition: all var(--transition-normal);
  position: relative;
  z-index: 3;
}

.service-card:hover .service-icon {
  transform: scale(1.1) rotateY(180deg);
  box-shadow: var(--shadow-glow-accent);
}

/* Service Content */
.service-card h3 {
  font-size: var(--fs-xl);
  font-weight: 700;
  color: #ffffff;
  margin-bottom: var(--space-sm);
  line-height: var(--lh-tight);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  position: relative;
  z-index: 2;
}

.service-card > p {
  font-size: var(--fs-base);
  color: rgba(255, 255, 255, 0.9);
  line-height: var(--lh-relaxed);
  margin-bottom: var(--space-md);
  flex-grow: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  position: relative;
  z-index: 2;
}

/* Service Features */
.service-features {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  margin-bottom: var(--space-lg);
  text-align: left;
  position: relative;
  z-index: 2;
}

.service-features span {
  font-size: var(--fs-sm);
  color: rgba(255, 255, 255, 0.85);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.service-features span::before {
  content: '✓';
  color: #00ff88;
  font-weight: bold;
  font-size: 1.2em;
  text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

/* Technology Icons */
.service-tech {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-sm);
  margin-top: auto;
  padding-top: var(--space-md);
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  position: relative;
  z-index: 2;
}

.service-tech img {
  width: 32px;
  height: 32px;
  filter: brightness(1.2) contrast(1.1);
  transition: all var(--transition-normal);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  padding: 4px;
  backdrop-filter: blur(10px);
}

.service-card:hover .service-tech img {
  filter: brightness(1.4) contrast(1.2);
  transform: scale(1.15) rotateY(360deg);
  box-shadow: 0 5px 15px rgba(255, 255, 255, 0.3);
}

/* Services Grid */
/* Perfect viewport control grid system */
.services-grid {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  gap: var(--space-lg);
  align-items: stretch;
  padding: var(--space-sm) 0 var(--space-xl);
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

.services-grid > * {
  scroll-snap-align: start;
  flex: 0 0 auto;
}

/* Desktop: Show exactly 3 cards with perfect border visibility */
@media (min-width: 1024px) {
  .services-grid {
    justify-content: flex-start;
    gap: 2rem;
    padding: var(--space-sm) 1rem var(--space-xl) 1rem; /* Add left/right padding for borders */
    overflow-x: auto;
    scroll-snap-type: x mandatory;
  }
  .service-card {
    min-width: 320px; /* Fixed minimum width */
    max-width: 320px; /* Fixed maximum width */
    flex: 0 0 320px; /* Rigid sizing */
    scroll-snap-align: start;
  }

  /* Adjusted container to account for border space + padding */
  .services .container {
    max-width: calc(320px * 3 + 2rem * 2 + 2rem + 1rem); /* 3 cards + 2 gaps + padding + border space */
    margin: 0 auto;
  }
}

/* Tablet: Show 2 cards */
@media (min-width: 640px) and (max-width: 1023px) {
  .services-grid {
    justify-content: flex-start;
    gap: var(--space-lg);
  }
  .service-card {
    flex: 0 0 280px;
  }
}

/* Mobile: Show exactly 1 card centered */
@media (max-width: 639px) {
  .services-grid {
    justify-content: center;
    gap: var(--space-lg);
    padding: var(--space-sm) var(--space-lg) var(--space-xl);
  }
  .service-card {
    flex: 0 0 calc(100vw - 4rem);
    max-width: 320px;
    scroll-snap-align: center;
  }
}

/* Custom scrollbar styling */
.services-grid::-webkit-scrollbar {
  height: 6px;
}

.services-grid::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
}

.services-grid::-webkit-scrollbar-thumb {
  background: var(--primary-gradient);
  border-radius: var(--radius-full);
}

.services-grid::-webkit-scrollbar-thumb:hover {
  background: var(--primary-color);
}

/* Legacy styles removed - using new gradient border system */

/* Technologies Section */
.technologies {
  background: var(--bg-secondary);
}

.tech-category {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  text-align: center;
  transition: all var(--transition-normal);
}

.tech-category:hover {
  transform: translateY(-5px);
  border-color: var(--primary-color);
  box-shadow: var(--shadow-xl);
}

.tech-category h4 {
  font-size: var(--fs-xl);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-lg);
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tech-icons {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-lg);
  flex-wrap: wrap;
}

.tech-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  border-radius: var(--radius-lg);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-primary);
  transition: all var(--transition-normal);
  cursor: pointer;
  min-width: 80px;
}

.tech-icon:hover {
  transform: translateY(-3px);
  background: var(--bg-primary);
  border-color: var(--primary-color);
  box-shadow: var(--shadow-lg);
}

.tech-icon img {
  width: 40px;
  height: 40px;
  transition: transform var(--transition-normal);
}

.tech-icon:hover img {
  transform: scale(1.2);
}

.tech-icon span {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  font-weight: 500;
}

/* Loading Animation for Service Cards */
.service-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 200px;
  color: var(--text-secondary);
}

/* Responsive card sizing handled above in main grid section */

@media (max-width: 768px) {
  .service-card {
    padding: var(--space-lg); /* Padding estandarizado */
    min-width: 280px; /* Ancho mínimo estándar */
    max-width: 320px; /* Ancho máximo controlado */
    min-height: 260px; /* Altura mínima estándar */
  }
  
  .service-icon {
    width: 56px; /* Tamaño estándar */
    height: 56px;
    font-size: var(--fs-lg); /* Tamaño de icono estándar */
  }
  
  .service-card h3 {
    font-size: var(--fs-lg); /* Título estándar */
    margin-bottom: var(--space-sm);
  }
  
  .service-card > p {
    font-size: var(--fs-sm); /* Texto estándar */
    line-height: 1.5;
  }
  
  .service-features {
    font-size: var(--fs-xs);
    gap: var(--space-xs); /* Espaciado consistente */
  }
  
  .service-tech {
    gap: var(--space-sm);
    padding-top: var(--space-sm); /* Espaciado superior estándar */
  }
  
  .service-tech img {
    width: 24px;
    height: 24px;
  }
  
  .tech-icons {
    gap: var(--space-md);
  }
  
  .tech-icon {
    min-width: 60px;
    padding: var(--space-sm);
  }
  
  .tech-icon img {
    width: 32px;
    height: 32px;
  }
}

/* Móvil pequeño: botones más compactos */
@media (max-width: 480px) {
  .services-controls {
    gap: 1rem !important; /* Gap mayor para mejor separación */
  }
  
  .services-controls .btn {
    min-width: 32px; /* Tamaño más pequeño */
    height: 32px; /* Altura más pequeña */
    padding: var(--space-2xs); /* Padding mínimo */
    font-size: var(--fs-xs); /* Icono más pequeño */
  }
  
  .service-card {
    min-width: 260px; /* Ancho estándar móvil pequeño */
    max-width: 300px;
    min-height: 240px; /* Altura consistente */
    margin: 0 auto; /* Centrar tarjetas */
  }
  
  .services-grid {
    justify-content: flex-start; /* Alineación consistente */
    padding-left: var(--space-sm); /* Padding lateral */
    padding-right: var(--space-sm);
  }
}

/* Accessibility */
.service-card:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 4px;
}

.tech-icon:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Performance optimizations */
.service-card {
  contain: layout style paint;
  will-change: transform;
}

.tech-icon {
  contain: layout style;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .service-card:hover,
  .tech-category:hover,
  .tech-icon:hover {
    transform: none;
  }
  
  .service-icon,
  .tech-icon img {
    transition: none;
  }
  
  .service-card:hover .service-icon {
    transform: none;
  }
}