/* Anfragen an den Betreiber (anfragen.html, Admin-Abschnitt in admin.html): Liste links, Verlauf als
   Sprechblasen rechts, Antwortfeld unten. Keine Inline-Styles (strikte CSP): Sichtbarkeit über das
   hidden-Attribut, Farben über die Variablen aus dashboard.css (mit Fallback). Der Inhaltsbereich
   scrollt selbst, weil .main overflow:hidden hat. */

.anf-content { display: flex; flex-direction: column; min-height: 0; overflow: hidden; padding-bottom: 0; }
.anf-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 20px;
  padding-bottom: 24px;
}

/* --- Liste --- */
.anf-liste {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface, #fff);
  border: 1px solid var(--border-light, #eef0f3);
  border-radius: var(--radius, 12px);
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(0,0,0,0.04));
  overflow: hidden;
}
.anf-liste-kopf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light, #eef0f3);
  font-size: 13px;
  color: var(--text-secondary, #6b7280);
}
.anf-liste-kopf select {
  padding: 6px 10px;
  border: 1px solid var(--border, #e2e5ea);
  border-radius: var(--radius-sm, 6px);
  background: var(--surface, #fff);
  color: var(--text-primary, #1a1d23);
  font-family: inherit;
  font-size: 13px;
}
.anf-liste-body { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; min-height: 0; }
.anf-eintrag {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border: none;
  border-bottom: 1px solid var(--border-light, #eef0f3);
  background: none;
  color: var(--text-primary, #1a1d23);
  font-family: inherit;
  cursor: pointer;
}
.anf-eintrag:hover { background: var(--surface-hover, #f0f2f5); }
.anf-eintrag.aktiv { background: var(--accent-light, #eff6ff); box-shadow: inset 3px 0 0 var(--accent, #2563eb); }
.anf-eintrag-zeile { display: flex; align-items: center; gap: 8px; min-width: 0; }
.anf-eintrag-betreff { flex: 1; min-width: 0; font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.anf-eintrag.ungelesen .anf-eintrag-betreff { color: var(--accent, #2563eb); }
.anf-punkt { width: 9px; height: 9px; border-radius: 50%; background: var(--accent, #2563eb); flex-shrink: 0; }
.anf-eintrag-meta { margin-top: 4px; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-tertiary, #9ca3af); flex-wrap: wrap; }
.anf-eintrag-vorschau { margin-top: 3px; font-size: 12.5px; color: var(--text-secondary, #6b7280); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Statusmarken (Liste, Kopf, Admin-Tabelle) */
.anf-status {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
  border: 1px solid var(--border, #e2e5ea);
  color: var(--text-secondary, #6b7280);
  background: var(--surface, #fff);
}
.anf-status-offen { background: var(--yellow-bg, #fffbeb); color: var(--yellow, #b45309); border-color: var(--yellow-border, #fde68a); }
.anf-status-beantwortet { background: var(--green-bg, #ecfdf5); color: var(--green, #047857); border-color: var(--green-border, #a7f3d0); }
.anf-status-geschlossen { background: var(--bg, #f7f8fa); color: var(--text-tertiary, #9ca3af); }

/* --- Verlauf --- */
.anf-verlauf {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface, #fff);
  border: 1px solid var(--border-light, #eef0f3);
  border-radius: var(--radius, 12px);
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(0,0,0,0.04));
  overflow: hidden;
}
.anf-leer { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px 20px; text-align: center; color: var(--text-tertiary, #9ca3af); font-size: 14px; }
.anf-detail { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.anf-detail-kopf {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-light, #eef0f3);
  flex-wrap: wrap;
}
.anf-detail-kopf h2 { flex: 1 1 220px; min-width: 0; font-size: 16px; font-weight: 600; margin: 0; overflow-wrap: anywhere; }
.anf-detail-meta { width: 100%; font-size: 12px; color: var(--text-tertiary, #9ca3af); display: flex; gap: 12px; flex-wrap: wrap; }
.anf-zurueck { display: none; }

.anf-blasen { flex: 1; min-height: 160px; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; background: var(--bg-secondary, #f9fafb); }
.anf-blase { max-width: 78%; display: flex; flex-direction: column; gap: 3px; }
.anf-blase-nutzer { align-self: flex-end; align-items: flex-end; }
.anf-blase-betreiber { align-self: flex-start; align-items: flex-start; }
.anf-blase-text {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border: 1px solid var(--border-light, #eef0f3);
  background: var(--surface, #fff);
  color: var(--text-primary, #1a1d23);
}
.anf-blase-nutzer .anf-blase-text { background: var(--accent, #2563eb); color: #fff; border-color: var(--accent, #2563eb); border-bottom-right-radius: 4px; }
.anf-blase-betreiber .anf-blase-text { border-bottom-left-radius: 4px; }
.anf-blase-meta { font-size: 11px; color: var(--text-tertiary, #9ca3af); padding: 0 4px; }
.anf-blase-meta strong { color: var(--text-secondary, #6b7280); font-weight: 600; }
.anf-hinweis-geschlossen {
  align-self: center;
  font-size: 12px;
  color: var(--text-secondary, #6b7280);
  background: var(--surface, #fff);
  border: 1px dashed var(--border, #e2e5ea);
  border-radius: 999px;
  padding: 4px 12px;
}

/* --- Antwortfeld --- */
.anf-antwort { border-top: 1px solid var(--border-light, #eef0f3); padding: 12px 18px 14px; display: flex; flex-direction: column; gap: 8px; }
.anf-antwort textarea {
  width: 100%;
  min-height: 72px;
  padding: 10px 12px;
  border: 1px solid var(--border, #e2e5ea);
  border-radius: var(--radius-sm, 6px);
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-primary, #1a1d23);
  background: var(--surface, #fff);
  resize: vertical;
  box-sizing: border-box;
}
.anf-antwort textarea:focus { outline: none; border-color: var(--accent, #2563eb); box-shadow: 0 0 0 3px var(--accent-light, #eff6ff); }
.anf-antwort-zeile { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.anf-zeichen { font-size: 12px; color: var(--text-tertiary, #9ca3af); }
.anf-antwort-knoepfe { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.anf-antwort-knoepfe select {
  padding: 7px 10px;
  border: 1px solid var(--border, #e2e5ea);
  border-radius: var(--radius-sm, 6px);
  background: var(--surface, #fff);
  color: var(--text-primary, #1a1d23);
  font-family: inherit;
  font-size: 13px;
}

/* --- Admin: Tabelle und Verlauf im Dialog --- */
.anf-admin-zeile { cursor: pointer; }
.anf-admin-zeile.ungelesen td:first-child { box-shadow: inset 3px 0 0 var(--accent, #2563eb); }
.anf-admin-konto { font-size: 12px; color: var(--text-secondary, #6b7280); display: block; }
.anf-admin-dialog { width: 720px; max-width: 95vw; }
.anf-admin-dialog .anf-blasen { max-height: 50vh; border-radius: var(--radius-sm, 6px); border: 1px solid var(--border-light, #eef0f3); }
.anf-admin-dialog .anf-antwort { padding: 12px 0 0; border-top: none; }
.anf-admin-kopfzeile { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; font-size: 13px; color: var(--text-secondary, #6b7280); }
.anf-admin-mehr { margin-top: 10px; text-align: center; }

/* --- Handy: Liste und Verlauf untereinander; nach Auswahl nur der Verlauf, zurück über den Knopf --- */
@media (max-width: 768px) {
  .anf-content { overflow-y: auto; }
  .anf-layout { grid-template-columns: 1fr; gap: 12px; padding-bottom: 16px; }
  .anf-liste { max-height: none; }
  .anf-liste-body { overflow: visible; }
  .anf-verlauf { min-height: 60vh; }
  .anf-layout.zeigt-verlauf .anf-liste { display: none; }
  .anf-layout:not(.zeigt-verlauf) .anf-verlauf { display: none; }
  .anf-zurueck { display: inline-flex; }
  .anf-blase { max-width: 92%; }
  .anf-blasen { padding: 12px; }
  .anf-admin-dialog .anf-blasen { max-height: 40vh; }
}

/* Hinweis für Admins (anfragen.html): eigene Anfragen statt der Kunden */
.anf-admin-hinweis {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 16px; padding: 10px 14px;
  background: var(--indigo-bg, #eef2ff); color: var(--text-primary, #1f2937);
  border: 1px solid var(--border, #e5e7eb); border-radius: var(--radius-sm, 8px);
  font-size: 13px;
}
.anf-admin-hinweis span { flex: 1 1 320px; }
.anf-admin-hinweis[hidden] { display: none; }

/* Angehängte Dateien in einer Sprechblase (anfragen.js, admin.js) */
.anf-anhang {
  display: inline-block; margin-top: 6px; padding: 4px 10px;
  border: 1px solid var(--border, #e5e7eb); border-radius: var(--radius-sm, 8px);
  background: var(--surface, #fff); color: var(--accent, #2563eb);
  font-size: 13px; cursor: pointer; text-align: left; max-width: 100%;
  overflow-wrap: anywhere;
}
.anf-anhang:hover { text-decoration: underline; }
.anf-antwort-zeile #anfDateiBtn { margin-left: auto; }

/* Mittlere Breiten (Laptop, geteiltes Fenster): schmalere Liste. Der Betreff hat eine Grundbreite
   (flex-basis oben) und rutscht sonst in eine eigene Zeile – vorher schrumpfte er auf einen
   Buchstaben je Zeile und drückte den Verlauf auf wenige Pixel zusammen (Durchlauf 10.11.2026). */
@media (min-width: 769px) and (max-width: 1200px) {
  .anf-layout { grid-template-columns: minmax(220px, 280px) minmax(0, 1fr); gap: 14px; }
}
