/*
 * MessengerHub Chat-Blase
 * Alle Klassen mit Präfix "mhc-", damit nichts mit dem Theme kollidiert.
 * Button-/Link-Resets sind nötig, weil viele Themes button/a global stylen.
 * Lizenz: GPL-2.0-or-later
 */

.mhc-root {
  --mhc-offset-x: 24px;
  --mhc-offset-y: 24px;
  --mhc-z: 9999;
  --mhc-bubble-bg: #2563EB;
  --mhc-bubble-fg: #FFFFFF;
  --mhc-text: #1F2937;
  --mhc-muted: #4B5563;
  --mhc-line: #E5E7EB;

  position: fixed;
  bottom: var(--mhc-offset-y);
  z-index: var(--mhc-z);
  display: none;
  flex-direction: column;
  gap: 12px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.4;
  color: var(--mhc-text);
}
.mhc-root.mhc-visible { display: flex; }
.mhc-root.mhc-pos-right { right: var(--mhc-offset-x); align-items: flex-end; }
.mhc-root.mhc-pos-left  { left: var(--mhc-offset-x);  align-items: flex-start; }

.mhc-root *,
.mhc-root *::before,
.mhc-root *::after { box-sizing: border-box; font-family: inherit; }

.mhc-root button,
.mhc-root a {
  margin: 0;
  font: inherit;
  letter-spacing: normal;
  text-transform: none;
  text-decoration: none;
  text-shadow: none;
  box-shadow: none;
  min-height: 0;
  min-width: 0;
  width: auto;
  cursor: pointer;
}
.mhc-root button { border: 0; background: none; color: inherit; padding: 0; line-height: inherit; }
.mhc-root svg { display: block; }

.mhc-root button:focus-visible,
.mhc-root a:focus-visible {
  outline: 3px solid #1D4ED8;
  outline-offset: 2px;
}

/* ── Runder Button ── */
.mhc-root .mhc-fab {
  position: relative;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--mhc-bubble-bg);
  color: var(--mhc-bubble-fg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.28);
  transition: transform 0.2s ease;
}
.mhc-root .mhc-fab:hover { transform: scale(1.06); }
.mhc-fab-icon,
.mhc-fab-close { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
.mhc-fab-close { display: none; }
.mhc-is-open .mhc-fab-icon { display: none; }
.mhc-is-open .mhc-fab-close { display: flex; }
.mhc-fab-img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ── Panel ── */
.mhc-panel {
  width: min(300px, calc(100vw - 32px));
  background: #FFFFFF;
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.28);
  padding: 14px 16px 16px;
  animation: mhc-pop 0.18s ease;
}
.mhc-panel[hidden] { display: none; }

@keyframes mhc-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

.mhc-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.mhc-title { font-weight: 600; font-size: 15px; padding-top: 4px; }
.mhc-root .mhc-icon-btn {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--mhc-muted);
}
.mhc-root .mhc-icon-btn:hover { background: #F3F4F6; }
.mhc-root .mhc-icon-btn svg { width: 18px; height: 18px; }

.mhc-desc { margin: 6px 0 0; font-size: 14px; color: var(--mhc-muted); }

.mhc-status { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; color: var(--mhc-muted); }
.mhc-status-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; background: #9CA3AF; }
.mhc-status-open .mhc-status-dot { background: #16A34A; }
.mhc-status-away .mhc-status-dot { background: #D97706; }

.mhc-body { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }

/* Kanalauswahl */
.mhc-root .mhc-channel {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 8px 10px;
  border: 1px solid var(--mhc-line);
  border-radius: 12px;
  text-align: left;
  color: var(--mhc-text);
}
.mhc-root .mhc-channel:hover { background: #F9FAFB; }
.mhc-channel-icon { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #FFFFFF; flex: 0 0 auto; }
.mhc-bg-whatsapp { background: #0E7A5F; }
.mhc-bg-telegram { background: #1A6FA3; }
.mhc-channel-label { flex: 1; font-weight: 500; }
.mhc-channel-arrow { color: var(--mhc-muted); }

.mhc-root .mhc-back { align-self: flex-start; font-size: 13px; color: var(--mhc-muted); padding: 4px 2px; }
.mhc-root .mhc-back:hover { color: var(--mhc-text); }

/* Chat öffnen */
.mhc-root .mhc-open {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 10px 16px;
  border-radius: 12px;
  font-weight: 600;
  color: var(--mhc-btn-fg, #FFFFFF);
}
.mhc-root .mhc-open:hover { filter: brightness(1.08); color: var(--mhc-btn-fg, #FFFFFF); }
.mhc-root .mhc-open-whatsapp { background: var(--mhc-btn-bg, #0E7A5F); }
.mhc-root .mhc-open-telegram { background: var(--mhc-btn-bg, #1A6FA3); }

.mhc-notice { margin: 0; font-size: 12px; color: var(--mhc-muted); text-align: center; }

/* QR-Code */
.mhc-sep { display: flex; align-items: center; gap: 8px; margin-top: 4px; font-size: 12px; color: var(--mhc-muted); white-space: nowrap; }
.mhc-sep-line { flex: 1; height: 1px; background: var(--mhc-line); }
.mhc-qr { width: 180px; height: 180px; margin: 0 auto; }
.mhc-qr svg { width: 100%; height: 100%; }

/* Hinweis MessengerHub */
.mhc-credit { margin-top: 12px; text-align: center; font-size: 11px; }
.mhc-root .mhc-credit a { color: var(--mhc-muted); }
.mhc-root .mhc-credit a:hover { text-decoration: underline; }

@media (max-width: 480px) {
  .mhc-root .mhc-fab { width: 52px; height: 52px; }
}

@media (prefers-reduced-motion: reduce) {
  .mhc-panel { animation: none; }
  .mhc-root .mhc-fab { transition: none; }
  .mhc-root .mhc-fab:hover { transform: none; }
}

/* ── Feste Buttons (Shortcode / Block) ── */
/* flex statt inline-flex: so greift die Inhaltsbreite von Block-Themes (span bleibt gültig in <p>) */
.mhc-inline { display: flex; flex-wrap: wrap; gap: 10px; }
.mhc-inline a.mhc-inline-btn {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: 600;
  line-height: 1.2;
  color: #FFFFFF;
  text-decoration: none;
}
.mhc-inline a.mhc-inline-btn:hover,
.mhc-inline a.mhc-inline-btn:focus { color: #FFFFFF; filter: brightness(1.08); text-decoration: none; }
.mhc-inline a.mhc-inline-btn:focus-visible { outline: 3px solid #1D4ED8; outline-offset: 2px; }
.mhc-inline a.mhc-inline-whatsapp { background: #0E7A5F; }
.mhc-inline a.mhc-inline-telegram { background: #1A6FA3; }
