/* HospAI — Voice intake & clean UI */

:root {
  --severity-1: #dc2626;
  --severity-2: #ea580c;
  --severity-3: #ca8a04;
  --mic-active: #ef4444;
  --mic-idle: #0891b2;
}

.hospai-patient {
  --mic-idle: #6b9e8f;
  --mic-active: #c9a87c;
}

.emergency-flash {
  animation: emergency-pulse 1.5s ease-in-out infinite;
}

@keyframes emergency-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.85; }
}

@keyframes mic-ring {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(1.45); opacity: 0; }
}

@keyframes mic-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.45); }
  50% { box-shadow: 0 0 0 12px rgba(239, 68, 68, 0); }
}

.intake-shell {
  max-width: 42rem;
  margin: 0 auto;
}

.intake-card {
  background: white;
  border-radius: 1.25rem;
  border: 1px solid #e2e8f0;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(15, 39, 68, 0.06);
}

.dark .intake-card {
  background: #0f2744;
  border-color: #334155;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
}

.intake-textarea-wrap {
  position: relative;
}

.intake-textarea {
  width: 100%;
  min-height: 14rem;
  padding: 1.25rem 1.25rem 4rem;
  font-size: 1.0625rem;
  line-height: 1.65;
  border: none;
  resize: vertical;
  background: transparent;
  outline: none;
}

.dark .intake-textarea {
  color: #f1f5f9;
}

.intake-textarea::placeholder {
  color: #94a3b8;
}

.intake-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
}

.dark .intake-toolbar {
  border-color: #334155;
  background: #0a1628;
}

.lang-pill {
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid #cbd5e1;
  background: white;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s;
}

.dark .lang-pill {
  background: #1a3a5c;
  border-color: #475569;
  color: #94a3b8;
}

.lang-pill.active {
  background: #0891b2;
  border-color: #0891b2;
  color: white;
}

.mic-btn {
  position: relative;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 50%;
  border: none;
  background: var(--mic-idle);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.15s;
  flex-shrink: 0;
}

.mic-btn:hover {
  transform: scale(1.05);
  background: #0e7490;
}

.mic-btn.listening {
  background: var(--mic-active);
  animation: mic-glow 1.5s ease-in-out infinite;
}

.mic-btn.listening::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--mic-active);
  animation: mic-ring 1.2s ease-out infinite;
}

.mic-btn svg {
  width: 1.35rem;
  height: 1.35rem;
  position: relative;
  z-index: 1;
}

.voice-status {
  font-size: 0.8125rem;
  color: #64748b;
  min-height: 1.25rem;
}

.voice-status.listening {
  color: #ef4444;
  font-weight: 500;
}

.voice-status.error {
  color: #dc2626;
}

.intake-preview {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 0.75rem;
  background: #ecfeff;
  border: 1px solid #a5f3fc;
  font-size: 0.8125rem;
}

.dark .intake-preview {
  background: rgba(8, 145, 178, 0.12);
  border-color: #155e75;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.preview-chip {
  padding: 0.35rem 0.5rem;
  border-radius: 0.5rem;
  background: white;
  border: 1px solid #e2e8f0;
  font-size: 0.75rem;
}

.dark .preview-chip {
  background: #0a1628;
  border-color: #334155;
}

