/* Tesis Pro Perú - Modern CSS */

/* Importar AOS (An@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes heroTextEntrance {
  from {
    opacity: 0;
    transform: translateY(15px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes fadeInLeft {oll) */
@import url('https://unpkg.com/aos@2.3.1/dist/aos.css');

/* Variables CSS personalizadas */
:root {
  --primary-gradient: linear-gradient(135deg, #7f0df2 0%, #9333ea 100%);
  --secondary-gradient: linear-gradient(135deg, #0ea5e9 0%, #3b82f6 100%);
  --success-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
  --danger-gradient: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  --glass-bg: rgba(255, 255, 255, 0.1);
  --glass-border: rgba(255, 255, 255, 0.2);
  --shadow-glass: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
  --backdrop-blur: blur(20px);
}

/* Modo oscuro */
.dark {
  --glass-bg: rgba(0, 0, 0, 0.2);
  --glass-border: rgba(255, 255, 255, 0.1);
  --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
}

/* Estilos base */
* {
  scroll-behavior: smooth;
}

html {
  overflow-x: hidden;
}

body {
  overflow-x: hidden;
  transition: all 0.3s ease;
}

/* Efectos de glassmorphism */
.glass {
  background: var(--glass-bg);
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-glass);
}

/* Gradientes animados */
.gradient-animated {
  background: linear-gradient(-45deg, #7f0df2, #9333ea, #3b82f6, #06b6d4);
  background-size: 400% 400%;
  animation: gradient 15s ease infinite;
}

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

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

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(127, 13, 242, 0.3);
  }
  50% {
    box-shadow: 0 0 40px rgba(127, 13, 242, 0.6);
  }
}

@keyframes wiggle {
  0%, 7% {
    transform: rotateZ(0);
  }
  15% {
    transform: rotateZ(-15deg);
  }
  20% {
    transform: rotateZ(10deg);
  }
  25% {
    transform: rotateZ(-10deg);
  }
  30% {
    transform: rotateZ(6deg);
  }
  35% {
    transform: rotateZ(-4deg);
  }
  40%, 100% {
    transform: rotateZ(0);
  }
}

/* Clases de utilidad para animaciones */
.animate-fade-in-up {
  animation: fadeInUp 0.6s ease-out;
}

.animate-hero-text {
  animation: heroTextEntrance 0.4s ease-out;
}

.animate-fade-in-down {
  animation: fadeInDown 0.6s ease-out;
}

.animate-fade-in-left {
  animation: fadeInLeft 0.6s ease-out;
}

.animate-fade-in-right {
  animation: fadeInRight 0.6s ease-out;
}

.animate-scale-in {
  animation: scaleIn 0.5s ease-out;
}

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

.animate-pulse-glow {
  animation: pulse-glow 2s ease-in-out infinite;
}

.animate-wiggle {
  animation: wiggle 1s ease-in-out;
}

/* Estilos para campos con error (validación) */
.has-error .fa-user,
.has-error .fa-envelope,
.has-error .fa-comment-dots,
.has-error i {
  color: #dc2626 !important; /* rojo visible */
}

.is-invalid {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 4px rgba(220,38,38,0.06) !important;
}

/* Asegurar visibilidad en focus cuando hay error */
.is-invalid:focus {
  outline: none;
  box-shadow: 0 0 0 4px rgba(220,38,38,0.12) !important;
}

/* Soporte para atributos aria-invalid y validación nativa */
input[aria-invalid="true"], textarea[aria-invalid="true"], select[aria-invalid="true"] {
  border-color: #dc2626 !important;
}

/* Forzar color de placeholder cuando hay error para más contraste */
.has-error ::placeholder {
  color: rgba(220,38,38,0.6) !important;
}

/* Asegurar que el focus no oculte el borde ni el icono cuando hay error */
.has-error input:focus,
.has-error textarea:focus,
.is-invalid:focus,
.has-error .is-invalid:focus {
  border-color: #dc2626 !important; /* mantener borde rojo */
  box-shadow: 0 0 0 6px rgba(220,38,38,0.12) !important;
  outline: none !important;
}

/* Forzar color y visibilidad del icono cuando el campo está en error */
.has-error i,
.has-error .fa-user,
.has-error .fa-envelope,
.has-error .fa-comment-dots {
  color: #b91c1c !important; /* rojo más oscuro para contraste */
  opacity: 1 !important;
}

/* También asegurar que los placeholder y texto mantengan contraste en error+focus */
.has-error input:focus::placeholder,
.has-error textarea:focus::placeholder {
  color: rgba(220,38,38,0.5) !important;
}

/* Asegurar que los iconos estén siempre por encima del input y sean visibles en focus */
.relative i {
  z-index: 30; /* por encima del input */
  pointer-events: none;
  color: #6b7280; /* gray-500 por defecto */
  transition: color 0.15s ease, opacity 0.15s ease;
}

