/* Aurum Trades — Chat-Input Overlay v2 — Super-aggressive Variante
 * Problem: Input-Felder explodieren horizontal über den Viewport hinaus.
 * Fix: erzwinge auf ALLEN Inputs/Forms sinnvolle max-widths.
 */

/* === Global Safety: kein Element darf horizontal über die Viewport-Breite hinauswachsen === */
html, body {
  overflow-x: hidden !important;
  max-width: 100vw;
}

/* === Alle Forms mit flex-Layout: niemals breiter als Container === */
form {
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box;
}

form > * {
  min-width: 0 !important;
  max-width: 100%;
}

/* === Alle Inputs: niemals breiter als ihr Container === */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input:not([type]),
input[type="tel"],
input[type="url"],
textarea {
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
}

/* === Spezifisch Chat-DM-Input: füllt Container vollständig, scrollt intern === */
input[data-testid="input-dm"],
input[data-testid*="message-input"],
input[data-testid*="chat-input"],
input[data-testid*="comment-input"],
form input[placeholder*="Nachricht"],
form input[placeholder*="achricht"],
form input[placeholder*="Schreibe"],
form input[placeholder*="Kommentar"] {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  flex: 1 1 0% !important;
  box-sizing: border-box !important;
}

/* === Alle Container die in Chat-Forms direkte Eltern sind: nicht expandieren === */
form.flex,
form[class*="flex"] {
  width: 100%;
  max-width: 100% !important;
  min-width: 0 !important;
  flex-wrap: nowrap;
  overflow: hidden;
}

/* Alle direkten Kind-Elemente einer Chat-Form */
form.flex > div,
form.flex > input,
form.flex > textarea,
form[class*="flex"] > div,
form[class*="flex"] > input,
form[class*="flex"] > textarea {
  min-width: 0 !important;
}

/* === Textareas: auto-grow nach oben statt nach unten === */
textarea {
  resize: none;
  overflow-y: auto;
  max-height: 160px;
  width: 100% !important;
}

/* === Mobile: iOS-Zoom verhindern === */
@media (max-width: 768px) {
  input[type="text"],
  input[data-testid*="input"],
  input[data-testid*="message"],
  textarea {
    font-size: 16px !important;
  }
}

/* === Notbremse für die DM-Seite (z.B. fixed Bottom-Bar): === */
[class*="border-t"][class*="border-border"] form,
[class*="border-t"] form[class*="flex"] {
  width: 100% !important;
  max-width: 100% !important;
}

/* Wrapper-DIV um das Input (falls in flex-1-Wrapper steht) */
form .flex-1,
form [class*="flex-1"] {
  min-width: 0 !important;
  max-width: 100%;
}