.preview-chip strong {
  display: block;
  color: #64748b;
  font-weight: 500;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

@media (prefers-reduced-motion: reduce) {
  .animate-pulse,
  .mic-btn.listening,
  .mic-btn.listening::before {
    animation: none;
  }
}

[dir="rtl"] .intake-textarea {
  text-align: right;
}

[data-question-text].question-reading {
  padding: 0.5rem;
  margin: -0.5rem;
  border-radius: 0.75rem;
  background: rgba(107, 158, 143, 0.1);
  outline: 2px solid rgba(107, 158, 143, 0.35);
}

.hospai-patient [data-question-text].question-reading {
  background: #faf3eb;
  outline: 2px solid #f0dcc4;
}

.secretary-helper {
  padding: 1rem 1.25rem;
  border-radius: 1rem;
  background: linear-gradient(135deg, rgba(107, 158, 143, 0.06), rgba(250, 247, 242, 0.8));
  border: 1px solid rgba(184, 221, 200, 0.5);
}

.secretary-avatar-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.secretary-avatar-stage {
  position: relative;
  width: 7rem;
  height: 7rem;
}

.secretary-avatar,
.secretary-avatar-img {
  width: 7rem;
  height: 7rem;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #6b9e8f;
  box-shadow: 0 4px 14px rgba(107, 158, 143, 0.22);
  transform-origin: 50% 88%;
  will-change: transform;
}

.secretary-idle .secretary-avatar-img {
  animation: secretary-breathe 4.2s ease-in-out infinite;
}

@keyframes secretary-breathe {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-3px) scale(1.015); }
}

.secretary-avatar-shine {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(ellipse 70% 40% at 50% 18%, rgba(255, 255, 255, 0.45), transparent 65%);
}

.secretary-avatar-stage::after {
  content: '';
  position: absolute;
  left: 34%;
  right: 34%;
  bottom: 26%;
  height: 11%;
  border-radius: 40% 40% 50% 50%;
  background: rgba(150, 75, 75, 0);
  transform: scaleY(0.25);
  transition: transform 0.07s ease, background 0.07s ease;
  pointer-events: none;
}

.secretary-mouth-open .secretary-avatar-stage::after {
  background: rgba(140, 65, 65, 0.32);
  transform: scaleY(1.05);
}

.secretary-voice-wave {
  position: absolute;
  left: 50%;
  bottom: 4%;
  transform: translateX(-50%);
  width: 5.5rem;
  height: 1.25rem;
  opacity: 0.85;
  pointer-events: none;
  z-index: 2;
}

.secretary-quality-badge {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.45rem;
  border-radius: 9999px;
  background: linear-gradient(135deg, #ecfeff, #d1fae5);
  color: #0e7490;
  border: 1px solid rgba(8, 145, 178, 0.25);
}

.secretary-quality-badge.hidden {
  display: none;
}

.secretary-avatar-wrap.secretary-speaking .secretary-avatar-img {
  box-shadow: 0 0 0 4px rgba(8, 145, 178, 0.35), 0 4px 20px rgba(8, 145, 178, 0.4);
  animation: secretary-talk-head 0.52s ease-in-out infinite;
}

.secretary-speaking .secretary-avatar-shine {
  opacity: 1;
  animation: secretary-shine 1.1s ease-in-out infinite;
}

@keyframes secretary-talk-head {
  0%, 100% { transform: translateY(0) rotate(0deg) scale(1); }
  30% { transform: translateY(-2px) rotate(-0.7deg) scale(1.02); }
  70% { transform: translateY(-2px) rotate(0.7deg) scale(1.02); }
}

@keyframes secretary-shine {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

@keyframes secretary-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

.secretary-speak-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  border: 1px solid #cbd5e1;
  background: #fffefb;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.secretary-speak-btn:hover {
  border-color: #0891b2;
  background: #ecfeff;
}

.secretary-speak-btn.secretary-speak-active {
  background: #0891b2;
  border-color: #0891b2;
  transform: scale(1.05);
}

.secretary-bubble-live {
  border-color: rgba(8, 145, 178, 0.35) !important;
  box-shadow: 0 0 0 2px rgba(8, 145, 178, 0.08);
}

.secretary-bubble {
  padding: 0.75rem 1rem;
  border-radius: 0.75rem 1rem 1rem 0.25rem;
  background: #fffefb;
  border: 1px solid #e8e2d8;
}

.answer-mic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  border: 1px solid #cbd5e1;
  background: white;
  font-size: 1.1rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.dark .answer-mic {
  background: #0f172a;
  border-color: #475569;
}

.answer-mic:hover {
  border-color: #0891b2;
  background: #ecfeff;
}

.answer-mic.listening {
  background: #0891b2;
  border-color: #0891b2;
  animation: secretary-pulse 1.2s ease-in-out infinite;
}
