/* Apptualízate - Estilos Personalizados */
/* Complemento a Tailwind CSS para funcionalidades específicas */

/* ============================================
   VARIABLES CSS PERSONALIZADAS
   ============================================ */

:root {
  --primary-50: #eff6ff;
  --primary-500: #3b82f6;
  --primary-600: #2563eb;
  --primary-700: #1d4ed8;
  --primary-900: #1e3a8a;
  --secondary-500: #10b981;
  --secondary-600: #059669;
  
  --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-medium: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-strong: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  
  --transition-fast: 0.15s ease-in-out;
  --transition-normal: 0.3s ease-in-out;
  --transition-slow: 0.5s ease-in-out;
}

/* ============================================
   MEJORAS DE ACCESIBILIDAD
   ============================================ */

/* Focus visible mejorado */
*:focus-visible {
  outline: 2px solid var(--primary-500);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Reducir movimiento para usuarios sensibles */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================
   TIPOGRAFÍA MEJORADA
   ============================================ */

/* Mejor legibilidad en pantallas */
body {
  font-feature-settings: "kern" 1, "liga" 1;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Headlines con mejor spacing */
h1, h2, h3, h4, h5, h6 {
  letter-spacing: -0.025em;
  line-height: 1.2;
}

/* Texto de párrafos optimizado */
p {
  line-height: 1.7;
  color: #374151;
}

/* ============================================
   COMPONENTES PERSONALIZADOS
   ============================================ */

/* Botones con estados mejorados */
.btn-primary {
  @apply inline-flex items-center justify-center px-6 py-3 border border-transparent text-base font-medium rounded-lg text-white bg-primary-600 hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500 transition-all duration-200;
  transform: translateY(0);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-medium);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  @apply inline-flex items-center justify-center px-6 py-3 border border-gray-300 text-base font-medium rounded-lg text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500 transition-all duration-200;
}

/* Cards con hover mejorado */
.card {
  @apply bg-white rounded-xl shadow-lg border border-gray-100 transition-all duration-300;
  transform: translateY(0);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-strong);
}

/* ============================================
   ANIMACIONES ESPECÍFICAS
   ============================================ */

/* Fade in mejorado */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translate3d(0, 30px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translate3d(-30px, 0, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.8;
  }
}

/* Clases de animación */
.animate-fade-in-up {
  animation: fadeInUp 0.6s ease-out forwards;
}

.animate-fade-in {
  animation: fadeIn 0.5s ease-in-out forwards;
}

.animate-slide-in-left {
  animation: slideInLeft 0.5s ease-out forwards;
}

.animate-pulse-slow {
  animation: pulse 3s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ============================================
   LOADING STATES
   ============================================ */

.loading-skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.loading-spinner {
  border: 3px solid #f3f3f3;
  border-top: 3px solid var(--primary-500);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ============================================
   FORMULARIOS MEJORADOS
   ============================================ */

.form-input {
  @apply w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary-500 focus:border-primary-500 transition-colors;
}

.form-input:focus {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-input.error {
  @apply border-red-500;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-label {
  @apply block text-sm font-medium text-gray-700 mb-2;
}

.error-message {
  @apply text-red-500 text-sm mt-1 flex items-center;
}

.success-message {
  @apply bg-green-100 border border-green-400 text-green-700 px-4 py-3 rounded-lg mb-4;
}

/* ============================================
   NAVEGACIÓN MEJORADA
   ============================================ */

.nav-link {
  position: relative;
  transition: var(--transition-normal);
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--primary-500);
  transition: width var(--transition-normal);
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}

/* ============================================
   MODALES MEJORADOS
   ============================================ */

.modal-backdrop {
  backdrop-filter: blur(4px);
  background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translate3d(0, -20px, 0) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

/* ============================================
   ACORDEONES MEJORADOS
   ============================================ */

.accordion-item {
  transition: all var(--transition-normal);
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-normal) ease;
}

.accordion-content.open {
  max-height: 1000px; /* Ajustar según contenido */
}

.accordion-toggle {
  transition: var(--transition-fast);
}

.accordion-toggle:hover {
  background-color: rgba(59, 130, 246, 0.05);
}

/* ============================================
   UTILIDADES ESPECÍFICAS
   ============================================ */

/* Hover lift effect */
.hover-lift {
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.hover-lift:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-strong);
}

/* Gradientes personalizados */
.gradient-primary {
  background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-700) 100%);
}

.gradient-secondary {
  background: linear-gradient(135deg, var(--secondary-500) 0%, var(--secondary-600) 100%);
}

/* ============================================
   RESPONSIVE HELPERS
   ============================================ */

/* Ocultar en móvil */
@media (max-width: 768px) {
  .mobile-hidden {
    display: none !important;
  }
}

/* Mostrar solo en móvil */
@media (min-width: 769px) {
  .mobile-only {
    display: none !important;
  }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
  .no-print {
    display: none !important;
  }
  
  body {
    font-size: 12pt;
    line-height: 1.5;
    color: #000;
    background: #fff;
  }
  
  h1, h2, h3 {
    page-break-after: avoid;
  }
  
  img {
    max-width: 100% !important;
  }
}

/* ============================================
   DARK MODE SUPPORT (FUTURO)
   ============================================ */

@media (prefers-color-scheme: dark) {
  .dark-mode-auto {
    --bg-primary: #1f2937;
    --text-primary: #f9fafb;
    --border-color: #374151;
  }
}

/* ============================================
   PERFORMANCE OPTIMIZATIONS
   ============================================ */

/* Will-change para elementos animados */
.animate-fade-in-up,
.hover-lift,
.modal-content {
  will-change: transform, opacity;
}

/* GPU acceleration para transforms */
.transform-gpu {
  transform: translate3d(0, 0, 0);
}

/* ============================================
   CUSTOM SCROLLBAR (WEBKIT)
   ============================================ */

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: var(--primary-500);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-600);
}