/* ux-ultimate.css — Maximum UX Layer v1.0
   Quick Start · Optional Collapse · Post-Answer Actions · Predictive Chips
   ──────────────────────────────────────────────────────────────────────── */

/* ═══════════════════════════════════════
   QUICK START CARD (returning users)
   ═══════════════════════════════════════ */
.qs-card {
  background: var(--card);
  border: 1.5px solid rgba(61,90,254,.2);
  border-radius: var(--r2);
  padding: 14px 16px 10px;
  margin: 8px 0 12px;
  animation: fadeUp .3s ease;
  box-shadow: 0 2px 16px rgba(61,90,254,.1);
  position: relative;
}

.qs-inner {
  display: flex;
  align-items: center;
  gap: 12px;
}

.qs-avatar {
  font-size: 2rem;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--blue-l);
  border-radius: var(--r3);
  flex-shrink: 0;
}

.qs-info {
  flex: 1;
  min-width: 0;
}

.qs-greeting {
  font-size: 10px;
  font-weight: 700;
  color: var(--blue-text);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 2px;
}

.qs-name {
  font-size: var(--fs);
  font-weight: 700;
  color: var(--t1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.qs-job {
  font-size: var(--fs-sm);
  color: var(--ink-2);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.qs-btn {
  flex-shrink: 0;
  padding: 11px 20px !important;
  font-size: var(--fs-sm) !important;
  display: flex !important;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  font-weight: 700 !important;
}

.qs-edit-link {
  display: block;
  background: none;
  border: none;
  color: var(--ink-3);
  font-size: 12px;
  cursor: pointer;
  padding: 7px 0 0;
  text-align: center;
  width: 100%;
  font-family: var(--font);
  transition: color .15s;
}

.qs-edit-link:hover,
.qs-edit-link:focus-visible {
  color: var(--primary);
  outline: none;
}

/* ═══════════════════════════════════════
   OPTIONAL FIELDS COLLAPSE
   ═══════════════════════════════════════ */
.ofc-toggle {
  grid-column: 1 / -1;
  display: flex !important;
  align-items: center;
  gap: 8px;
  background: var(--card2) !important;
  border: 1px dashed rgba(61,90,254,.3) !important;
  border-radius: var(--r2) !important;
  color: var(--blue-text) !important;
  font-size: var(--fs-sm) !important;
  font-weight: 600 !important;
  padding: 10px 14px !important;
  cursor: pointer;
  width: 100%;
  justify-content: flex-start;
  transition: all .18s;
  margin-bottom: 4px;
  font-family: var(--font);
}

.ofc-toggle:hover {
  background: var(--blue-l) !important;
  border-color: rgba(61,90,254,.45) !important;
  transform: none;
}

.ofc-toggle:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.ofc-icon {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
  width: 18px;
  text-align: center;
  transition: transform .2s;
}

.ofc-toggle[aria-expanded="true"] .ofc-icon {
  transform: rotate(45deg);
}

/* ═══════════════════════════════════════
   POST-ANSWER QUICK ACTION PILLS
   ═══════════════════════════════════════ */
.quick-action-pills {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin: 6px 0 8px;
  animation: fadeUp .22s ease;
}

.qap-btn {
  flex: 1;
  min-width: 72px;
  padding: 10px 10px;
  border-radius: var(--r2);
  border: 1px solid var(--border-d);
  background: var(--card);
  color: var(--ink);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  line-height: 1;
}

.qap-btn:hover {
  background: var(--card2);
  border-color: var(--border);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}

.qap-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.qap-copy  { border-color: rgba(61,90,254,.18); }
.qap-speak { border-color: rgba(0,163,122,.18); }
.qap-retry { border-color: rgba(192,125,0,.18); }

.qap-next {
  background: linear-gradient(135deg, var(--blue), var(--purple)) !important;
  color: #fff !important;
  border-color: transparent !important;
  box-shadow: 0 3px 12px rgba(61,90,254,.3);
}

.qap-next:hover {
  opacity: .92;
  color: #fff !important;
  transform: translateY(-2px);
  box-shadow: 0 5px 18px rgba(61,90,254,.38);
}

/* ═══════════════════════════════════════
   PREDICTIVE QUESTION CHIPS
   ═══════════════════════════════════════ */
.suggest-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 10px 0 4px;
  align-items: flex-start;
}

.sc-header {
  width: 100%;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-3);
  letter-spacing: .5px;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sc-header::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.sc-chip {
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: var(--r5);
  padding: 7px 14px;
  font-size: var(--fs-sm);
  color: var(--ink-2);
  cursor: pointer;
  font-family: var(--font);
  font-weight: 500;
  transition: all .15s;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.sc-chip:hover {
  background: var(--blue-l);
  border-color: rgba(61,90,254,.3);
  color: var(--blue-text);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(61,90,254,.12);
}

.sc-chip:active {
  transform: none;
}

.sc-chip:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* Chip "show more" toggle */
.sc-more-btn {
  background: none;
  border: 1px dashed var(--border-d);
  border-radius: var(--r5);
  padding: 7px 14px;
  font-size: var(--fs-sm);
  color: var(--ink-3);
  cursor: pointer;
  font-family: var(--font);
  transition: all .15s;
}

.sc-more-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* ═══════════════════════════════════════
   WELCOME BACK TOAST STYLE
   ═══════════════════════════════════════ */
.toast-welcome {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ═══════════════════════════════════════
   RESPONSIVE — narrow screens
   ═══════════════════════════════════════ */
@media (max-width: 380px) {
  .qs-inner { gap: 8px; }
  .qs-btn { padding: 9px 13px !important; }
  .qap-btn { font-size: 12px; padding: 9px 8px; }
  .sc-chip { font-size: 12px; padding: 6px 11px; }
}

/* ═══════════════════════════════════════
   RTL/LTR mirroring
   ═══════════════════════════════════════ */
body.lang-en .qs-name,
body.lang-en .qs-job {
  max-width: 200px;
}

/* ══════════════════════════════════════════════════════════════
   WAVE 2 ADDITIONS
   ══════════════════════════════════════════════════════════════ */

/* ── Simulator Smart Badge ───────────────────────────────────── */
.sim-smart-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--blue-text);
  background: var(--blue-l);
  border: 1px solid rgba(61,90,254,.2);
  border-radius: var(--r5);
  padding: 3px 10px;
  margin-bottom: 8px;
  letter-spacing: .3px;
  animation: fadeUp .25s ease;
}

/* ── Answer Skeleton Loading ─────────────────────────────────── */
.answer-skeleton {
  padding: 8px 4px 6px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.sk-line {
  height: 13px;
  border-radius: 6px;
  background: linear-gradient(
    90deg,
    var(--card2) 25%,
    var(--border) 50%,
    var(--card2) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* When generating, dim the placeholder text */
#abox:has(.answer-skeleton) .atxt.ph {
  opacity: 0;
  pointer-events: none;
}

/* ── Smart Tone Recommendation Badge ────────────────────────── */
.tone-rec-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  color: var(--blue-text);
  background: var(--blue-l);
  border: 1px solid rgba(61,90,254,.2);
  border-radius: var(--r5);
  padding: 1px 7px;
  margin-top: 5px;
  white-space: nowrap;
  letter-spacing: .2px;
  animation: fadeIn .2s ease;
}

/* Pulse the recommended tone button */
.tone-btn:has(.tone-rec-badge) {
  border-color: rgba(61,90,254,.4) !important;
  background: var(--blue-l) !important;
}

/* ── Focus Mode Keyboard Hint ────────────────────────────────── */
.focus-kbd-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 3px;
  background: var(--border-d);
  color: var(--ink-3);
  font-size: 10px;
  font-weight: 700;
  margin-inline-start: 4px;
  vertical-align: middle;
  border: 1px solid var(--border);
  line-height: 1;
  font-family: monospace;
}

/* ── Reduced-motion: disable skeleton animation ──────────────── */
@media (prefers-reduced-motion: reduce) {
  .sk-line { animation: none; background: var(--border); }
  .sim-smart-badge, .tone-rec-badge { animation: none; }
}

/* ── :has() polyfill fallback (older browsers) ───────────────── */
@supports not selector(:has(*)) {
  #abox .atxt.ph { opacity: 1; }
}

/* ══════════════════════════════════════════════════════════════
   WAVE 3 ADDITIONS
   ══════════════════════════════════════════════════════════════ */

/* ── Setup Hero Toggle (returning users) ────────────────────── */
.setup-hero-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px dashed var(--border-d);
  border-radius: var(--r5);
  color: var(--ink-3);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 14px;
  cursor: pointer;
  margin-bottom: 12px;
  transition: all .15s;
  letter-spacing: .3px;
}

.setup-hero-toggle:hover {
  color: var(--primary);
  border-color: rgba(61,90,254,.35);
  background: var(--blue-l);
}

/* ── Answer Variants Bar ─────────────────────────────────────── */
.answer-variants {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 6px 0 2px;
  animation: fadeUp .2s ease;
}

.av-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-3);
  white-space: nowrap;
  flex-shrink: 0;
}

