/* The container tracks the composer width, including chats beside a sidebar. */
.chat-composer-form {
  display: flex;
  gap: 12px;
  container-type: inline-size;
  container-name: chat-composer;
  flex-wrap: wrap;
  width: 100%;
  --chat-composer-control-height: 46px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.chat-composer-form .chat-files-shortcut,
.chat-composer-form .chat-send,
.chat-composer-form .chat-inline-edit-action,
.chat-dictation-button {
  min-height: 46px;
  min-width: 46px;
}

.chat-composer-form__input { flex-basis: 0; }

.chat-dictation-button {
  align-items: center;
  justify-content: center;
  display: inline-flex;
  flex: 0 0 46px;
  height: 46px;
  border: 1px solid #a9c7eb !important;
  border-radius: 10px;
  background: #f1f7ff !important;
  color: #0759b7 !important;
  padding: 10px !important;
}

.chat-dictation-button.is-recording {
  color: #a71932 !important;
  background: #fff0f2 !important;
  border-color: #c54c61 !important;
}

.chat-composer-form button:focus-visible,
.chat-dictation-feedback summary:focus-visible,
.chat-composer-form textarea:focus-visible {
  outline: 2px solid #0970e6 !important;
  outline-offset: 3px;
}

.chat-dictation-button:disabled { opacity: .55; cursor: not-allowed; }

.chat-dictation-feedback {
  flex: 1 1 100%;
  min-width: 0;
  color: var(--secondary, #334155);
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.chat-composer-drafts {
  flex: 1 1 100%;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  font-size: 14px;
  color: var(--secondary, #334155);
}
.chat-composer-drafts select {
  flex: 1 1 180px;
  min-width: 0;
  min-height: 44px;
  max-width: 100%;
  background: var(--primary, #fff);
  color: inherit;
  border: 1px solid #a9c7eb;
  border-radius: 6px;
}
.darkmode .chat-composer-drafts { color: #e2e8f0; }
.chat-composer-drafts select:focus-visible { outline: 2px solid #0970e6; outline-offset: 2px; }

.chat-dictation-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  align-items: center;
}

.chat-dictation-status-row [role="status"] { flex: 1 1 180px; }
.chat-dictation-feedback button,
.chat-dictation-feedback summary {
  min-height: 44px;
  padding: 10px 4px;
  cursor: pointer;
}
.chat-dictation-feedback button { text-decoration: underline; color: inherit; }
.chat-dictation-feedback p { margin: 4px 0; white-space: pre-wrap; }
.chat-dictation-recovery p { max-height: 160px; overflow-y: auto; }
.chat-dictation-indicator {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #c62846;
  margin-right: 5px;
}

.darkmode .chat-dictation-button {
  color: #a9d1ff !important;
  background: #182c44 !important;
  border-color: #55779c !important;
}
.darkmode .chat-dictation-button.is-recording {
  color: #ffd4da !important;
  background: #552333 !important;
  border-color: #e58a9a !important;
}
.darkmode .chat-dictation-feedback { color: #e2e8f0; }
.darkmode .chat-dictation-indicator { background: #ff91a5; }

@container chat-composer (max-width: 599px) {
  .chat-composer-form__input { flex: 1 1 100%; order: -1; }
  .chat-composer-form .chat-input { font-size: 16px !important; }
  .chat-composer-form .chat-send { margin-left: auto; }
}

/* Fallback for older browsers without container queries. */
@media (max-width: 600px) {
  .chat-composer-form__input { flex: 1 1 100%; order: -1; }
  .chat-composer-form .chat-input { font-size: 16px !important; }
  .chat-composer-form .chat-send { margin-left: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .chat-composer-form *, .chat-composer-form *::before { animation: none !important; transition: none !important; }
}
