/* GEIST Modal-Komponente — app-weit.
 *
 * Tom-Verankerung 2026-06-25 (Pop-up-Verbot):
 *   Ersetzt window.confirm/.alert/.prompt durch In-Page-Overlay in
 *   Royalblau-CI. Kombiniert mit buttons.css (.btn .btn-primary etc.).
 *
 * Lade-Reihenfolge in base.html:
 *   buttons.css -> modal.css -> app.css (so kann app.css ueberschreiben)
 *
 * Selektoren-Prefix `.geist-modal-` ist eindeutig (kein Konflikt mit
 * App-eigenen .modal-Overlay-Patterns).
 */

/* Farbquelle teilt sich buttons.css :root --geist-blue etc. */

/* ─── Backdrop ─── */
.geist-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 30, 50, 0.55);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  transition: opacity 0.18s ease;
}
.geist-modal-backdrop.geist-modal-visible {
  opacity: 1;
}

/* Wenn mehrere Modals stapeln, jedes naechste etwas hoeher */
.geist-modal-backdrop + .geist-modal-backdrop { z-index: 10010; }
.geist-modal-backdrop + .geist-modal-backdrop + .geist-modal-backdrop { z-index: 10020; }

/* ─── Card ─── */
.geist-modal-card {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25), 0 2px 6px rgba(0, 0, 0, 0.12);
  border: 1px solid var(--geist-line, #d1d5db);
  max-width: 480px;
  width: 100%;
  padding: 22px 24px 18px 24px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--geist-ink, #1a1a1a);
  transform: translateY(-12px);
  transition: transform 0.18s ease;
  outline: none;
}
.geist-modal-backdrop.geist-modal-visible .geist-modal-card {
  transform: translateY(0);
}

/* ─── Title ─── */
.geist-modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--geist-blue-d, #2B61A1);
  margin: 0 0 10px 0;
  line-height: 1.3;
}

/* ─── Message ─── */
.geist-modal-msg {
  font-size: 14px;
  line-height: 1.5;
  color: var(--geist-ink, #1a1a1a);
  white-space: pre-line; /* \n im message-Text wird Zeilenumbruch */
  margin: 0 0 16px 0;
  word-wrap: break-word;
}

/* ─── Prompt-Input ─── */
.geist-modal-input {
  display: block;
  width: 100%;
  padding: 7px 10px;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid var(--geist-line, #d1d5db);
  border-radius: 4px;
  margin: 0 0 14px 0;
  box-sizing: border-box;
  background: #fff;
  color: var(--geist-ink, #1a1a1a);
  -webkit-appearance: none;
  appearance: none;
}
.geist-modal-input:focus {
  outline: none;
  border-color: var(--geist-blue, #2B61A1);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.20);
}

/* ─── Actions ─── */
.geist-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}
.geist-modal-actions .btn {
  min-width: 90px;
}

/* ─── Toast-Container (geistHinweis) ─── */
#geist-toast-container {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 11000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.geist-toast {
  pointer-events: auto;
  background: #fff;
  border: 1px solid var(--geist-line, #d1d5db);
  border-left: 4px solid var(--geist-blue, #2B61A1);
  border-radius: 6px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
  padding: 9px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--geist-ink, #1a1a1a);
  max-width: 520px;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.20s ease, transform 0.20s ease;
}
.geist-toast.geist-toast-visible { opacity: 1; transform: translateY(0); }
.geist-toast.geist-toast-out     { opacity: 0; transform: translateY(-6px); }

.geist-toast-success { border-left-color: var(--geist-green, #2a7a3b); }
.geist-toast-warn    { border-left-color: var(--geist-orange, #f59e0b); }
.geist-toast-error   { border-left-color: var(--geist-red, #c0392b); }

.geist-toast-icon { font-weight: 700; }
.geist-toast-msg  { flex: 1; white-space: pre-line; }
.geist-toast-close {
  border: 0;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  font-size: 13px;
  padding: 0 4px;
}
.geist-toast-close:hover { color: #1a1a1a; }

/* ─── Mobile/iPad Layout ─── */
@media (max-width: 520px) {
  .geist-modal-card { padding: 18px 16px 14px 16px; }
  .geist-modal-actions { flex-direction: column-reverse; }
  .geist-modal-actions .btn { width: 100%; }
}
