/* =============================================================================
   MicroMind — Components
   ========================================================================== */

/* ---- Cards ------------------------------------------------------------ */
.card {
  background: var(--bg-panel);
  border: 1px solid var(--line-dim);
  border-radius: var(--radius-md);
  padding: var(--sp-4);
  position: relative;
}
.card-label {
  font-family: var(--font-display);
  font-size: 11px; letter-spacing: 1.6px; text-transform: uppercase;
  color: var(--ink-dim); margin-bottom: var(--sp-3);
}
.sub-label { font-size: 12.5px; color: var(--ink-dim); margin-top: 2px; }
.value { font-family: var(--font-display); font-size: 26px; color: var(--neon); text-shadow: 0 0 10px rgba(0,255,65,0.3); }
.value-sm { font-family: var(--font-body); font-size: 17px; font-weight: 600; color: var(--ink); }
.micro-disclaimer { font-size: 11px; color: var(--ink-faint); margin-top: var(--sp-2); line-height: 1.4; }

.verdict-text { font-size: 15px; line-height: 1.6; color: var(--ink); }

.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
.stats-grid .card { min-width: 0; }

/* Signature element: the radar card gets the one deliberate visual lift. */
#card-radar {
  background: var(--bg-panel-raised);
  border-color: var(--line-bright);
  box-shadow: 0 0 24px rgba(0, 255, 65, 0.08), inset 0 0 30px rgba(0,255,65,0.03);
}

.row-between { display: flex; align-items: center; justify-content: space-between; margin-top: var(--sp-2); }
.row-inline { display: flex; align-items: center; gap: var(--sp-2); }
.row-buttons { display: flex; gap: var(--sp-2); margin-top: var(--sp-3); }

/* ---- Bars --------------------------------------------------------------- */
.bar-track {
  width: 100%; height: 6px; background: rgba(255,255,255,0.06);
  border-radius: 3px; overflow: hidden; margin: var(--sp-1) 0;
}
.bar-fill-h { height: 100%; width: 0%; background: var(--neon); border-radius: 3px; transition: width 0.35s ease; }

