/* Custom Styles for Principia */

/* Global Sunset/Sunrise Transitions - Efecto Atardecer - Optimized */
* {
  transition: background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
              border-color 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
              color 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
              box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Smooth transitions for all backgrounds and text */
.transition-colors {
  transition: background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
              border-color 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
              color 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Optimized sunset transition for sections */
.sunset-transition {
  transition: background-color 0.5s cubic-bezier(0.4, 0, 0.2, 1), 
              border-color 0.5s cubic-bezier(0.4, 0, 0.2, 1), 
              color 0.5s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              backdrop-filter 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Header Transitions */
.header-transparent {
  background: transparent;
  transition: all 0.5s ease-in-out;
}

.header-solid {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  transition: all 0.5s ease-in-out;
}

.dark .header-solid {
  background: rgba(24, 24, 27, 0.95);
}

/* Navigation Link States - Refined */
.nav-link {
  position: relative;
  transition: all 0.5s ease-in-out;
  font-family: 'Fira Sans', sans-serif;
  font-weight: 400;
}

.nav-link::after {
  content: '';
  position: absolute;
  width: 0;
  height: 1px;
  bottom: -2px;
  left: 50%;
  background-color: #ea580c;
  transition: all 0.5s ease-in-out;
  transform: translateX(-50%);
}

.nav-link:hover::after,
.nav-link.active-link::after {
  width: 100%;
}

/* Navbar separators */
.navbar-separator {
  color: rgba(255, 255, 255, 0.4);
  transition: color 0.5s ease-in-out;
}

.header-solid .navbar-separator {
  color: rgba(156, 163, 175, 0.8);
}

.dark .header-solid .navbar-separator {
  color: rgba(156, 163, 175, 0.6);
}

/* Header color transitions for transparent state */
.header-transparent .active-link {
  color: #ea580c;
}

.header-transparent .inactive-link {
  color: rgba(255, 255, 255, 0.8);
}

.header-transparent .inactive-link:hover {
  color: rgba(255, 255, 255, 1);
}

/* Header color transitions for solid state */
.header-solid .active-link {
  color: #ea580c;
}

.header-solid .inactive-link {
  color: #6b7280;
}

.header-solid .inactive-link:hover {
  color: #374151;
}

.dark .header-solid .inactive-link {
  color: #9ca3af;
}

.dark .header-solid .inactive-link:hover {
  color: #f3f4f6;
}

/* Brand color transitions */
.header-transparent .navbar-brand {
  color: rgba(255, 255, 255, 0.9);
}

.header-solid .navbar-brand {
  color: #6b7280;
}

.dark .header-solid .navbar-brand {
  color: #f3f4f6;
}

/* Theme toggle styles */
.theme-switch {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
}

.theme-switch:hover {
  background: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 1);
}

.header-solid .theme-switch {
  background: rgba(0, 0, 0, 0.1);
  color: rgba(0, 0, 0, 0.8);
}

.header-solid .theme-switch:hover {
  background: rgba(0, 0, 0, 0.2);
  color: rgba(0, 0, 0, 1);
}

.dark .header-solid .theme-switch {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
}

.dark .header-solid .theme-switch:hover {
  background: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 1);
}

/* Enhanced animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes pulse-soft {
  0%, 100% {
    opacity: 0.3;
  }
  50% {
    opacity: 0.6;
  }
}

.animate-fade-in-up {
  animation: fadeInUp 0.6s ease-out;
}

.animate-float {
  animation: float 6s ease-in-out infinite;
}

.animate-pulse-soft {
  animation: pulse-soft 4s ease-in-out infinite;
}

.animation-delay-200 {
  animation-delay: 0.2s;
}

.animation-delay-400 {
  animation-delay: 0.4s;
}

.animation-delay-600 {
  animation-delay: 0.6s;
}

/* Smooth scrolling for anchor links */
html {
  scroll-behavior: smooth;
}

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

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

.dark ::-webkit-scrollbar-track {
  background: #18181b;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(to bottom, #ea580c, #f97316);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(to bottom, #dc2626, #ea580c);
}

/* Hero section enhancements */
.hero-gradient {
  background: linear-gradient(135deg, rgba(234, 88, 12, 0.1) 0%, rgba(234, 88, 12, 0.05) 100%);
}

/* Enhanced focus states for accessibility */
.focus-outline:focus,
*:focus-visible {
  outline: 2px solid #ea580c;
  outline-offset: 2px;
  border-radius: 0.375rem;
}

/* Mobile menu toggle */
.mobile-menu-open {
  max-height: 400px;
  opacity: 1;
  transition: all 0.3s ease-in-out;
}

.mobile-menu-closed {
  max-height: 0;
  opacity: 0;
  transition: all 0.3s ease-in-out;
}

/* Form focus states */
input:focus,
textarea:focus,
select:focus {
  outline: none;
  box-shadow: 0 0 0 2px #ea580c;
  border-color: transparent;
}

/* Enhanced button styles with sunset transitions */
.btn-primary {
  background: linear-gradient(135deg, #ea580c 0%, #dc2626 100%);
  transition: all 0.5s ease-in-out;
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

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

.btn-primary:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(234, 88, 12, 0.4);
}

/* Section decorations */
.section-decoration {
  position: relative;
}

.section-decoration::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 2px;
  background: linear-gradient(90deg, transparent, #ea580c, transparent);
}

/* Card hover effects with sunset transitions */
.card-hover {
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Text gradient utilities */
.text-gradient {
  background: linear-gradient(135deg, #ea580c, #f97316);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.text-gradient-blue {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Dark mode specific adjustments */
.dark {
  color-scheme: dark;
}

/* Sunset/Sunrise Effect - Enhanced for all sections */
.sunset-transition {
  transition: background-color 0.8s ease-in-out, 
              border-color 0.8s ease-in-out, 
              color 0.8s ease-in-out,
              box-shadow 0.6s ease-in-out,
              backdrop-filter 0.8s ease-in-out;
}

/* Section backgrounds with sunset effect */
section {
  transition: background-color 0.8s ease-in-out, 
              border-color 0.8s ease-in-out;
}

/* Enhanced transitions for cards and containers - Optimized */
.rounded-2xl, .rounded-3xl, .rounded-xl {
  transition: background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
              border-color 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
              box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Text elements smooth transitions - Optimized */
h1, h2, h3, h4, h5, h6, p, span, div {
  transition: color 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hero background image smooth transitions - Optimized */
.hero-bg-light {
  background-image: url('assets/img/mockups/hero_background.png');
  transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1),
              filter 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.parallax-bg {
  transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), 
              filter 0.6s cubic-bezier(0.4, 0, 0.2, 1),
              background-image 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Enhanced hover effects for all interactive elements */
.hover-lift {
  transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.hover-lift:hover {
  transform: translateY(-3px) scale(1.01);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
  will-change: transform;
}

.hover-lift:hover .service-icon {
  animation: gentleRotate 0.8s ease-out, iconPulse 2.5s ease-in-out infinite;
}

.dark .hover-lift:hover {
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
}

/* Enhanced button hover effects - Optimized */
button, .btn, a[href] {
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

button:hover, .btn:hover, a[href]:hover {
  transform: translateY(-1px) scale(1.01);
  box-shadow: 0 6px 16px rgba(234, 88, 12, 0.2);
  will-change: transform;
}

/* Efecto específico para iconos SVG en botones */
button:hover svg, .btn:hover svg, a[href]:hover svg {
  animation: gentleRotate 0.6s ease-out;
}

/* Estilo base para iconos de servicios y tecnología */
.service-icon, .tech-icon {
  transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position: relative;
  z-index: 2;
}

/* Efecto de glow suave para iconos en modo oscuro */
.dark .service-icon:hover, .dark .tech-icon:hover {
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
}

/* Card hover improvements - Optimized */
.group {
  transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.group:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.08);
  will-change: transform;
}

.dark .group:hover {
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.25);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .nav-link::after {
    height: 2px;
  }
  
  .header-solid {
    background: rgba(255, 255, 255, 1);
  }
  
  .dark .header-solid {
    background: rgba(0, 0, 0, 1);
  }
}

/* Print styles */
@media print {
  .no-print {
    display: none !important;
  }
  
  body {
    background: white !important;
    color: black !important;
  }
  
  .header-transparent,
  .header-solid {
    background: white !important;
    color: black !important;
    position: static !important;
  }
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  html {
    scroll-behavior: auto;
  }
  
  .btn-primary:hover {
    transform: none;
  }
  
  .card-hover:hover {
    transform: none;
  }
}

/* Loading states */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid #ea580c;
  border-top: 2px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Nuevas animaciones dinámicas para iconos */
@keyframes gentleRotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(6deg); }
}

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

@keyframes subtleGlow {
  0%, 100% { box-shadow: 0 0 5px rgba(255, 255, 255, 0.1); }
  50% { box-shadow: 0 0 15px rgba(255, 255, 255, 0.3), 0 0 25px rgba(255, 255, 255, 0.1); }
}

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

/* Technology Carousel Styles with sunset transitions */
.tech-card {
  transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.tech-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
  transition: left 0.8s ease-in-out;
  z-index: 1;
}

.tech-card:hover::before {
  left: 100%;
}

.tech-card:hover {
  transform: translateY(-3px) scale(1.01);
  box-shadow: 0 12px 25px rgba(0, 0, 0, 0.1);
}

.tech-card:hover .tech-icon {
  animation: gentleRotate 0.6s ease-out, iconPulse 2s ease-in-out infinite;
}

.tech-card .tech-icon {
  transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position: relative;
  z-index: 2;
}

.tech-card.active {
  border-color: #3b82f6 !important;
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.2);
  transform: translateY(-2px) scale(1.005);
}

.tech-card.active .tech-icon {
  animation: subtleGlow 2s ease-in-out infinite, iconFloat 3s ease-in-out infinite;
}

.tech-card.active .tech-card-icon {
  transform: scale(1.1);
}

.tech-details {
  position: relative;
  min-height: 300px;
}

.tech-content {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.5s ease-in-out;
}

.tech-content.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Dark mode adjustments for carousel */
.dark .tech-card.active {
  border-color: #3b82f6 !important;
  box-shadow: 0 10px 25px rgba(59, 130, 246, 0.25);
}

/* Focus states for accessibility */
.tech-card:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.tech-card:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .tech-details {
    min-height: 350px;
  }
}
