/* =========================================================
   ESTILOS VISTA PACIENTE (TABLET HOSPITALARIA)
   Diseñado para máxima legibilidad a distancia (1-2 metros),
   cero fatiga visual y botones táctiles gigantes accesibles.
   ========================================================= */

body.patient-view {
  background-color: var(--bg-patient);
  color: var(--text-patient-secondary);
  font-family: var(--font-accessible);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  user-select: none;
}

/* Header superior del Paciente */
.patient-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 36px;
  background: rgba(22, 24, 27, 0.95);
  border-bottom: 2px solid rgba(255, 255, 255, 0.06);
  z-index: 10;
}

.patient-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.patient-brand .icon-heart {
  font-size: 2rem;
  color: var(--accent-rose);
  animation: pulse 2.5s infinite;
}

.patient-brand .title {
  font-family: var(--font-title);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: #ffffff;
}

.patient-header-controls {
  display: flex;
  align-items: center;
  gap: 20px;
}

.pin-display-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-patient-surface);
  padding: 8px 20px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
}

.pin-display-badge:hover {
  background: rgba(255, 255, 255, 0.12);
}

.pin-display-badge .label {
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-patient-muted);
}

.pin-display-badge .pin-number {
  font-family: var(--font-title);
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: 4px;
  color: var(--primary);
}

.btn-qr-icon {
  background: var(--bg-patient-surface);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  border-radius: 50%;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-qr-icon:hover {
  transform: scale(1.08);
  background: var(--primary-soft);
  color: var(--primary);
}

/* Indicador sutil de familiar escribiendo / dictando */
.typing-banner {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 24px;
  background: rgba(56, 189, 248, 0.12);
  border-bottom: 1px solid rgba(56, 189, 248, 0.25);
  color: var(--primary);
  font-size: 1.3rem;
  font-weight: 600;
  animation: fadeIn 0.3s ease;
}

.typing-banner.active {
  display: flex;
}

.typing-dots {
  display: inline-flex;
  gap: 6px;
}

.typing-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  animation: typingDot 1.4s infinite ease-in-out both;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingDot {
  0%, 80%, 100% { transform: scale(0); opacity: 0.3; }
  40% { transform: scale(1); opacity: 1; }
}

/* Contenedor Principal de Mensajes */
.patient-main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 24px 48px;
  position: relative;
  overflow: hidden;
}

/* Tarjeta del Mensaje Principal Activo */
.patient-message-hero {
  width: 100%;
  max-width: 1100px;
  background: var(--bg-patient-card);
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-xl);
  padding: 42px 54px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  animation: fadeIn 0.4s ease-out;
  min-height: 280px;
}

.message-sender-tag {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 20px;
  text-transform: capitalize;
}

.message-sender-tag .sender-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(56, 189, 248, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.patient-message-text {
  font-family: var(--font-accessible);
  font-size: clamp(38px, 4.5vw, 66px);
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-patient-primary); /* Amarillo pastel ultra legible */
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  word-break: break-word;
}

.message-time-tag {
  align-self: flex-end;
  margin-top: 24px;
  font-size: 1.1rem;
  color: var(--text-patient-muted);
}

/* Estado de Espera (Sin mensajes aún) */
.patient-empty-state {
  text-align: center;
  max-width: 700px;
}

.patient-empty-state .waiting-icon {
  font-size: 4.5rem;
  margin-bottom: 20px;
  display: inline-block;
  animation: pulse 3s infinite;
}

.patient-empty-state h2 {
  font-size: 2.4rem;
  color: #ffffff;
  margin-bottom: 12px;
}

.patient-empty-state p {
  font-size: 1.4rem;
  color: var(--text-patient-muted);
}

/* Banner flotante de confirmación de respuesta enviada */
.patient-feedback-banner {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  padding: 16px 36px;
  border-radius: var(--radius-pill);
  font-size: 1.6rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: none;
  z-index: 50;
}

.patient-feedback-banner.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Barra Inferior Fija con los 4 Botones Táctiles Gigantes */
.patient-actions-footer {
  padding: 24px 36px 32px;
  background: #111316;
  border-top: 2px solid rgba(255, 255, 255, 0.08);
  z-index: 20;
}

.patient-buttons-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  max-width: 1400px;
  margin: 0 auto;
}

.btn-patient-touch {
  height: clamp(90px, 12vh, 140px);
  border: none;
  border-radius: var(--radius-lg);
  font-family: var(--font-main);
  font-size: clamp(1.4rem, 2.4vw, 2.3rem);
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: var(--shadow-md);
  transition: all 0.15s ease-out;
  position: relative;
  overflow: hidden;
}

.btn-patient-touch .btn-icon {
  font-size: clamp(1.6rem, 2.6vw, 2.6rem);
}

.btn-patient-touch:active {
  transform: scale(0.96);
}

/* Botón 1: SÍ */
.btn-patient-yes {
  background-color: var(--btn-yes-bg);
  color: var(--btn-yes-text);
  box-shadow: 0 6px 20px var(--btn-yes-glow);
}
.btn-patient-yes:active, .btn-patient-yes.pressed {
  background-color: var(--btn-yes-active);
}

/* Botón 2: NO */
.btn-patient-no {
  background-color: var(--btn-no-bg);
  color: var(--btn-no-text);
  box-shadow: 0 6px 20px var(--btn-no-glow);
}
.btn-patient-no:active, .btn-patient-no.pressed {
  background-color: var(--btn-no-active);
}

/* Botón 3: DIME MÁS */
.btn-patient-more {
  background-color: var(--btn-more-bg);
  color: var(--btn-more-text);
  box-shadow: 0 6px 20px var(--btn-more-glow);
}
.btn-patient-more:active, .btn-patient-more.pressed {
  background-color: var(--btn-more-active);
}

/* Botón 4: NECESITO AYUDA */
.btn-patient-help {
  background-color: var(--btn-help-bg);
  color: var(--btn-help-text);
  box-shadow: 0 6px 20px var(--btn-help-glow);
}
.btn-patient-help:active, .btn-patient-help.pressed {
  background-color: var(--btn-help-active);
}

/* Modal QR para invitar familiares directamente desde la tablet */
.qr-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  z-index: 100;
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.2s ease;
}

.qr-modal-overlay.active {
  display: flex;
}

.qr-modal-card {
  background: var(--bg-patient-card);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-xl);
  padding: 40px;
  max-width: 480px;
  width: 90%;
  text-align: center;
  position: relative;
  box-shadow: var(--shadow-lg);
}

.qr-close-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
}

.qr-container {
  background: #ffffff;
  padding: 20px;
  border-radius: var(--radius-md);
  display: inline-block;
  margin: 24px 0 16px;
}

.qr-container canvas, .qr-container img {
  display: block;
  margin: 0 auto;
}

.qr-instructions {
  font-size: 1.1rem;
  color: var(--text-patient-secondary);
}

/* Ajustes Responsive para Tablets en Vertical o Pantallas Reducidas */
@media (max-width: 768px) {
  .patient-buttons-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .patient-header {
    padding: 12px 20px;
  }
  .patient-message-hero {
    padding: 28px 24px;
  }
}
