/*
 * SpeechGenie — Audio Preflight & Input-Level Meter overlay styles.
 * Scoped to sg-* ids/classes so nothing here can collide with Unity's
 * TemplateData/style.css. Rendered above the WebGL canvas.
 */

/* ── Level meter ─────────────────────────────────────────────────────────── */
.sg-meter {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(20, 18, 24, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  pointer-events: none; /* purely informational — never blocks the canvas */
  user-select: none;
  transition: opacity 0.25s ease;
}

.sg-meter__bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 22px;
}

.sg-meter__seg {
  width: 6px;
  height: 100%;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.14);
  transition: background-color 0.06s linear;
}

/* Green → amber → red gradient across the segment strip when lit. */
.sg-meter__seg.is-on { background: #43d17a; }
.sg-meter__seg:nth-child(n+10).is-on { background: #f2c14e; }
.sg-meter__seg:nth-child(n+13).is-on { background: #e5533d; }

.sg-meter__label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.82);
}

/* Inactive: greyed, no animation. */
.sg-meter--inactive { opacity: 0.55; }
.sg-meter--inactive .sg-meter__seg { background: rgba(255, 255, 255, 0.10); }
.sg-meter--inactive .sg-meter__label { color: rgba(255, 255, 255, 0.55); }

/* No signal: amber warning + gentle pulse to draw the eye. */
.sg-meter--nosignal .sg-meter__label { color: #f2c14e; }
.sg-meter--nosignal .sg-meter__bars { animation: sg-nosignal 1.1s ease-in-out infinite; }
@keyframes sg-nosignal {
  0%, 100% { opacity: 0.45; }
  50%      { opacity: 1; }
}

/* ── Preflight modal ─────────────────────────────────────────────────────── */
.sg-pf-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(12, 10, 16, 0.66);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  animation: sg-pf-in 0.2s ease;
}
.sg-pf-backdrop.sg-pf--closing { opacity: 0; transition: opacity 0.2s ease; }
@keyframes sg-pf-in { from { opacity: 0; } to { opacity: 1; } }

.sg-pf-card {
  width: 100%;
  max-width: 440px;
  box-sizing: border-box;
  padding: 28px 26px 22px;
  border-radius: 18px;
  background: #1c1a22;
  color: #f4f2f7;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  text-align: center;
}

.sg-pf-title {
  margin: 0 0 10px;
  font-size: 22px;
  font-weight: 700;
}
.sg-pf-intro {
  margin: 0 0 20px;
  font-size: 15px;
  line-height: 1.5;
  color: rgba(244, 242, 247, 0.78);
}

.sg-pf-btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  padding: 12px 20px;
  border-radius: 12px;
  transition: transform 0.06s ease, background-color 0.15s ease, opacity 0.15s ease;
}
.sg-pf-btn:active { transform: scale(0.97); }
.sg-pf-btn--primary { background: #6c5ce7; color: #fff; }
.sg-pf-btn--primary:hover { background: #5b4bd6; }
.sg-pf-btn--ghost {
  background: transparent;
  color: rgba(244, 242, 247, 0.85);
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.22);
}
.sg-pf-btn--ghost:hover { background: rgba(255, 255, 255, 0.06); }

.sg-pf-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* Confirm + troubleshooting blocks are revealed by JS via card state classes. */
.sg-pf-confirm { display: none; margin-top: 18px; }
.sg-pf--asked .sg-pf-confirm { display: block; }
.sg-pf--asked.sg-pf--trouble .sg-pf-confirm { display: none; }

.sg-pf-prompt { margin: 0 0 12px; font-size: 15px; font-weight: 600; }

.sg-pf-trouble { display: none; margin-top: 18px; text-align: left; }
.sg-pf--trouble .sg-pf-trouble { display: block; }
.sg-pf-trouble__title { margin: 0 0 10px; font-size: 15px; font-weight: 700; }
.sg-pf-trouble__list {
  margin: 0 0 18px;
  padding-left: 20px;
  font-size: 14px;
  line-height: 1.55;
  color: rgba(244, 242, 247, 0.82);
}
.sg-pf-trouble__list li { margin-bottom: 8px; }
.sg-pf-trouble .sg-pf-btn { display: block; width: 100%; }

.sg-pf-skip {
  display: block;
  margin: 18px auto 0;
  padding: 6px 8px;
  background: none;
  border: 0;
  cursor: pointer;
  font-size: 13px;
  color: rgba(244, 242, 247, 0.55);
  text-decoration: underline;
}
.sg-pf-skip:hover { color: rgba(244, 242, 247, 0.8); }
