/* lib/v1/ai-composer.css — Optik der KI-Eingabe im Thingware Corporate Design.
   Die Library setzt Bootstrap-Klassen voraus, wo vorhanden, bringt aber alles
   Eigene selbst mit. Farb-Tokens werden mit Rueckfallwerten benutzt, damit sie
   auch ohne tokens.css stimmen. */

.twai-composer {
  background: var(--tw-content-bg, #f4f6fb);
  border: 1px solid rgba(0, 0, 0, .07);
  border-radius: var(--tw-card-radius, .6rem);
  padding: .9rem 1rem 1rem;
}

.twai-header {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: .75rem; flex-wrap: wrap; margin-bottom: .5rem;
}
.twai-left { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.twai-panel { text-align: right; }

.twai-panel-title {
  font-size: .78rem;
  color: var(--tw-neutral, #6c757d);
  margin-bottom: .2rem;
}
.twai-langs .twai-lang-btn { min-width: 2.6rem; font-weight: 600; }

/* Das Feld hebt sich vom Rahmen ab. App-eigene Zustandsfarben (z. B. „interne Notiz")
   gewinnen, weil die App ihr Stylesheet nach diesem laedt. */
.twai-composer > textarea,
.twai-composer > input,
.twai-composer > [contenteditable] { background: var(--tw-surface, #fff); }

.twai-composer > [contenteditable] { min-height: 6rem; overflow-y: auto; }

.twai-footer {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: .75rem; margin-top: .25rem;
}
.twai-hint {
  font-size: .78rem; color: var(--tw-neutral, #6c757d);
  max-width: 46rem; line-height: 1.35;
}
.twai-hint .fa-wand-magic-sparkles { color: var(--tw-accent, #6ea8fe); }
.twai-counter { font-size: .78rem; color: var(--tw-neutral, #6c757d); flex-shrink: 0; }
.twai-counter.over { color: var(--tw-danger, #dc3545); font-weight: 600; }

/* ── Diktat ─────────────────────────────────────────────────────────── */
.twai-mic.twai-recording {
  color: #fff;
  background: var(--tw-danger, #dc3545);
  border-color: var(--tw-danger, #dc3545);
  animation: twai-pulse 1.2s ease-in-out infinite;
}
.twai-fix.active {
  color: #fff;
  background: var(--tw-accent, #6ea8fe);
  border-color: var(--tw-accent, #6ea8fe);
}
@keyframes twai-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, .5); }
  50%      { box-shadow: 0 0 0 .35rem rgba(220, 53, 69, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .twai-mic.twai-recording { animation: none; }
}

/* Ladeanzeige im Sprachknopf */
.twai-spin {
  display: inline-block; width: .85rem; height: .85rem;
  border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: twai-rot .7s linear infinite; vertical-align: -2px;
}
@keyframes twai-rot { to { transform: rotate(360deg); } }

/* ── Vorschlags-Modal (ohne Bootstrap-JS) ───────────────────────────── */
.twai-modal { position: fixed; inset: 0; z-index: 1080; display: flex;
  align-items: center; justify-content: center; padding: 1rem; }
.twai-modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .5); }
.twai-modal-dialog {
  position: relative; background: var(--tw-surface, #fff);
  border-radius: var(--tw-card-radius, .6rem);
  box-shadow: 0 1rem 3rem rgba(0, 0, 0, .3);
  width: min(48rem, 100%); max-height: 90vh; display: flex; flex-direction: column;
}
.twai-modal-header, .twai-modal-footer {
  display: flex; align-items: center; padding: .9rem 1rem;
}
.twai-modal-header { justify-content: space-between; border-bottom: 1px solid rgba(0,0,0,.1); }
.twai-modal-header h5 { margin: 0; font-size: 1.05rem; }
.twai-modal-footer { justify-content: flex-end; gap: .5rem; border-top: 1px solid rgba(0,0,0,.1); }
.twai-modal-body { padding: 1rem; overflow-y: auto; }
.twai-rich { min-height: 12rem; overflow-y: auto; }
.twai-original { white-space: pre-wrap; }
.twai-busy { cursor: progress; }
