/* Estilos personalizados para mejorar la responsividad */

/* Mejoras para dispositivos móviles */
@media (max-width: 640px) {
  /* Asegurar que los botones táctiles tengan el tamaño mínimo recomendado */
  button, input, select, label {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* Mejorar el espaciado en móviles */
  .mobile-optimized {
    padding: 1rem;
  }
  
  /* Optimizar el scroll en móviles */
  .mobile-scroll {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }
}

/* Mejoras para tablets */
@media (min-width: 641px) and (max-width: 1024px) {
  .tablet-optimized {
    padding: 1.5rem;
  }
}

/* Animaciones personalizadas */
.fade-in {
  animation: fadeIn 0.5s ease-in-out;
}

.slide-in-left {
  animation: slideInLeft 0.3s ease-out;
}

.slide-in-right {
  animation: slideInRight 0.3s ease-out;
}

.bounce-gentle {
  animation: bounceGentle 0.6s ease-in-out;
}

/* Keyframes para las animaciones */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInLeft {
  from {
    transform: translateX(-100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes bounceGentle {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

/* Mejoras para el menú móvil */
.mobile-menu {
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-menu.open {
  transform: translateX(0);
}

/* Mejoras para las tarjetas en diferentes tamaños */
.card-responsive {
  transition: all 0.3s ease;
}

.card-responsive:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Mejoras para los botones responsivos */
.btn-responsive {
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.btn-responsive:active {
  transform: scale(0.95);
}

.btn-responsive::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.3s, height 0.3s;
}

.btn-responsive:active::before {
  width: 200px;
  height: 200px;
}

/* Mejoras para el formulario responsivo */
.form-responsive input:focus,
.form-responsive select:focus {
  transform: scale(1.02);
  transition: transform 0.2s ease;
}

/* Mejoras para las transacciones en móviles */
.transaction-mobile {
  border-radius: 12px;
  margin-bottom: 0.75rem;
}

.transaction-mobile .transaction-header {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.transaction-mobile .transaction-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

/* Mejoras para el estado vacío responsivo */
.empty-state-responsive {
  padding: 2rem 1rem;
}

.empty-state-responsive .empty-icon {
  width: 4rem;
  height: 4rem;
  margin: 0 auto 1rem;
}

/* Mejoras para el header responsivo */
.header-responsive {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Mejoras para el scroll suave */
.smooth-scroll {
  scroll-behavior: smooth;
}

/* Mejoras para el focus visible */
.focus-visible:focus {
  outline: 2px solid #0ea5e9;
  outline-offset: 2px;
}

/* Mejoras para la accesibilidad táctil */
.touch-friendly {
  touch-action: manipulation;
}

/* Mejoras para el modo oscuro (si se implementa en el futuro) */
@media (prefers-color-scheme: dark) {
  .dark-mode-support {
    background-color: #1f2937;
    color: #f9fafb;
  }
}

/* Mejoras para dispositivos de alta densidad */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .high-dpi-optimized {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* Mejoras para el rendimiento en dispositivos de gama baja */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Mejoras para el contraste y legibilidad */
.high-contrast {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Mejoras para el espaciado consistente */
.spacing-system {
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
}

/* Mejoras para el grid responsivo */
.grid-responsive {
  display: grid;
  gap: var(--space-md);
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

/* Mejoras para el flex responsivo */
.flex-responsive {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
}

/* Mejoras para el texto responsivo */
.text-responsive {
  font-size: clamp(0.875rem, 2.5vw, 1rem);
  line-height: 1.5;
}

.text-responsive-lg {
  font-size: clamp(1.125rem, 3vw, 1.5rem);
  line-height: 1.4;
}

.text-responsive-xl {
  font-size: clamp(1.5rem, 4vw, 2rem);
  line-height: 1.3;
}

/* Mejoras para el padding responsivo */
.padding-responsive {
  padding: clamp(1rem, 4vw, 2rem);
}

/* Mejoras para el margin responsivo */
.margin-responsive {
  margin: clamp(1rem, 4vw, 2rem);
}

/* Mejoras para el border-radius responsivo */
.radius-responsive {
  border-radius: clamp(0.5rem, 2vw, 1rem);
}

/* Mejoras para el shadow responsivo */
.shadow-responsive {
  box-shadow: 0 clamp(2px, 1vw, 4px) clamp(8px, 2vw, 20px) rgba(0, 0, 0, 0.1);
}

/* Mejoras para el hover en dispositivos táctiles */
@media (hover: none) and (pointer: coarse) {
  .touch-hover {
    transition: none;
  }
  
  .touch-hover:hover {
    transform: none;
    box-shadow: none;
  }
}

/* Mejoras para el scroll horizontal en móviles */
.scroll-horizontal {
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.scroll-horizontal > * {
  scroll-snap-align: start;
  flex-shrink: 0;
}

/* Mejoras para el scroll vertical suave */
.scroll-vertical {
  overflow-y: auto;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

/* Mejoras para el focus en dispositivos móviles */
@media (max-width: 640px) {
  .mobile-focus:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.5);
  }
}

/* Mejoras para el estado activo en dispositivos táctiles */
.touch-active:active {
  background-color: rgba(14, 165, 233, 0.1);
  transform: scale(0.98);
}

/* Mejoras para el estado disabled */
.disabled-state {
  opacity: 0.5;
  pointer-events: none;
  cursor: not-allowed;
}

/* Mejoras para el loading state */
.loading-state {
  position: relative;
  overflow: hidden;
}

.loading-state::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}
