/**
 * ADHC Sprint 6H — Clinical Risk Display & UI Polish
 * ====================================================
 * Phase 5  — Severity Score Visualization (professional clinical risk card)
 * Phase 6  — Confidence display
 * Phase 7  — Recommendation explainability
 * Phase 9  — Clinical score debug mode
 * Phase 10 — UI Polish: glassmorphism, shadows, animations
 */

/* ═══════════════════════════════════════════════════════════════════════
   PHASE 5 — SEVERITY RISK CARD
   ═══════════════════════════════════════════════════════════════════════ */

.severity-risk-card {
  background: #FFFFFF;
  border: 1.5px solid var(--c-border, #E8EEF4);
  border-radius: 1.25rem;
  padding: 1.5rem 1.25rem;
  margin-top: 1rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.10), 0 2px 8px rgba(0,0,0,0.06);
  animation: s6h-slide-up 0.3s cubic-bezier(0.34,1.56,0.64,1) both;
  overflow: hidden;
  position: relative;
}

/* Color accent bar on left */
.severity-risk-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 6px;
  background: var(--severity-color, #22C55E);
  border-radius: 1.25rem 0 0 1.25rem;
}

/* Digital score badge */
.severity-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 90px;
  min-height: 90px;
  background: var(--severity-color, #22C55E);
  border-radius: 1rem;
  padding: 0.5rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  flex-shrink: 0;
}

.severity-badge__level {
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: rgba(255,255,255,0.90);
  line-height: 1;
  margin-bottom: 0.2rem;
}

.severity-badge__score {
  font-size: 2.4rem;
  font-weight: 900;
  color: #FFFFFF;
  line-height: 1;
  letter-spacing: -1px;
  animation: s6h-count-up 0.6s ease both;
}

.severity-badge__denom {
  font-size: 0.75rem;
  font-weight: 700;
  color: rgba(255,255,255,0.80);
  line-height: 1;
}

/* Card header row */
.severity-risk-card__header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.severity-risk-card__info {
  flex: 1;
  min-width: 0;
}

.severity-risk-card__label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--c-muted, #64748B);
  margin-bottom: 0.2rem;
}

.severity-risk-card__name {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--severity-color, #22C55E);
  line-height: 1.15;
}

/* Risk info grid */
.severity-risk-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.6rem;
  margin-top: 0.875rem;
}

.severity-risk-item {
  background: var(--c-surface, #F8FAFC);
  border: 1px solid var(--c-border, #E8EEF4);
  border-radius: 0.75rem;
  padding: 0.6rem 0.5rem;
  text-align: center;
}

.severity-risk-item__label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--c-muted, #64748B);
  margin-bottom: 0.2rem;
}

.severity-risk-item__value {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--c-text, #0F172A);
  line-height: 1.2;
}

/* Severity color legend dots */
.severity-legend {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--c-border, #E8EEF4);
}

.severity-legend-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--c-muted, #64748B);
}

.severity-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════════════
   PHASE 5 — SEVERITY URGENCY BADGE (professional)
   ═══════════════════════════════════════════════════════════════════════ */

.urgency-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border: 1.5px solid transparent;
}