.av-btn {
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: var(--r5);
  padding: 5px 13px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  font-family: var(--font);
  transition: all .14s;
  white-space: nowrap;
  line-height: 1.3;
}

.av-btn:hover {
  background: var(--blue-l);
  border-color: rgba(61,90,254,.3);
  color: var(--blue-text);
  transform: translateY(-1px);
}

.av-btn:active { transform: none; }

/* ── Mic Attention Pulse ─────────────────────────────────────── */
@keyframes micPulse {
  0%   { box-shadow: 0 0 0 0   rgba(61,90,254,.5); transform: scale(1); }
  50%  { box-shadow: 0 0 0 14px rgba(61,90,254,0); transform: scale(1.06); }
  100% { box-shadow: 0 0 0 0   rgba(61,90,254,.5); transform: scale(1); }
}

.mic-attention {
  animation: micPulse .85s ease-in-out 6 !important;
}

/* ── Wake Lock Active Indicator (subtle) ─────────────────────── */
body.wakelock-active #liveBadge::after {
  content: ' 🔆';
  font-size: 10px;
  opacity: .7;
}

/* ── Reduced motion overrides ────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .mic-attention { animation: none !important; }
  .av-btn:hover  { transform: none; }
}

/* ══════════════════════════════════════════════════════════════
   WAVE 4 ADDITIONS
   ══════════════════════════════════════════════════════════════ */