/* Si el usuario hace focus dentro del contenedor, el icono se mantiene visible y toma mayor contraste */
.relative:focus-within i {
  color: #374151 !important; /* gray-700 para mejor contraste en focus */
  opacity: 1 !important;
}

/* Mantener sombra/borde visible aunque JS inline ponga `box-shadow: none;` */
.relative input:focus,
.relative textarea:focus {
  box-shadow: 0 0 0 6px rgba(59,130,246,0.08) !important; /* azul tenue por default */
  border-color: #3b82f6 !important;
}

/* Cuando hay error explícito (clase has-error) priorizar rojo en icono y foco */
.has-error i,
.has-error:focus-within i {
  color: #b91c1c !important;
}



/* Efectos hover mejorados */
.hover-lift {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-lift:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.hover-scale {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.hover-glow {
  transition: all 0.3s ease;
}

.hover-glow:hover {
  box-shadow: 0 0 30px rgba(127, 13, 242, 0.4);
}

/* Botones modernos */
.btn-modern {
  position: relative;
  overflow: hidden;
  background: var(--primary-gradient);
  border: none;
  border-radius: 1rem;
  padding: 1rem 2rem;
  color: white;
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.3s ease;
  cursor: pointer;
}

.btn-modern::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-modern:hover::before {
  left: 100%;
}

.btn-modern:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(127, 13, 242, 0.3);
}

/* Formularios modernos */
.form-modern input,
.form-modern textarea {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 1rem;
  padding: 1rem 1.5rem;
  color: inherit;
  transition: all 0.3s ease;
}

.form-modern input:focus,
.form-modern textarea:focus {
  outline: none;
  border-color: #7f0df2;
  box-shadow: 0 0 20px rgba(127, 13, 242, 0.3);
  transform: translateY(-2px);
}

.form-modern input::placeholder,
.form-modern textarea::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

/* Cards modernas */
.card-modern {
  background: var(--glass-bg);
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
  border: 1px solid var(--glass-border);
  border-radius: 1.5rem;
  padding: 2rem;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.card-modern::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary-gradient);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

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

.card-modern:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
}

/* Efectos de partículas */
.particles {
  position: absolute;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
}

.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: #7f0df2;
  border-radius: 50%;
  opacity: 0.3;
  animation: particle-float 20s infinite linear;
}

@keyframes particle-float {
  0% {
    transform: translateY(100vh) translateX(0);
    opacity: 0;
  }
  10% {
    opacity: 0.3;
  }
  90% {
    opacity: 0.3;
  }
  100% {
    transform: translateY(-100vh) translateX(100px);
    opacity: 0;
  }
}

/* Navegación moderna */
.nav-modern {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
}