.emotion-bars { display: flex; flex-direction: column; gap: 7px; margin-top: var(--sp-2); }
.emo-row { display: grid; grid-template-columns: 64px 1fr 34px; align-items: center; gap: var(--sp-2); }
.emo-name { font-size: 12px; color: var(--ink-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.emo-pct { font-family: var(--font-mono); font-size: 11px; color: var(--ink-dim); text-align: right; }

/* ---- Pills ---------------------------------------------------------------- */
.pill {
  display: inline-block; font-size: 11px; padding: 3px 10px; border-radius: 20px;
  border: 1px solid var(--line-dim); color: var(--ink-dim); letter-spacing: 0.5px;
}
.pill-ok { border-color: rgba(0,255,65,0.35); color: var(--neon); }
.pill-warn { border-color: rgba(255,215,0,0.4); color: var(--amber); }
.pill-bad { border-color: rgba(255,62,62,0.4); color: var(--alert); }

/* ---- Radar / gauges / waveform / VA plot (SVG) --------------------------- */
.radar-wrap { display: flex; justify-content: center; }
.radar-wrap svg, .va-wrap svg { width: 100%; max-width: 260px; height: auto; }
.mm-radar-grid { fill: none; stroke: var(--line-dim); stroke-width: 1; }
.mm-radar-axis { stroke: var(--line-dim); stroke-width: 1; }
.mm-radar-fill { fill: rgba(0, 255, 65, 0.16); stroke: var(--neon); stroke-width: 1.6; transition: all 0.4s ease; }
.mm-radar-dot { fill: var(--neon); filter: drop-shadow(0 0 3px rgba(0,255,65,0.8)); }
.mm-radar-label { font-family: var(--font-body); font-size: 9.5px; fill: var(--ink-dim); }

.gauge-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-2); margin-top: var(--sp-4); }
.gauge-item { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.gauge-svg-wrap { position: relative; width: 100%; max-width: 66px; }
.gauge-svg-wrap svg { width: 100%; height: auto; }
.mm-gauge-track { stroke: rgba(255,255,255,0.07); }
.mm-gauge-progress { stroke: var(--neon); stroke-linecap: round; transition: stroke-dashoffset 0.4s ease; }
.gauge-num { font-family: var(--font-mono); font-size: 13px; color: var(--ink); margin-top: -38px; }
.gauge-label { font-size: 9.5px; color: var(--ink-dim); text-align: center; letter-spacing: 0.3px; }

.va-sub { text-align: center; margin-bottom: var(--sp-2); }
.va-wrap { display: flex; justify-content: center; position: relative; }
.mm-va-axis { stroke: var(--line-dim); stroke-width: 1; }
.mm-va-ring { stroke: var(--line-dim); stroke-width: 1; stroke-dasharray: 3 4; }
.mm-va-dot { fill: var(--cyan); filter: drop-shadow(0 0 5px rgba(0,210,255,0.85)); transition: cx 0.3s ease, cy 0.3s ease; }
.mm-va-trail-dot { fill: var(--cyan); }
.va-quadrant-labels { position: relative; font-size: 9.5px; color: var(--ink-faint); text-align: center; margin-top: var(--sp-2); }
.va-quadrant-labels span { display: inline-block; width: 48%; }

.wave-wrap { width: 100%; }
.wave-wrap svg { width: 100%; height: 64px; display: block; }
.mm-wave-mid { stroke: var(--line-dim); stroke-width: 1; }
.mm-wave-line { fill: none; stroke: var(--cyan); stroke-width: 1.6; filter: drop-shadow(0 0 3px rgba(0,210,255,0.5)); }

/* ---- Buttons -------------------------------------------------------------- */
.btn-primary, .btn-sm, .btn-ghost, .btn-danger, .btn {
  font-family: var(--font-body); font-weight: 600; font-size: 13px;
  border-radius: var(--radius-sm); cursor: pointer; letter-spacing: 0.3px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: all 0.2s ease; border: 1px solid transparent; padding: 9px 14px;
}
.btn-primary, .btn { background: var(--neon); color: #04140a; border-color: var(--neon); }
.btn-primary:hover, .btn:hover { box-shadow: var(--glow-neon); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
.btn-sm { background: transparent; color: var(--ink-dim); border-color: var(--line-dim); padding: 7px 12px; font-size: 12px; }
.btn-sm:hover { color: var(--neon); border-color: var(--neon); }
.btn-ghost { background: transparent; color: var(--ink-dim); border-color: var(--line-dim); }
.btn-danger { background: transparent; color: var(--alert); border-color: rgba(255,62,62,0.4); }
.btn-danger:hover { background: rgba(255,62,62,0.1); }
.btn-block { width: 100%; }
.cam-controls .btn-sm { flex: 1; }

/* ---- Micro-expression log -------------------------------------------------- */
.micro-log { display: flex; flex-direction: column; gap: 6px; max-height: 160px; overflow-y: auto; }
.micro-item { display: flex; align-items: center; gap: var(--sp-2); font-size: 12.5px; padding: 4px 0; border-bottom: 1px dashed var(--line-dim); }
.micro-item:last-child { border-bottom: none; }
.micro-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.micro-emo { flex: 1; color: var(--ink); }
.micro-time { font-family: var(--font-mono); color: var(--ink-faint); font-size: 11px; }
.empty-note { color: var(--ink-faint); font-size: 12.5px; font-style: italic; }

/* ---- AI panel --------------------------------------------------------------- */
.card-ai { border-color: rgba(0,210,255,0.22); }
.ai-content { min-height: 60px; margin: var(--sp-3) 0; font-size: 13.5px; line-height: 1.6; color: var(--ink); }
.ai-need-key { display: flex; flex-direction: column; gap: var(--sp-2); align-items: flex-start; color: var(--ink-dim); font-size: 13px; }
.ai-loading { display: flex; align-items: center; gap: var(--sp-2); color: var(--cyan); font-size: 13px; }
.ai-spinner {
  width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid rgba(0,210,255,0.25); border-top-color: var(--cyan);
  animation: mm-spin 0.8s linear infinite;
}
.ai-result { white-space: normal; }
.ai-caret { display: inline-block; width: 7px; height: 13px; background: var(--cyan); margin-left: 2px; animation: mm-blink 0.9s steps(1) infinite; vertical-align: text-bottom; }
.ai-timestamp { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-faint); margin-top: var(--sp-2); }
.ai-error { display: flex; align-items: center; gap: var(--sp-2); color: var(--alert); font-size: 13px; }
.ai-controls { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }

.toggle-label { display: flex; align-items: center; gap: var(--sp-2); font-size: 12.5px; color: var(--ink-dim); cursor: pointer; position: relative; }
.toggle-label input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-slider {
  width: 34px; height: 18px; background: rgba(255,255,255,0.1); border-radius: 20px; position: relative;
  transition: background 0.2s ease; flex-shrink: 0;
}
.toggle-slider::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--ink-dim); transition: transform 0.2s ease, background 0.2s ease;
}
.toggle-label input:checked + .toggle-slider { background: rgba(0,255,65,0.25); }
.toggle-label input:checked + .toggle-slider::after { transform: translateX(16px); background: var(--neon); }

