/* ============================================
   CSS ESPECIAL PARA PERSONAS MAYORES
   ============================================ */

/* RESET Y BASE */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px; /* Base para cálculo */
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 1.25rem; /* 20px - Muy grande */
  line-height: 1.6;
  color: #1f2937; /* Gris oscuro para buen contraste */
  background-color: #f9fafb;
  padding: 1rem;
  min-height: 100vh;

  /* Mejor accesibilidad táctil */
  -webkit-tap-highlight-color: rgba(0,0,0,0.1);
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* Permitir selección en áreas de texto */
input, textarea, .result-box {
  -webkit-user-select: text;
  user-select: text;
}

/* ENCABEZADO - SIMPLE Y CLARO */
.app-header {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  padding: 1.5rem 1rem;
  border-radius: 1rem;
  margin-bottom: 2rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  text-align: center;
}

.logo-section h1 {
  font-size: 1.75rem; /* 28px */
  font-weight: bold;
  margin-bottom: 0.5rem;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.tagline {
  font-size: 1rem; /* 16px */
  opacity: 0.9;
  font-weight: 300;
}

.status-indicators {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.status-label {
  font-weight: bold;
  font-size: 1.125rem; /* 18px */
}

.status-value {
  background: rgba(255, 255, 255, 0.2);
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  font-weight: bold;
  min-width: 80px;
  display: inline-block;
  text-align: center;
}

/* SECCIÓN PRINCIPAL - BOTÓN GRANDE */
.main-section {
  text-align: center;
  margin: 2rem 0;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.big-button {
  font-size: 1.5rem; /* 24px */
  padding: 1.5rem 3rem; /* Botones muy grandes */
  border: none;
  border-radius: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  min-height: 80px;
  min-width: 280px;
  margin: 1rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.05em;

  /* Mejor accesibilidad táctil */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.primary-button {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  box-shadow: 0 4px 14px 0 rgba(16, 185, 129, 0.3);
}

.primary-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px 0 rgba(16, 185, 129, 0.4);
}

.primary-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px 0 rgba(16, 185, 129, 0.3);
}

/* INDICADORES VISUALES */
.listening-indicator {
  margin: 2rem 0;
  padding: 2rem;
  border-radius: 1rem;
  background: rgba(239, 68, 68, 0.1);
  border: 3px solid #ef4444;
}

.listening-animation {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto 1rem;
}

.pulse-ring {
  position: absolute;
  border: 3px solid #ef4444;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

.pulse-ring:nth-child(1) {
  width: 60px;
  height: 60px;
  top: 30px;
  left: 30px;
}

.pulse-ring:nth-child(2) {
  width: 80px;
  height: 80px;
  top: 20px;
  left: 20px;
  animation-delay: 0.5s;
}

.pulse-ring:nth-child(3) {
  width: 100px;
  height: 100px;
  top: 10px;
  left: 10px;
  animation-delay: 1s;
}

@keyframes pulse {
  0% {
    transform: scale(0.8);
    opacity: 1;
  }
  100% {
    transform: scale(1.2);
    opacity: 0;
  }
}

.listening-text {
  font-size: 1.25rem;
  font-weight: bold;
  color: #dc2626;
  margin: 0;
}

.processing-indicator {
  margin: 2rem 0;
  padding: 2rem;
  border-radius: 1rem;
  background: rgba(59, 130, 246, 0.1);
  border: 3px solid #3b82f6;
}

.spinner {
  width: 60px;
  height: 60px;
  border: 4px solid #e5e7eb;
  border-top: 4px solid #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.processing-text {
  font-size: 1.125rem;
  font-weight: bold;
  color: #1d4ed8;
  margin: 0;
}

/* RESULTADOS - MUY LEGIBLES */
.results-section {
  margin: 2rem 0;
}

.result-box {
  background: white;
  border: 3px solid #e5e7eb;
  border-radius: 1rem;
  padding: 1.5rem;
  margin: 1rem 0;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.result-box h3 {
  font-size: 1.25rem;
  font-weight: bold;
  margin-bottom: 1rem;
  color: #374151;
}

.big-text {
  font-size: 1.125rem; /* 18px */
  line-height: 1.8;
  color: #1f2937;
  background: #f9fafb;
  padding: 1rem;
  border-radius: 0.5rem;
  border-left: 4px solid #10b981;
}

/* BOTONES DE ACCIÓN */
.action-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin: 2rem 0;
  flex-wrap: wrap;
}

.success-button {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  box-shadow: 0 4px 14px 0 rgba(16, 185, 129, 0.3);
}

.danger-button {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  box-shadow: 0 4px 14px 0 rgba(239, 68, 68, 0.3);
}

/* SECCIÓN DE AYUDA - SIEMPRE ACCESIBLE */
.help-section {
  margin: 2rem 0;
  text-align: center;
}

.help-button {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  border: none;
  padding: 1rem 2rem;
  border-radius: 1rem;
  font-size: 1.125rem;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 14px 0 rgba(245, 158, 11, 0.3);
  transition: all 0.3s ease;
}

.help-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px 0 rgba(245, 158, 11, 0.4);
}

.help-panel {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.help-content {
  background: white;
  padding: 2rem;
  border-radius: 1rem;
  max-width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
  text-align: center;
}

.help-content h3 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  color: #1f2937;
}

.help-content p {
  font-size: 1.125rem;
  margin: 0.5rem 0;
  color: #4b5563;
}

.help-action-button {
  background: #6b7280;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-size: 1rem;
  margin: 0.5rem;
  cursor: pointer;
}

/* COLA OFFLINE - INDICADOR VISUAL */
.offline-queue {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
}

.offline-item {
  background: #f59e0b;
  color: white;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: bold;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  animation: pulse 2s infinite;
}

/* ESTADOS VISIBLES */
.hidden {
  display: none !important;
}

/* RESPONSIVE PARA PANTALLAS GRANDES */
@media (min-width: 768px) {
  body {
    max-width: 600px;
    margin: 0 auto;
    padding: 2rem;
  }

  .app-header {
    padding: 2rem;
  }

  .logo-section h1 {
    font-size: 2rem; /* 32px en desktop */
  }

  .big-button {
    font-size: 1.75rem; /* 28px en desktop */
    padding: 2rem 4rem;
    min-width: 400px;
  }
}

/* ALTO CONTRASTE PARA MEJOR VISIBILIDAD */
@media (prefers-contrast: high) {
  .primary-button {
    border: 3px solid #000;
  }

  .result-box {
    border: 3px solid #000;
  }

  .status-value {
    background: #000;
    color: #fff;
  }
}

/* SOPORTE PARA MODO OSCURO */
@media (prefers-color-scheme: dark) {
  body {
    background-color: #111827;
    color: #f9fafb;
  }

  .result-box {
    background: #1f2937;
    border-color: #374151;
  }

  .big-text {
    background: #111827;
    color: #f9fafb;
  }
}

/* ANIMACIONES SUAVES */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-box {
  animation: fadeIn 0.3s ease-out;
}

.action-buttons {
  animation: fadeIn 0.3s ease-out;
}

/* MEJORAS DE ACCESIBILIDAD */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* FOCUS VISIBLE PARA NAVEGACIÓN POR TECLADO */
button:focus-visible {
  outline: 3px solid #fbbf24;
  outline-offset: 2px;
}

/* SOPORTE PARA LECTORES DE PANTALLA */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================
   PRINT STYLES (PARA FUTURAS FUNCIONALIDADES)
   ============================================ */

@media print {
  body {
    background: white;
    color: black;
  }

  .app-header,
  .help-section,
  .offline-queue {
    display: none;
  }

  .result-box {
    border: 2px solid black;
    page-break-inside: avoid;
  }
}

/* ============================================
   NOTIFICACIONES Y FEEDBACK VISUAL
   ============================================ */

/* Indicador de conexión */
.connection-status {
  position: fixed;
  top: 10px;
  left: 10px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

.connection-status.offline {
  background: #ef4444;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

/* Feedback háptico visual */
.big-button:active {
  transform: scale(0.95);
  transition: transform 0.1s ease;
}

/* Loading states */
.loading {
  position: relative;
  overflow: hidden;
}

.loading::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%; }
}