/* ── Profile Completeness Bar ────────────────────────────────── */
.profile-completeness {
  margin: 10px 0 16px;
  padding: 10px 14px 8px;
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  animation: fadeIn .25s ease;
}

.pc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 7px;
}

.pc-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
}

.pc-pct {
  font-size: 13px;
  font-weight: 800;
  transition: color .3s;
}

.pc-track {
  height: 7px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 7px;
}

.pc-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--blue);
  transition: width .4s cubic-bezier(.34,1.56,.64,1), background .3s;
  min-width: 0;
}

.pc-hint {
  font-size: 11px;
  color: var(--ink-3);
  transition: color .25s;
  min-height: 14px;
}

/* ── Session Mini-Stats Float ────────────────────────────────── */
.session-mini-stats {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--card);
  border: 1px solid var(--border-d);
  border-radius: var(--r5);
  padding: 8px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  box-shadow: 0 4px 24px rgba(0,0,0,.14);
  cursor: pointer;
  z-index: 800;
  animation: fadeUp .3s ease;
  transition: opacity .15s, transform .15s;
  white-space: nowrap;
  user-select: none;
}

.session-mini-stats:hover {
  opacity: .88;
  transform: translateX(-50%) translateY(-2px);
}

.sms-sep {
  color: var(--border-d);
  font-weight: 300;
  font-size: 16px;
}

/* Lift stats above mobile bottom nav when both are visible */
body.has-mobile-nav .session-mini-stats {
  bottom: 80px;
}

/* ── Copy Q+A Button (full-width inside pills) ───────────────── */
.qap-copy-qa {
  flex-basis: 100% !important;
  border-color: rgba(0,163,122,.2) !important;
  font-size: 12px !important;
  padding: 9px 12px !important;
  margin-top: 2px;
}

.qap-copy-qa:hover {
  background: rgba(0,163,122,.08) !important;
  border-color: rgba(0,163,122,.35) !important;
  color: var(--green) !important;
}

/* ── Mobile Bottom Navigation ────────────────────────────────── */
.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  inset-inline-start: 0;
  inset-inline-end: 0;
  height: 60px;
  background: var(--card);
  border-top: 1px solid var(--border-d);
  display: flex;
  align-items: stretch;
  z-index: 1000;
  box-shadow: 0 -3px 16px rgba(0,0,0,.10);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.mbn-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: none;
  border: none;
  color: var(--ink-3);
  font-family: var(--font);
  cursor: pointer;
  transition: color .15s;
  padding: 6px 4px;
  position: relative;
}

.mbn-tab::after {
  content: '';
  position: absolute;
  top: 0;
  left: 20%;
  right: 20%;
  height: 2px;
  background: var(--primary);
  border-radius: 0 0 2px 2px;
  transform: scaleX(0);
  transition: transform .2s ease;
}

.mbn-tab.active {
  color: var(--primary);
}

.mbn-tab.active::after {
  transform: scaleX(1);
}

.mbn-tab.active .mbn-icon {
  transform: scale(1.18);
}

.mbn-icon {
  font-size: 1.35rem;
  display: block;
  transition: transform .2s var(--easing-spring, cubic-bezier(.34,1.56,.64,1));
  line-height: 1;
}

.mbn-label {
  font-size: 10px;
  font-weight: 700;
  display: block;
  letter-spacing: .3px;
}

/* Push content above nav when active */
body.has-mobile-nav #main-app {
  padding-bottom: 68px;
}

/* Hide the top mode-tabs on mobile when bottom nav is active */
@media (max-width: 640px) {
  body.has-mobile-nav .mode-tabs {
    display: none;
  }
}

/* ── Quick Tip Box ───────────────────────────────────────────── */
.quick-tip-box {
  background: linear-gradient(135deg, var(--amber-l, rgba(192,125,0,.08)), var(--blue-l));
  border: 1px solid rgba(192,125,0,.22);
  border-radius: var(--r2);
  padding: 9px 14px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink-2);
  margin: 6px 0;
  line-height: 1.55;
  animation: fadeUp .2s ease;
}

/* ── Auto-Save Indicator (subtle flash on field input) ──────── */
@keyframes savePulse {
  0%   { border-color: rgba(0,163,122,.6); }
  100% { border-color: transparent; }
}

.field-saved {
  animation: savePulse .6s ease forwards;
}

/* ── Wave 4 reduced-motion ───────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .pc-fill         { transition: none; }
  .session-mini-stats { animation: none; }
  .quick-tip-box   { animation: none; }
  .mbn-tab::after  { transition: none; }
}