.nav-modern.scrolled {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* Efectos de loading */
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(127, 13, 242, 0.1);
  border-left: 4px solid #7f0df2;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Texto con gradiente */
.text-gradient {
  background: var(--primary-gradient);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-size: 200% 200%;
  animation: gradient 3s ease infinite;
}

/* Efectos de scroll */
.scroll-reveal {
  opacity: 0;
  transform: translateY(50px);
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Responsive enhancements */
@media (max-width: 768px) {
  .btn-modern {
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
  }
  
  .card-modern {
    padding: 1.5rem;
  }
  
  .nav-modern {
    background: rgba(255, 255, 255, 0.95);
  }
}

/* Dark mode specific styles */
.dark .nav-modern {
  background: rgba(15, 23, 42, 0.8);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.dark .nav-modern.scrolled {
  background: rgba(15, 23, 42, 0.95);
}

.dark .form-modern input,
.dark .form-modern textarea {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.dark .form-modern input::placeholder,
.dark .form-modern textarea::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

/* WhatsApp button styles */
.whatsapp-pulse {
  animation: whatsapp-pulse 2s infinite;
}

@keyframes whatsapp-pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7);
  }
  70% {
    transform: scale(1.05);
    box-shadow: 0 0 0 10px rgba(37, 211, 102, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(37, 211, 102, 0);
  }
}

/* Smooth scrolling for all browsers */
html {
  scroll-behavior: smooth;
}

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

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

::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #7f0df2, #9333ea);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #6b05d4, #7c2d9e);
}

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

/* Focus styles para accesibilidad */
button:focus,
input:focus,
textarea:focus,
a:focus {
  outline: 2px solid #7f0df2;
  outline-offset: 2px;
}

/* Mejoras para modo de alto contraste */
@media (prefers-contrast: high) {
  .card-modern {
    border: 2px solid currentColor;
  }
  
  .btn-modern {
    border: 2px solid currentColor;
  }
}

/* Modal auth specific styles */
.auth-modal-card {
  max-height: calc(100vh - 4rem);
  display: flex;
  align-items: stretch;
}

@media (min-width: 768px) {
  .auth-modal-card { padding: 0; }
}

.auth-modal-card .form-modern {
  padding: 1.25rem;
}

/* Ensure long modals scroll internally */
#auth-modal .auth-modal-card { overflow: hidden; }
#auth-modal .auth-modal-card > div { overflow-y: auto; }

/* Make close button visible on desktop and more accessible */
#close-auth-modal, #auth-modal button#close-auth-modal { display: none; }
@media (min-width: 768px) {
  #auth-modal .absolute.top-4.right-4 { display: block; }
}

/* ============================================================================
   MODALES DE SERVICIOS - Animaciones y estilos
   ============================================================================ */

/* Animación de fadeIn para modales */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Animación de modalSlideUp (alternativa) */
@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Estilos para modales de servicios */
[id^="serviceModal"] {
  animation-duration: 0.3s;
  animation-timing-function: ease-out;
  animation-fill-mode: both;
}

/* Efecto de backdrop blur para navegadores compatibles */
@supports (backdrop-filter: blur(10px)) or (-webkit-backdrop-filter: blur(10px)) {
  [id^="serviceModal"] {
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
  }
}

/* Mejoras de accesibilidad para modales */
[id^="serviceModal"][aria-hidden="true"] {
  pointer-events: none;
}

[id^="serviceModal"]:not([aria-hidden="true"]) {
  pointer-events: auto;
}

/* Scrollbar personalizado para contenido del modal */
[id^="serviceModal"] .overflow-y-auto {
  scrollbar-width: thin;
  scrollbar-color: rgba(99, 102, 241, 0.5) transparent;
}

[id^="serviceModal"] .overflow-y-auto::-webkit-scrollbar {
  width: 8px;
}

[id^="serviceModal"] .overflow-y-auto::-webkit-scrollbar-track {
  background: transparent;
}

[id^="serviceModal"] .overflow-y-auto::-webkit-scrollbar-thumb {
  background-color: rgba(99, 102, 241, 0.5);
  border-radius: 10px;
}

[id^="serviceModal"] .overflow-y-auto::-webkit-scrollbar-thumb:hover {
  background-color: rgba(99, 102, 241, 0.8);
}

/* Responsive adjustments */
@media (max-width: 640px) {
  [id^="serviceModal"] > div {
    max-width: 100%;
    margin: 0;
    border-radius: 0;
    max-height: 100vh;
  }
  
  [id^="serviceModal"] .px-6 {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

/* ============================================================================
   FIX: Mensajes de validación HTML5 no deben mover otros campos
   ============================================================================ */

/* Asegurar que el grid mantenga sus dimensiones */
.grid.sm\:grid-cols-2 {
  align-items: start;
}

/* Los contenedores de campos usan position relative con padding bottom reservado */
.grid.sm\:grid-cols-2 > div.relative {
  position: relative;
}

/* Mensajes de error personalizados (position absolute, no desplazan layout) */
.grid.sm\:grid-cols-2 > div.relative > span.error-text,
.grid.sm\:grid-cols-2 > div.relative > span:has(.error-text) {
  position: absolute;
  left: 0;
  bottom: 0;
  font-size: 0.75rem;
  line-height: 1.25rem;
  pointer-events: none;
}

/* Ocultar tooltips de validación nativos del navegador */
input:invalid {
  box-shadow: none;
}

/* Borde rojo solo cuando el campo ha sido tocado (touched) */
input.peer:invalid:not(:placeholder-shown):not(:focus) {
  border-color: #ef4444;
}

/* En móvil, mantener el espacio */
@media (max-width: 640px) {
  .grid.sm\:grid-cols-2 > div.relative {
    min-height: auto;
  }
}

/* ============================================
   ESTILOS DE PAGINACIÓN
   ============================================ */

/* Animación suave al cambiar de página */
.pagination-container {
  animation: fadeIn 0.3s ease-in-out;
}

/* Botones de paginación con hover mejorado */
nav[aria-label="Pagination"] a {
  transition: all 0.2s ease-in-out;
}

nav[aria-label="Pagination"] a:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Página actual con animación de pulso sutil */
nav[aria-label="Pagination"] .bg-indigo-50 {
  animation: pulse-subtle 2s infinite;
}

@keyframes pulse-subtle {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.9;
  }
}

/* Mejorar apariencia en dispositivos táctiles */
@media (hover: none) and (pointer: coarse) {
  nav[aria-label="Pagination"] a {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* Espaciado mejorado en móviles */
@media (max-width: 640px) {
  .pagination-container {
    padding-top: 1rem;
  }
  
  .pagination-container a,
  .pagination-container span {
    padding: 0.5rem 1rem;
  }
}