/* assets/css/ux-elements.css */
/* Estilos para los elementos de mejora UX */

/* Contador de caracteres */
.char-counter {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  text-align: right;
  transition: color 0.3s ease;
}

.char-counter.warning {
  color: #ffaa00;
}

.char-counter.error {
  color: var(--danger);
}

/* Indicador de campo requerido */
.required-indicator {
  color: var(--danger);
  font-size: 12px;
  margin-top: 4px;
  display: none;
}

.input-field:invalid:not(:placeholder-shown) ~ .required-indicator {
  display: block;
}

/* Sugerencias contextuales */
.contextual-hint {
  background: rgba(0, 212, 255, 0.1);
  border: 1px solid rgba(0, 212, 255, 0.2);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--text);
  animation: slideDown 0.3s ease;
}

.contextual-hint i {
  color: var(--primary);
  margin-right: 8px;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Estado de carga */
.loading-state {
  position: relative;
  pointer-events: none;
}

.loading-state::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Tooltips informativos */
.tooltip-wrapper {
  position: relative;
  display: inline-block;
}

.tooltip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  margin-bottom: 8px;
}

.tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: rgba(0, 0, 0, 0.9);
}

.tooltip-wrapper:hover .tooltip {
  opacity: 1;
}

/* Indicador visual de progreso guardado */
.auto-save-indicator {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--success);
  color: white;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  display: none;
  z-index: 1000;
  animation: slideInRight 0.3s ease;
}

.auto-save-indicator.show {
  display: block;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Mejoras para dispositivos táctiles */
@media (hover: none) and (pointer: coarse) {
  .service-card {
    min-height: 140px; /* Tamaño mínimo para toque fácil */
  }
  
  .btn, .tab, .day-option {
    min-height: 44px; /* Tamaño mínimo recomendado para toque */
  }
  
  .input-field {
    font-size: 16px; /* Prevenir zoom en iOS */
  }
}

/* Modo de alto contraste para accesibilidad */
@media (prefers-contrast: high) {
  :root {
    --glass-bg: rgba(255, 255, 255, 0.12);
    --glass-border: rgba(255, 255, 255, 0.3);
    --text-muted: rgba(255, 255, 255, 0.9);
  }
  
  .service-card {
    border-width: 2px;
  }
  
  .btn {
    border-width: 2px;
  }
}

/* Soporte para modo oscuro del sistema */
@media (prefers-color-scheme: dark) {
  /* Ya estamos en modo oscuro, pero podemos ajustar */
  :root {
    --text: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.8);
  }
}

/* Animaciones de entrada para elementos dinámicos */
@keyframes popIn {
  0% {
    opacity: 0;
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.service-cta,
.service-selected-badge,
#btnContinueTo3 {
  animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}