/* ============================================================
   The Tech Pad — AI-assisted messaging (inbox overlay)
   Companion stylesheet for ai-assistant-ui.js. Matches the
   bundle's design system: green #087552, mint #badfce,
   borders #dfe7e3, white header/composer surfaces.
   ============================================================ */

/* ---------- AI mode selector (chat header) ---------- */
.ai-mode-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 2px;
}

.ai-mode-caption {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: #6b7a74;
  text-transform: uppercase;
}

.ai-segmented {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  background: #fff;
  border: 1px solid #badfce;
  border-radius: 9px;
}

.ai-segmented button {
  border: 0;
  background: transparent;
  color: #087552;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  padding: 5px 9px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.ai-segmented button:hover:not(.active) {
  background: #eefaf4;
}

.ai-segmented button.active {
  background: #087552;
  color: #fff;
}

.ai-mode-wrap[data-disabled="true"] .ai-segmented button {
  opacity: 0.5;
  cursor: not-allowed;
}

.ai-mode-badge {
  font-size: 11px;
  font-weight: 800;
  color: #0b5f40;
  background: #e2f5ec;
  border: 1px solid #badfce;
  border-radius: 999px;
  padding: 3px 9px;
  white-space: nowrap;
  animation: aiPulse 2s ease-in-out infinite;
}

@keyframes aiPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* ---------- AI action bar (above composer) ---------- */
.ai-action-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 12px;
  background: #f7faf8;
  border-bottom: 1px solid #e6eeea;
}

.ai-action-bar:has(.ai-btn[aria-busy="true"]) {
  animation: aiBarBusy 1.6s ease-in-out infinite;
}

@keyframes aiBarBusy {
  0%, 100% { background: #f7faf8; }
  50% { background: #eef6f1; }
}

.ai-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #badfce;
  background: #fff;
  color: #087552;
  border-radius: 9px;
  padding: 7px 12px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
}

.ai-btn:hover:not(:disabled) {
  background: #eefaf4;
}

.ai-btn:active:not(:disabled) {
  transform: translateY(1px);
}

.ai-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ai-spinner {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  border: 2px solid #cfe9dd;
  border-top-color: #087552;
  border-radius: 50%;
  animation: aiSpin 0.7s linear infinite;
}

@keyframes aiSpin {
  to { transform: rotate(360deg); }
}

.ai-bar-hint {
  margin-left: auto;
  font-size: 11px;
  color: #7d8a85;
  text-align: right;
}

.ai-bar-status {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
}

.ai-bar-status.ok { color: #087552; }
.ai-bar-status.error { color: #b3261e; }

.ai-status-action {
  border: 1px solid #badfce;
  background: #fff;
  color: #087552;
  border-radius: 7px;
  padding: 2px 8px;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  margin-left: 6px;
  cursor: pointer;
}

.ai-status-action:hover {
  background: #eefaf4;
}

/* ---------- mobile ---------- */
@media (max-width: 760px) {
  .ai-mode-caption {
    display: none;
  }

  .ai-segmented button {
    font-size: 11px;
    padding: 5px 7px;
  }

  .ai-action-bar {
    padding: 7px 10px;
    gap: 6px;
  }

  .ai-btn {
    flex: 1 1 auto;
    justify-content: center;
    font-size: 12px;
    padding: 7px 8px;
  }

  .ai-bar-hint {
    display: none;
  }
}
