/* Nipkow AI Chatbot – chatbot.css
   Komplett neu geschrieben – sauberes Design
   WCAG 2.1 AA konform, keine externen Ressourcen
   ================================================ */

:root {
  --nacb-primary:      #e63329;
  --nacb-primary-dark: #b5251d;
  --nacb-white:        #ffffff;
  --nacb-bg:           #ffffff;
  --nacb-bot-bubble:   #f0f0f0;
  --nacb-text:         #1a1a1a;
  --nacb-text-light:   #666666;
  --nacb-border:       #e0e0e0;
  --nacb-shadow:       0 4px 24px rgba(0,0,0,0.15);
  --nacb-radius:       16px;
  --nacb-font:         -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --nacb-z:            99999;
}

/* ── Reset für Widget ───────────────────────────────── */
#nacb-widget,
#nacb-widget * {
  box-sizing: border-box;
  font-family: var(--nacb-font);
  line-height: 1.5;
}

/* ── Widget Container ───────────────────────────────── */
#nacb-widget {
  position: fixed;
  bottom: 24px;
  z-index: var(--nacb-z);
}
#nacb-widget.nacb--right { right: 24px; }
#nacb-widget.nacb--left  { left:  24px; }

/* ── Toggle Button ──────────────────────────────────── */
#nacb-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: var(--nacb-primary) !important;
  background: var(--nacb-primary) !important;
  border: none !important;
  cursor: pointer;
  box-shadow: var(--nacb-shadow);
  display: flex !important;
  align-items: center;
  justify-content: center;
  position: relative;
  color: var(--nacb-white) !important;
  transition: background-color 0.2s, transform 0.2s;
  padding: 0;
  outline: none;
  min-width: 44px;
  min-height: 44px;
}
#nacb-toggle:hover {
  background-color: var(--nacb-primary-dark) !important;
  background: var(--nacb-primary-dark) !important;
  transform: scale(1.05);
}
#nacb-toggle svg {
  fill: #ffffff !important;
  color: #ffffff !important;
  width: 26px;
  height: 26px;
  display: block;
}

/* ── Badge ──────────────────────────────────────────── */
.nacb-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ff6b00;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 10px;
  padding: 2px 6px;
  border: 2px solid #fff;
  display: none;
  min-width: 18px;
  text-align: center;
  line-height: 1.4;
}
.nacb-badge.visible { display: block; }

/* ── Chat Box ───────────────────────────────────────── */
#nacb-box {
  position: absolute;
  bottom: 72px;
  width: 360px;
  max-height: 560px;
  background-color: var(--nacb-white);
  background: var(--nacb-white);
  border-radius: var(--nacb-radius);
  box-shadow: var(--nacb-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.85) translateY(8px);
  transform-origin: bottom right;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s cubic-bezier(.34,1.56,.64,1), opacity 0.2s;
  border: 1px solid var(--nacb-border);
}
.nacb--left #nacb-box {
  left: 0;
  transform-origin: bottom left;
}
.nacb--right #nacb-box { right: 0; }

#nacb-box.nacb-box--open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* ── Header ─────────────────────────────────────────── */
.nacb-header {
  background-color: var(--nacb-primary) !important;
  background: var(--nacb-primary) !important;
  color: #ffffff !important;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.nacb-header__avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #ffffff;
}
.nacb-header__avatar svg {
  fill: #ffffff !important;
  width: 20px;
  height: 20px;
}
.nacb-header__info { flex: 1; min-width: 0; }
.nacb-header__name {
  font-weight: 700;
  font-size: 15px;
  color: #ffffff !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nacb-header__status {
  font-size: 12px;
  color: rgba(255,255,255,0.9) !important;
  display: flex;
  align-items: center;
  gap: 5px;
}
.nacb-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4caf50;
  display: inline-block;
  flex-shrink: 0;
}

/* ── Close Button ───────────────────────────────────── */
.nacb-close {
  background: transparent !important;
  border: none !important;
  color: #ffffff !important;
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 36px;
  transition: background 0.2s;
}
.nacb-close:hover {
  background: rgba(255,255,255,0.2) !important;
}
.nacb-close svg {
  fill: #ffffff !important;
  width: 18px;
  height: 18px;
}

/* ── Messages ───────────────────────────────────────── */
.nacb-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--nacb-white);
  scroll-behavior: smooth;
}
.nacb-messages::-webkit-scrollbar { width: 4px; }
.nacb-messages::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 2px;
}

