/* ═══════════════════════════════════════════════════════════════════
   chat-search.css — Header-Volltextsuche + Kunden-Chat-Widget
   © Dipl.-Ing. Rolf Krause seit 2024 · ingenieurbüro rolf krause
   Marken-Tokens: Navy #0D3A5C · Blau #1B4B82 · Cyan #00A0D2 · Hell #00C5E5
   ═══════════════════════════════════════════════════════════════════ */

:root {
  --eb-navy: #0D3A5C;
  --eb-blue: #1B4B82;
  --eb-cyan: #00A0D2;
  --eb-cyan-l: #00C5E5;
  --eb-ink: #1f2d3d;
  --eb-muted: #64748B;
  --eb-line: #E2E8F0;
  --eb-soft: #F5F7FA;
}

/* ── Header-Anordnung (Logo links, Nav, Suche rechts) ── */
.site-header .logo { order: 0; }
.site-header .main-nav { order: 1; }
.site-header .site-search-trigger { order: 2; margin-left: auto; }
.site-header .menu-toggle { order: 3; }

/* ── Such-Trigger im Header ── */
.site-search-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.8rem;
  background: var(--eb-soft);
  border: 1px solid var(--eb-line);
  border-radius: 999px;
  color: var(--eb-navy);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  flex-shrink: 0;
}
.site-search-trigger:hover { background: #fff; border-color: var(--eb-cyan); color: var(--eb-blue); }
.site-search-trigger svg { flex-shrink: 0; }
.site-search-trigger-label { white-space: nowrap; }
@media (max-width: 600px) {
  .site-search-trigger { padding: 0.5rem; }
  .site-search-trigger-label { display: none; }
}

/* ── Such-Overlay ── */
.eb-search-overlay {
  position: fixed;
  inset: 0;
  z-index: 10050;
  background: rgba(13, 58, 92, .35);
  backdrop-filter: blur(2px);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 9vh 16px 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}
.eb-search-overlay.is-open { opacity: 1; pointer-events: auto; }
.eb-search-box {
  width: 100%;
  max-width: 640px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 24px 64px rgba(13, 58, 92, .28);
  overflow: hidden;
  transform: translateY(-8px);
  transition: transform .18s ease;
  display: flex;
  flex-direction: column;
  max-height: 80vh;
}
.eb-search-overlay.is-open .eb-search-box { transform: translateY(0); }
.eb-search-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--eb-line);
}
.eb-search-head svg { color: var(--eb-cyan); flex-shrink: 0; }
.eb-search-input {
  flex: 1;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 1.05rem;
  color: var(--eb-ink);
  background: transparent;
}
.eb-search-input::placeholder { color: #9aa7b4; }
.eb-search-esc {
  font-size: 0.7rem;
  color: var(--eb-muted);
  border: 1px solid var(--eb-line);
  border-radius: 5px;
  padding: 2px 6px;
  background: var(--eb-soft);
}
.eb-search-results {
  overflow-y: auto;
  padding: 0.4rem;
}
.eb-search-result {
  display: block;
  padding: 0.7rem 0.85rem;
  border-radius: 9px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
.eb-search-result:hover,
.eb-search-result.is-active {
  background: var(--eb-soft);
  text-decoration: none;
}
.eb-search-result.is-active { box-shadow: inset 0 0 0 1px var(--eb-cyan); }
.eb-search-result-title {
  font-weight: 600;
  color: var(--eb-blue);
  font-size: 0.95rem;
  margin: 0 0 2px;
}
.eb-search-result-url {
  font-size: 0.72rem;
  color: var(--eb-muted);
  margin: 0 0 4px;
}
.eb-search-result-snippet {
  font-size: 0.82rem;
  color: var(--eb-muted);
  line-height: 1.5;
}
.eb-search-result-snippet mark {
  background: #d7f4fb;
  color: var(--eb-navy);
  border-radius: 3px;
  padding: 0 2px;
}
.eb-search-state {
  padding: 1.4rem 1rem;
  text-align: center;
  color: var(--eb-muted);
  font-size: 0.9rem;
}
.eb-search-foot {
  padding: 0.55rem 1rem;
  border-top: 1px solid var(--eb-line);
  font-size: 0.72rem;
  color: var(--eb-muted);
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.eb-search-foot kbd {
  font-family: inherit;
  background: var(--eb-soft);
  border: 1px solid var(--eb-line);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.7rem;
}

/* ── Chat: schwebender Button ── */
.eb-chat-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 9998;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.8rem 1.1rem;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--eb-blue), var(--eb-navy));
  color: #fff;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(13, 58, 92, .35);
  transition: transform .15s ease, box-shadow .15s ease;
}
.eb-chat-fab:hover { transform: translateY(-2px); box-shadow: 0 14px 36px rgba(13, 58, 92, .42); }
.eb-chat-fab svg { flex-shrink: 0; }
.eb-chat-fab.is-hidden { display: none; }
@media (max-width: 600px) {
  .eb-chat-fab { right: 14px; bottom: 14px; padding: 0.8rem; }
  .eb-chat-fab .eb-chat-fab-label { display: none; }
}