.urgency-badge--mild     { background: rgba(34,197,94,0.12);  color: #166534; border-color: rgba(34,197,94,0.3);  }
.urgency-badge--moderate { background: rgba(245,158,11,0.12); color: #92400E; border-color: rgba(245,158,11,0.3); }
.urgency-badge--high     { background: rgba(249,115,22,0.12); color: #9A3412; border-color: rgba(249,115,22,0.3); }
.urgency-badge--critical { background: rgba(239,68,68,0.12);  color: #991B1B; border-color: rgba(239,68,68,0.3);  }

/* ═══════════════════════════════════════════════════════════════════════
   PHASE 6 — CONFIDENCE CARD
   ═══════════════════════════════════════════════════════════════════════ */

.confidence-card {
  background: #FFFFFF;
  border: 1.5px solid var(--c-border, #E8EEF4);
  border-radius: 1rem;
  padding: 1.1rem 1.25rem;
  margin-top: 0.875rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  animation: s6h-fade-in 0.25s ease both;
}

.confidence-card__title {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--c-muted, #64748B);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.confidence-card__title::before {
  content: '📊';
  font-size: 0.9rem;
}

.confidence-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}

.confidence-row:last-child { margin-bottom: 0; }

.confidence-row__name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--c-text, #0F172A);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.confidence-row__bar-wrap {
  flex: 1;
  background: var(--c-border, #E8EEF4);
  border-radius: 9999px;
  height: 8px;
  overflow: hidden;
}

.confidence-row__bar {
  height: 8px;
  border-radius: 9999px;
  background: linear-gradient(90deg, var(--c-primary, #0F9D94) 0%, #0D8A82 100%);
  transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
}

.confidence-row__pct {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--c-primary, #0F9D94);
  min-width: 2.5rem;
  text-align: right;
}

/* ═══════════════════════════════════════════════════════════════════════
   PHASE 7 — RECOMMENDATION EXPLANATION CARD
   ═══════════════════════════════════════════════════════════════════════ */

.explain-card {
  background: linear-gradient(135deg, rgba(15,157,148,0.06) 0%, transparent 100%);
  border: 1.5px solid rgba(15,157,148,0.25);
  border-radius: 1rem;
  padding: 1.1rem 1.25rem;
  margin-top: 0.875rem;
  animation: s6h-fade-in 0.28s ease both;
}

.explain-card__title {
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--c-primary, #0F9D94);
  margin-bottom: 0.75rem;
}

.explain-symptoms-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.explain-symptom-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(15,157,148,0.10);
  border: 1px solid rgba(15,157,148,0.25);
  border-radius: 9999px;
  padding: 0.25rem 0.65rem;
  font-size: 0.80rem;
  font-weight: 700;
  color: var(--c-primary, #0F9D94);
}

.explain-dept-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.explain-dept-name {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--c-text, #0F172A);
}

.explain-reason {
  font-size: 0.875rem;
  color: var(--c-text-2, #1E293B);
  line-height: 1.55;
  padding: 0.6rem 0.875rem;
  background: rgba(255,255,255,0.7);
  border-radius: 0.65rem;
  border-left: 3px solid var(--c-primary, #0F9D94);
}

/* ═══════════════════════════════════════════════════════════════════════
   PHASE 9 — CLINICAL DEBUG PANEL
   ═══════════════════════════════════════════════════════════════════════ */

.s6h-debug-panel {
  background: #0F172A;
  border: 1px solid #334155;
  border-radius: 0.875rem;
  margin-top: 1rem;
  overflow: hidden;
  font-family: 'SFMono-Regular', 'Consolas', monospace;
  font-size: 0.75rem;
}

.s6h-debug-panel[hidden] { display: none !important; }

.s6h-debug-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  background: #1E293B;
  color: #E2E8F0;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid #334155;
}

.s6h-debug-toggle::after {
  content: '▼';
  margin-left: auto;
  font-size: 0.6rem;
  color: #94A3B8;
  transition: transform 0.2s ease;
}

.s6h-debug-panel.collapsed .s6h-debug-toggle::after { transform: rotate(-90deg); }
.s6h-debug-panel.collapsed .s6h-debug-body { display: none; }

.s6h-debug-body {
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.s6h-debug-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.3rem 0.5rem;
  background: #1E293B;
  border-radius: 4px;
  border: 1px solid #334155;
}

.s6h-debug-row__label {
  color: #A78BFA;
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.s6h-debug-row__value {
  color: #7DD3FC;
  font-weight: 600;
  font-size: 0.78rem;
}

/* ═══════════════════════════════════════════════════════════════════════
   PHASE 10 — UI POLISH: Glassmorphism + animations
   ═══════════════════════════════════════════════════════════════════════ */

/* Glassmorphism variant for assessment cards */
.clinical-card--glass {
  background: rgba(255,255,255,0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1.5px solid rgba(255,255,255,0.5);
  box-shadow:
    0 8px 32px rgba(0,0,0,0.09),
    0 2px 8px rgba(0,0,0,0.05),
    inset 0 1px 0 rgba(255,255,255,0.7);
}

/* Hover elevation effect on assessment cards */
.clinical-card:hover,
.clinical-question-card:hover {
  box-shadow: 0 6px 24px rgba(0,0,0,0.10), 0 2px 6px rgba(0,0,0,0.06);
  transform: translateY(-1px);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

/* Smooth animated score transition */
@keyframes s6h-count-up {
  from { opacity: 0; transform: scale(0.7); }
  to   { opacity: 1; transform: scale(1);   }
}

@keyframes s6h-slide-up {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0);     }
}

@keyframes s6h-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes s6h-pulse-ring {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.4); }
  50%       { box-shadow: 0 0 0 8px rgba(239,68,68,0); }
}

/* Emergency banner pulse (Phase 4) */
.s6h-emergency-banner {
  background: linear-gradient(135deg, #FEF2F2 0%, #FFF1F0 100%);
  border: 2px solid #FCA5A5;
  border-left: 6px solid #DC2626;
  border-radius: 1rem;
  padding: 1.25rem;
  margin-bottom: 1rem;
  animation: s6h-slide-up 0.25s ease both;
}

.s6h-emergency-banner--active {
  animation: s6h-slide-up 0.25s ease both, s6h-pulse-ring 2s ease-in-out infinite;
}

/* Responsive */
@media (max-width: 360px) {
  .severity-risk-grid { grid-template-columns: 1fr 1fr; }
  .severity-badge { min-width: 74px; min-height: 74px; }
  .severity-badge__score { font-size: 2rem; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .severity-risk-card,
  .confidence-card,
  .explain-card,
  .s6h-emergency-banner { animation: none !important; }
  .severity-badge__score { animation: none !important; }
  .confidence-row__bar   { transition: none !important; }
}
