/* ─────────────────────────────────────────────────────────────────
   css/ai-conversation-mode.css

   Phase 3.1 (2026-05-24) — AI Conversation Mode UI.

   Class namespace .aicm-* (intentionally different from
   .ai-mode-* used by the older ai-mode-toggle feature, which lives
   alongside this).

   Floating mic button: top-right of viewport, fixed, large 56px
   tap target (well above the 44px WCAG floor — Luke's users have
   motor impairments and the mic is the most-tapped affordance).

   Overlay: full-viewport backdrop + centered panel with the
   "they said:" line + grid of tappable suggestion pills + Save/Dismiss
   actions.

   States are mirrored as classes on the mic button:
     .aicm-state-idle        — neutral
     .aicm-state-listening   — pulse animation, red mic
     .aicm-state-thinking    — spinner, amber
     .aicm-state-suggesting  — green (briefly, until overlay closes)

   LABEL: PILOT-READY. Visual styling only. Needs iOS Safari +
   Android Chrome verification of the fixed-position mic on
   small viewports before PRODUCTION-READY.
───────────────────────────────────────────────────────────────── */

/* Screen-reader-only utility (reused inside the mic button). */
.aicm-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Floating mic button ────────────────────────────────── */
.aicm-mic-button {
  position: fixed;
  top: 80px;
  right: 16px;
  z-index: 9000;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: #1A1A2E;
  color: #FFF;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  transition: background 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease;
  /* Floor below the WCAG 44dp minimum is impossible at 56px, but
     the explicit min-* keeps the rule auditable. */
  min-width: 44px;
  min-height: 44px;
}
.aicm-mic-button:hover {
  background: #2A2A4E;
  transform: translateY(-1px);
}
.aicm-mic-button:focus-visible {
  outline: 3px solid #E8A838;
  outline-offset: 2px;
}
.aicm-mic-icon {
  font-size: 1.4rem;
  line-height: 1;
  pointer-events: none;
}

/* State styling. */
.aicm-mic-button.aicm-state-idle {
  background: #1A1A2E;
}
.aicm-mic-button.aicm-state-listening {
  background: #D24545;
  animation: aicm-mic-pulse 1.2s ease-in-out infinite;
}
.aicm-mic-button.aicm-state-thinking {
  background: #E8A838;
  animation: aicm-spin 1s linear infinite;
}
.aicm-mic-button.aicm-state-suggesting {
  background: #2E8B57;
}

@keyframes aicm-mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(210, 69, 69, 0.55); }
  50%      { box-shadow: 0 0 0 12px rgba(210, 69, 69, 0); }
}
@keyframes aicm-spin {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ── Suggestion overlay ─────────────────────────────────── */
.aicm-overlay {
  position: fixed;
  inset: 0;
  z-index: 9100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  padding: 16px;
}
.aicm-panel {
  background: #FFF;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  width: min(560px, 100%);
  max-height: 80vh;
  overflow-y: auto;
  padding: 18px 18px 14px;
  position: relative;
}

.aicm-header {
  margin-bottom: 14px;
  padding-right: 32px;     /* room for close button */
}
.aicm-heard-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(0, 0, 0, 0.55);
  margin-bottom: 4px;
}
.aicm-heard-text {
  font-size: 1.05rem;
  font-weight: 500;
  color: #1A1A2E;
  line-height: 1.35;
  word-wrap: break-word;
}
.aicm-close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: rgba(0, 0, 0, 0.55);
  font-size: 1rem;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.aicm-close-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: #1A1A2E;
}

.aicm-suggestion-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.aicm-suggestion-pill {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  padding: 12px 14px;
  background: #F4F4F8;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-left: 4px solid rgba(0, 0, 0, 0.18);
  border-radius: 12px;
  color: #1A1A2E;
  font-size: 0.95rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  /* WCAG 44dp tap-target floor — this is a primary action surface. */
  min-height: 56px;
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}
.aicm-suggestion-pill:hover {
  background: #ECECF2;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}
.aicm-suggestion-pill:focus-visible {
  outline: 3px solid #E8A838;
  outline-offset: 2px;
}
.aicm-suggestion-emoji {
  font-size: 1.25rem;
  line-height: 1;
  flex-shrink: 0;
}
.aicm-suggestion-label {
  flex: 1;
  word-wrap: break-word;
}

/* ── Action row ─────────────────────────────────────────── */
.aicm-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  padding-top: 12px;
}
.aicm-action-btn {
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: #FFF;
  color: #1A1A2E;
  transition: background 0.15s ease;
}
.aicm-action-btn:hover {
  background: #F4F4F8;
}
.aicm-save-btn {
  background: #2E8B57;
  color: #FFF;
  border-color: #2E8B57;
}
.aicm-save-btn:hover {
  background: #267347;
}

/* ── Phone tweaks ───────────────────────────────────────── */
@media (max-width: 480px) {
  .aicm-mic-button {
    top: auto;
    bottom: 88px;          /* clears typical mobile bottom-nav */
    right: 12px;
    width: 60px;
    height: 60px;
  }
  .aicm-panel { padding: 14px 14px 10px; }
  .aicm-suggestion-grid { grid-template-columns: 1fr; }
}

/* ── Honour user motion preferences ─────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .aicm-mic-button.aicm-state-listening,
  .aicm-mic-button.aicm-state-thinking {
    animation: none;
  }
  .aicm-suggestion-pill { transition: none; }
}