/* ── Chat: Panel ── */
.eb-chat-panel {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 10010;
  width: min(390px, calc(100vw - 32px));
  height: min(620px, calc(100vh - 90px));
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(13, 58, 92, .35);
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.eb-chat-panel.is-open { display: flex; }
@media (max-width: 600px) {
  .eb-chat-panel {
    right: 0; bottom: 0; top: 0; left: 0;
    width: 100%; height: 100%;
    border-radius: 0;
  }
}
.eb-chat-header {
  background: linear-gradient(135deg, var(--eb-blue), var(--eb-navy));
  color: #fff;
  padding: 0.95rem 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.eb-chat-header-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.eb-chat-header-text { flex: 1; min-width: 0; line-height: 1.25; }
.eb-chat-header-title { font-weight: 700; font-size: 0.98rem; }
.eb-chat-header-sub { font-size: 0.74rem; opacity: .82; }
.eb-chat-header-sub::before {
  content: ""; display: inline-block;
  width: 7px; height: 7px; border-radius: 50%;
  background: #43d17a; margin-right: 5px; vertical-align: middle;
}
.eb-chat-close {
  background: transparent; border: none; color: #fff;
  font-size: 1.4rem; line-height: 1; cursor: pointer;
  padding: 0.2rem 0.4rem; opacity: .85;
}
.eb-chat-close:hover { opacity: 1; }

.eb-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  background: var(--eb-soft);
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.eb-chat-msg {
  max-width: 85%;
  padding: 0.65rem 0.85rem;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.55;
  word-wrap: break-word;
  white-space: normal;
}
.eb-chat-msg.bot {
  background: #fff;
  border: 1px solid var(--eb-line);
  color: var(--eb-ink);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.eb-chat-msg.user {
  background: var(--eb-blue);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.eb-chat-msg a { color: var(--eb-cyan); text-decoration: underline; }
.eb-chat-msg.user a { color: #cdeffb; }
.eb-chat-msg ul { margin: 0.3rem 0; padding-left: 1.1rem; }
.eb-chat-msg p { margin: 0 0 0.5rem; }
.eb-chat-msg p:last-child { margin-bottom: 0; }

.eb-chat-typing { display: inline-flex; gap: 4px; padding: 0.2rem 0; }
.eb-chat-typing span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--eb-cyan);
  animation: ebTyping 1s infinite ease-in-out;
}
.eb-chat-typing span:nth-child(2) { animation-delay: .15s; }
.eb-chat-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes ebTyping { 0%,60%,100% { opacity:.3; transform: translateY(0);} 30% { opacity:1; transform: translateY(-3px);} }

.eb-chat-chips {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
  padding: 0 1rem 0.6rem;
  background: var(--eb-soft);
}
.eb-chat-chip {
  border: 1px solid var(--eb-line);
  background: #fff;
  color: var(--eb-blue);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font-family: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.eb-chat-chip:hover { border-color: var(--eb-cyan); color: var(--eb-navy); }

.eb-chat-foot {
  border-top: 1px solid var(--eb-line);
  background: #fff;
  padding: 0.6rem 0.7rem 0.5rem;
}
.eb-chat-inputrow { display: flex; gap: 0.5rem; align-items: flex-end; }
.eb-chat-input {
  flex: 1;
  border: 1px solid var(--eb-line);
  border-radius: 12px;
  padding: 0.6rem 0.8rem;
  font-family: inherit;
  font-size: 0.9rem;
  resize: none;
  max-height: 110px;
  outline: none;
  color: var(--eb-ink);
}
.eb-chat-input:focus { border-color: var(--eb-cyan); }
.eb-chat-send {
  flex-shrink: 0;
  width: 42px; height: 42px;
  border: none; border-radius: 12px;
  background: var(--eb-cyan);
  color: #fff; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.eb-chat-send:hover { background: var(--eb-blue); }
.eb-chat-send:disabled { opacity: .5; cursor: not-allowed; }

.eb-chat-handoff {
  width: 100%;
  margin-top: 0.5rem;
  border: 1px solid var(--eb-line);
  background: var(--eb-soft);
  color: var(--eb-navy);
  border-radius: 10px;
  padding: 0.5rem;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.eb-chat-handoff:hover { border-color: var(--eb-cyan); color: var(--eb-blue); }
.eb-chat-note {
  font-size: 0.66rem;
  color: var(--eb-muted);
  line-height: 1.45;
  padding: 0.45rem 0.2rem 0.1rem;
  text-align: center;
}
.eb-chat-note a { color: var(--eb-cyan); }

/* ── Kontakt-Formular im Chat ── */
.eb-chat-form { display: none; flex-direction: column; gap: 0.5rem; padding: 0.2rem 0.1rem; }
.eb-chat-form.is-open { display: flex; }
.eb-chat-form label { font-size: 0.78rem; font-weight: 600; color: var(--eb-navy); }
.eb-chat-form input,
.eb-chat-form textarea {
  border: 1px solid var(--eb-line);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  font-family: inherit;
  font-size: 0.88rem;
  outline: none;
  color: var(--eb-ink);
  width: 100%;
}
.eb-chat-form input:focus,
.eb-chat-form textarea:focus { border-color: var(--eb-cyan); }
.eb-chat-form textarea { resize: vertical; min-height: 64px; }
.eb-chat-form .eb-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.eb-chat-form-actions { display: flex; gap: 0.5rem; }
.eb-chat-form-submit {
  flex: 1;
  border: none; border-radius: 10px;
  background: var(--eb-cyan); color: #fff;
  padding: 0.6rem; font-family: inherit; font-weight: 700; font-size: 0.88rem;
  cursor: pointer; transition: background .15s;
}
.eb-chat-form-submit:hover { background: var(--eb-blue); }
.eb-chat-form-submit:disabled { opacity: .5; cursor: not-allowed; }
.eb-chat-form-cancel {
  border: 1px solid var(--eb-line); border-radius: 10px;
  background: #fff; color: var(--eb-muted);
  padding: 0.6rem 0.9rem; font-family: inherit; font-size: 0.85rem; cursor: pointer;
}
.eb-chat-form-msg { font-size: 0.8rem; line-height: 1.5; }
.eb-chat-form-msg.ok { color: #1a7f4b; }
.eb-chat-form-msg.err { color: #c0392b; }
