/* Emergency AI Voice Assistant — MindCare Design System */

/* Design Tokens */
:root {
  --ev-bg:           var(--mc-bg, #F8FAFC);
  --ev-card:         var(--mc-surface, #FFFFFF);
  --ev-border:       var(--mc-border, #E2E8F0);
  --ev-border-focus: var(--mc-primary, #0F766E);

  --ev-teal:         var(--mc-primary, #0F766E);
  --ev-teal-dark:    var(--mc-primary-dark, #0F766E);
  --ev-teal-light:   var(--mc-primary-light, #F0FDFA);
  --ev-teal-dim:     rgba(13, 148, 136, 0.08);

  --ev-indigo:       var(--mc-info, #2563EB);
  --ev-indigo-dark:  var(--mc-info-dark, #1D4ED8);
  --ev-indigo-light: var(--mc-info-light, #EFF6FF);
  --ev-indigo-dim:   rgba(37, 99, 235, 0.08);

  --ev-text:         var(--mc-text-primary, #0F172A);
  --ev-text-sec:     var(--mc-text-secondary, #475569);
  --ev-text-muted:   var(--mc-text-muted, #64748B);
  --ev-text-dim:     #CBD5E1;

  --ev-red:          var(--mc-danger, #DC2626);
  --ev-red-dim:      var(--mc-danger-light, #FEF2F2);
  --ev-red-border:   var(--mc-danger-border, #FECACA);
  --ev-amber:        var(--mc-warning, #D97706);
  --ev-green:        var(--mc-success, #16A34A);

  --ev-shadow:       var(--mc-shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.06));
  --ev-shadow-hover: var(--mc-shadow-md, 0 4px 6px -1px rgba(0, 0, 0, 0.06));
  --ev-radius:       var(--mc-radius-md, 10px);
  --ev-radius-sm:    var(--mc-radius-sm, 6px);
  --ev-t:            0.15s ease;
}

/* Section Wrapper */
.ev-section {
  margin-top: 0;
  margin-bottom: 24px;
}

/* AI Panel Card */
.ev-panel {
  background: var(--ev-card);
  border: 1px solid var(--ev-border);
  border-radius: var(--ev-radius);
  overflow: hidden;
  box-shadow: var(--ev-shadow);
  transition: border-color var(--ev-t);
  position: relative;
  border-top: 3px solid var(--ev-teal);
}

.ev-panel.is-active {
  border-color: var(--ev-teal);
}

/* Panel Header */
.ev-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--ev-border);
}

.ev-header-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--ev-radius-sm);
  background: var(--ev-teal-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ev-teal-dark);
  font-size: 1rem;
  flex-shrink: 0;
}

.ev-header-text h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ev-text);
  margin: 0 0 2px;
  font-family: inherit;
}

.ev-header-text p {
  font-size: 0.77rem;
  color: var(--ev-text-muted);
  margin: 0;
}

.ev-privacy-badge {
  margin-left: auto;
  font-size: 0.68rem;
  background: var(--ev-teal-light);
  border: 1px solid var(--ev-teal);
  border-radius: var(--mc-radius-full, 9999px);
  padding: 3px 8px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--ev-teal-dark);
  font-weight: 600;
}

/* Intro Area */
.ev-intro {
  padding: 16px 18px;
}

.ev-intro-text {
  font-size: 0.85rem;
  color: var(--ev-text-sec);
  line-height: 1.5;
  margin-bottom: 12px;
  text-align: center;
}

.ev-intro-hints {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 6px;
}

.ev-intro-hint {
  font-size: 0.72rem;
  color: var(--ev-text-sec);
  background: var(--ev-teal-light);
  border: 1px solid var(--ev-border);
  border-radius: var(--mc-radius-full, 9999px);
  padding: 4px 10px;
  cursor: default;
}

/* Start Button */
.ev-start-bar {
  padding: 0 18px 18px;
}

.ev-start-btn {
  width: 100%;
  padding: 12px 18px;
  background: var(--ev-teal);
  border: 1px solid transparent;
  border-radius: var(--ev-radius-sm);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background var(--ev-t);
}

.ev-start-btn:hover:not(:disabled) {
  background: var(--ev-teal-dark);
}

.ev-start-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--ev-text-muted);
}

/* Session Panel */
.ev-session-panel {
  display: none;
  flex-direction: column;
  padding: 16px 18px;
  gap: 12px;
}

.ev-session-panel.is-active {
  display: flex;
}

/* Emotion / Risk Row */
.ev-emotion-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-height: 24px;
}

.ev-emotion-chip {
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: var(--mc-radius-full, 9999px);
  padding: 3px 10px;
  border: 1px solid var(--ev-border);
  background: var(--ev-card);
  text-transform: capitalize;
}

.chip-anxious    { color: #B45309; border-color: #FDE68A; background: #FFFBEB; }
.chip-sad        { color: #1D4ED8; border-color: #BFDBFE; background: #EFF6FF; }
.chip-calm       { color: #0F766E; border-color: #99F6E4; background: #F0FDFA; }
.chip-overwhelmed{ color: #B91C1C; border-color: #FECACA; background: #FEF2F2; }
.chip-hopeful    { color: #15803D; border-color: #BBF7D0; background: #F0FDF4; }
.chip-neutral    { color: var(--ev-text-sec); border-color: var(--ev-border); background: var(--ev-bg); }
.chip-hopeless   { color: #B91C1C; border-color: #FECACA; background: #FEF2F2; }
.chip-angry      { color: #B45309; border-color: #FDE68A; background: #FFFBEB; }

.ev-risk-label {
  font-size: 0.68rem;
  color: var(--ev-text-muted);
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
}

.ev-log-pill {
  font-size: 0.68rem;
  color: var(--ev-teal-dark);
  background: var(--ev-teal-light);
  border: 1px solid var(--ev-teal);
  border-radius: var(--mc-radius-full, 9999px);
  padding: 2px 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
}

/* Breathing Exercise */
.ev-breathing {
  background: var(--ev-teal-light);
  border: 1px solid var(--ev-teal);
  border-radius: var(--ev-radius-sm);
  padding: 16px;
  text-align: center;
  display: none;
}

.ev-breathing.is-active { display: block; }

.ev-breathing-circle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--ev-teal);
  color: #ffffff;
  margin: 0 auto 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.ev-breathing-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ev-text);
  margin-bottom: 4px;
}

.ev-breathing-instruction {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ev-teal-dark);
  margin-bottom: 2px;
}

.ev-breathing-count {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--ev-teal);
}

.ev-breathing-progress {
  height: 4px;
  background: var(--ev-border);
  border-radius: 2px;
  margin-top: 10px;
  overflow: hidden;
}

.ev-breathing-bar {
  height: 100%;
  background: var(--ev-teal);
  border-radius: 2px;
  transition: width 1s linear;
}

/* Crisis Panel */
.ev-crisis-panel {
  background: var(--ev-red-dim);
  border: 1px solid var(--ev-red-border);
  border-radius: var(--ev-radius-sm);
  padding: 14px;
  display: none;
}

.ev-crisis-panel.is-active { display: block; }

.ev-crisis-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}

.ev-crisis-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--mc-radius-sm, 6px);
  background: var(--ev-red-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ev-red);
  font-size: 0.85rem;
  flex-shrink: 0;
}

.ev-crisis-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ev-text);
  margin: 0 0 2px;
}

.ev-crisis-sub {
  font-size: 0.74rem;
  color: var(--ev-text-sec);
  margin: 0;
}

.ev-crisis-message {
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--ev-text-sec);
  margin-bottom: 10px;
}

.ev-crisis-contacts {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ev-crisis-call-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--ev-card);
  border: 1px solid var(--ev-border);
  border-radius: var(--ev-radius-sm);
  padding: 10px 12px;
  color: var(--ev-text);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 500;
  transition: background var(--ev-t);
}

.ev-crisis-call-btn:hover {
  background: var(--ev-red-dim);
  border-color: var(--ev-red-border);
}

.ev-crisis-call-btn i {
  color: var(--ev-red);
  font-size: 0.95rem;
  flex-shrink: 0;
}

.ev-crisis-call-name { font-weight: 600; color: var(--ev-text); }
.ev-crisis-call-num {
  color: var(--ev-text-muted);
  font-size: 0.75rem;
}

/* State Helpers */
.ev-hidden {
  display: none !important;
}

/* Conversation History */
.ev-history {
  display: none;
  padding: 12px 18px;
  border-top: 1px solid var(--ev-border);
  background: var(--ev-bg);
}

.ev-history.is-visible {
  display: block;
}

.ev-history-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--ev-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

#ev-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
}

/* Session Footer */
.ev-session-footer {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-top: 1px solid var(--ev-border);
  background: var(--ev-card);
}

.ev-session-footer.is-visible {
  display: flex;
}

.ev-duration {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ev-text-sec);
  font-variant-numeric: tabular-nums;
}

.ev-end-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--mc-radius-sm, 6px);
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.ev-end-btn:hover {
  background: #fee2e2;
  border-color: #f87171;
}