/* ── Nachrichten-Bubbles ────────────────────────────── */
.nacb-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
  animation: nacb-in 0.2s ease;
}
@keyframes nacb-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Bot-Nachricht: dunkler Text auf hellem Hintergrund */
.nacb-msg--bot {
  background-color: var(--nacb-bot-bubble) !important;
  background: var(--nacb-bot-bubble) !important;
  color: var(--nacb-text) !important;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.nacb-msg--bot a {
  color: var(--nacb-primary-dark) !important;
  text-decoration: underline;
}

/* User-Nachricht: weißer Text auf rotem Hintergrund */
.nacb-msg--user {
  background-color: var(--nacb-primary) !important;
  background: var(--nacb-primary) !important;
  color: #ffffff !important;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.nacb-msg--user a {
  color: #ffe0de !important;
}

/* ── Typing Indikator ───────────────────────────────── */
.nacb-typing {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 12px 16px;
  background: var(--nacb-bot-bubble);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  width: 58px;
}
.nacb-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #999;
  animation: nacb-bounce 1.2s infinite;
}
.nacb-typing span:nth-child(2) { animation-delay: 0.18s; }
.nacb-typing span:nth-child(3) { animation-delay: 0.36s; }
@keyframes nacb-bounce {
  0%,60%,100% { transform: translateY(0); }
  30%          { transform: translateY(-6px); }
}

/* ── Quick Buttons ──────────────────────────────────── */
.nacb-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 14px 4px;
  background: var(--nacb-white);
  flex-shrink: 0;
}
.nacb-quick-btn {
  background-color: var(--nacb-white) !important;
  background: var(--nacb-white) !important;
  border: 1.5px solid var(--nacb-primary) !important;
  color: var(--nacb-primary) !important;
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12.5px;
  font-family: var(--nacb-font);
  cursor: pointer;
  white-space: nowrap;
  min-height: 32px;
  transition: all 0.15s;
}
.nacb-quick-btn:hover {
  background-color: var(--nacb-primary) !important;
  background: var(--nacb-primary) !important;
  color: #ffffff !important;
}

/* ── Datenschutz ────────────────────────────────────── */
.nacb-privacy {
  font-size: 11px;
  color: var(--nacb-text-light);
  padding: 6px 14px;
  display: flex;
  gap: 5px;
  align-items: flex-start;
  border-top: 1px solid var(--nacb-border);
  background: var(--nacb-white);
  line-height: 1.4;
}
.nacb-privacy svg { flex-shrink: 0; margin-top: 1px; }

/* ── Footer / Eingabe ───────────────────────────────── */
.nacb-footer {
  padding: 10px 12px;
  border-top: 1px solid var(--nacb-border);
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: var(--nacb-white);
  flex-shrink: 0;
}

.nacb-input {
  flex: 1;
  border: 1.5px solid var(--nacb-border) !important;
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 14px;
  font-family: var(--nacb-font);
  color: var(--nacb-text) !important;
  background-color: var(--nacb-white) !important;
  background: var(--nacb-white) !important;
  resize: none;
  outline: none;
  max-height: 100px;
  line-height: 1.4;
  transition: border-color 0.2s;
}
.nacb-input:focus {
  border-color: var(--nacb-primary) !important;
}
.nacb-input::placeholder {
  color: #999 !important;
}

/* ── Send Button ────────────────────────────────────── */
.nacb-send {
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  background-color: var(--nacb-primary) !important;
  background: var(--nacb-primary) !important;
  border: none !important;
  border-radius: 50%;
  cursor: pointer;
  color: #ffffff !important;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background-color 0.2s;
  padding: 0;
}
.nacb-send:hover:not(:disabled) {
  background-color: var(--nacb-primary-dark) !important;
  background: var(--nacb-primary-dark) !important;
}
.nacb-send:disabled {
  background-color: #cccccc !important;
  background: #cccccc !important;
  cursor: not-allowed;
}
.nacb-send svg {
  fill: #ffffff !important;
  width: 18px;
  height: 18px;
}

/* ── Powered By ─────────────────────────────────────── */
.nacb-powered {
  text-align: center;
  font-size: 10px;
  color: #bbbbbb;
  padding: 4px 0 8px;
  background: var(--nacb-white);
}

/* ── Screen Reader ──────────────────────────────────── */
.screen-reader-text {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0,0,0,0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ── Focus ──────────────────────────────────────────── */
#nacb-widget *:focus-visible {
  outline: 3px solid var(--nacb-primary);
  outline-offset: 2px;
}

/* ── Reduced Motion ─────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  #nacb-box { transition: opacity 0.1s !important; }
  .nacb-msg { animation: none !important; }
  .nacb-typing span { animation: none !important; }
}

/* ── Mobil ──────────────────────────────────────────── */
@media (max-width: 420px) {
  #nacb-widget.nacb--right { right: 12px; bottom: 12px; }
  #nacb-widget.nacb--left  { left:  12px; bottom: 12px; }
  #nacb-box { width: calc(100vw - 24px); }
  .nacb--right #nacb-box { right: -6px; }
  .nacb--left  #nacb-box { left:  -6px; }
}