/* =============================================================================
   MODALS
   ========================================================================== */
.mm-modal-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(2, 6, 4, 0.72); backdrop-filter: blur(3px);
  display: flex; align-items: flex-end; justify-content: center;
}
.mm-modal-box {
  background: var(--bg-modal); border: 1px solid var(--line-bright);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%; max-width: 520px; max-height: 88vh; overflow-y: auto;
  padding: var(--sp-5); box-shadow: 0 -10px 40px rgba(0,0,0,0.5);
}
@media (min-width: 560px) {
  .mm-modal-overlay { align-items: center; }
  .mm-modal-box { border-radius: var(--radius-lg); }
}
.mm-modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-4); }
.mm-modal-title { font-family: var(--font-display); font-size: 15px; letter-spacing: 1.5px; color: var(--neon); }

.consent-box .mm-modal-title { margin-bottom: var(--sp-3); }
.consent-intro { font-size: 13.5px; color: var(--ink-dim); line-height: 1.55; margin-bottom: var(--sp-4); }
.consent-point { display: flex; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.consent-icon { color: var(--neon); flex-shrink: 0; margin-top: 2px; }
.consent-point strong { font-size: 13.5px; color: var(--ink); }
.consent-point p { font-size: 12.5px; color: var(--ink-dim); margin: 3px 0 0; line-height: 1.5; }
.modal-actions { display: flex; gap: var(--sp-3); margin-top: var(--sp-5); }
.modal-actions-col { flex-direction: column; }

.settings-section { margin-bottom: var(--sp-5); padding-bottom: var(--sp-4); border-bottom: 1px solid var(--line-dim); }
.settings-section:last-child { border-bottom: none; margin-bottom: 0; }
.settings-section-title {
  display: flex; align-items: center; gap: 7px; font-family: var(--font-display);
  font-size: 11px; letter-spacing: 1.3px; text-transform: uppercase; color: var(--neon); margin-bottom: var(--sp-3);
}
.field-label { display: block; font-size: 12.5px; color: var(--ink-dim); margin-bottom: 6px; }
.text-input {
  width: 100%; background: rgba(255,255,255,0.03); border: 1px solid var(--line-dim);
  color: var(--ink); border-radius: var(--radius-sm); padding: 9px 11px; font-size: 13.5px;
  margin-bottom: var(--sp-2);
}
.text-input:focus, .icon-btn:focus-visible, .btn-primary:focus-visible { outline: 2px solid var(--neon); outline-offset: 1px; }
.field-help { font-size: 11.5px; color: var(--ink-faint); line-height: 1.5; margin: 2px 0 var(--sp-2); }
.field-link { font-size: 12px; display: inline-block; margin-bottom: var(--sp-3); }
.check-label { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-dim); margin-top: var(--sp-2); cursor: pointer; }

.lang-toggle { display: flex; gap: var(--sp-2); }
.lang-btn {
  flex: 1; padding: 9px; background: transparent; border: 1px solid var(--line-dim); color: var(--ink-dim);
  border-radius: var(--radius-sm); cursor: pointer; font-family: var(--font-body); font-weight: 600; font-size: 13px;
}
.lang-btn.active { border-color: var(--neon); color: var(--neon); background: rgba(0,255,65,0.08); }

.about-section .app-version { font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint); margin-top: var(--sp-2); }

/* =============================================================================
   TOASTS
   ========================================================================== */
#toast-root { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; width: min(90vw, 380px); }
.mm-toast {
  display: flex; align-items: center; gap: 8px; background: var(--bg-modal); border: 1px solid var(--line-bright);
  color: var(--ink); font-size: 13px; padding: 10px 14px; border-radius: var(--radius-md);
  opacity: 0; transform: translateY(-10px); transition: opacity 0.25s ease, transform 0.25s ease;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.mm-toast-in { opacity: 1; transform: translateY(0); }
.mm-toast-error { border-color: rgba(255,62,62,0.5); }
.mm-toast-error .mm-icon { color: var(--alert); }
.mm-toast-success .mm-icon { color: var(--neon); }
.mm-toast-info .mm-icon { color: var(--cyan); }
