/* Web-Chat-Widget für die öffentliche Webseite */

#ks-chat-widget * {
  box-sizing: border-box;
  font-family: 'Archivo', system-ui, -apple-system, sans-serif;
}

#ks-chat-widget .ks-chat-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99998;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px 14px 18px;
  border-radius: 999px;
  border: 0;
  background: linear-gradient(135deg, #ff0d7b 0%, #ff7a00 100%);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: .02em;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(255, 13, 123, .35);
  transition: transform .15s, box-shadow .15s;
}
#ks-chat-widget .ks-chat-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(255, 13, 123, .45);
}
#ks-chat-widget .ks-chat-icon { font-size: 18px; }
#ks-chat-widget .ks-chat-fab-badge[hidden] { display: none; }
#ks-chat-widget .ks-chat-fab-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #fff;
  color: #ff0d7b;
  border: 2px solid #ff0d7b;
  border-radius: 999px;
  min-width: 22px;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  line-height: 16px;
}

#ks-chat-widget .ks-chat-fab-pulse {
  animation: ks-chat-pulse 1.5s ease-in-out infinite;
}
@keyframes ks-chat-pulse {
  0%, 100% { transform: translateY(0); box-shadow: 0 8px 24px rgba(255, 13, 123, .35); }
  50%      { transform: translateY(-4px); box-shadow: 0 14px 32px rgba(255, 13, 123, .55); }
}

#ks-chat-widget .ks-chat-panel {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 540px;
  max-height: calc(100vh - 48px);
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#ks-chat-widget .ks-chat-panel[hidden] {
  display: none !important;
}

#ks-chat-widget .ks-chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: #0b0b0c;
  color: #fff;
}
#ks-chat-widget .ks-chat-title { font-weight: 900; letter-spacing: -.01em; font-size: 15px; }
#ks-chat-widget .ks-chat-close {
  background: none; border: 0; color: #fff; cursor: pointer;
  font-size: 26px; line-height: 1; padding: 0 4px;
}

#ks-chat-widget .ks-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f9f9f6;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
#ks-chat-widget .ks-chat-body.dm-mode {
  padding: 0;
  overflow: hidden;
}

/* Empty / Login Prompt */
#ks-chat-widget .ks-chat-empty {
  text-align: center; padding: 40px 20px; color: #1f1f1d;
}
#ks-chat-widget .ks-chat-empty-big { font-size: 48px; color: #ff0d7b; margin-bottom: 12px; }
#ks-chat-widget .ks-chat-empty h3 { margin: 0 0 8px; font-size: 17px; font-weight: 900; }
#ks-chat-widget .ks-chat-empty p { margin: 8px 0 16px; font-size: 13px; color: #5a5a55; line-height: 1.5; }
#ks-chat-widget .ks-chat-hint { font-size: 12px; color: #888; margin-top: 18px; }
#ks-chat-widget .ks-chat-hint a { color: #ff0d7b; }

#ks-chat-widget .ks-chat-empty-inline {
  background: #fff; border: 1px dashed #ddd; border-radius: 12px;
  padding: 20px; text-align: center; color: #5a5a55; font-size: 13px;
}
#ks-chat-widget .ks-chat-empty-inline a { color: #ff0d7b; }

#ks-chat-widget .ks-chat-btn {
  display: inline-block; padding: 10px 18px; border-radius: 9px;
  font-weight: 800; font-size: 13px; text-decoration: none;
  border: 1.5px solid transparent; cursor: pointer; margin: 4px;
}
#ks-chat-widget .ks-chat-btn-dark { background: #0b0b0c; color: #fff; }
#ks-chat-widget .ks-chat-btn-ghost {
  background: transparent; color: #0b0b0c; border-color: #0b0b0c;
}

/* Formular-Inputs für anonyme Start-Maske */
#ks-chat-widget .ks-chat-fl {
  display: block; font-size: 11px; font-weight: 800;
  letter-spacing: .06em; text-transform: uppercase;
  color: #5a5a55; margin-bottom: 4px;
}
#ks-chat-widget .ks-chat-input {
  width: 100%; padding: 10px 13px; border: 1.5px solid #ddd;
  border-radius: 9px; font-family: inherit; font-size: 14px;
  background: #fff; box-sizing: border-box;
}
#ks-chat-widget .ks-chat-input:focus {
  outline: none; border-color: #0b0b0c;
}

/* Begrüssungsbanner über den Nachrichten */
#ks-chat-widget .ks-anon-greeting {
  background: linear-gradient(135deg, #fff0e8, #ffe9f0);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 10px;
  font-size: 13px;
  color: #5a3a30;
  line-height: 1.4;
  text-align: center;
}

#ks-chat-widget .ks-chat-section-title {
  font-size: 10px; font-weight: 800; color: #888;
  letter-spacing: .12em; text-transform: uppercase;
  margin: 4px 4px 8px;
}

#ks-chat-widget .ks-chat-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
#ks-chat-widget .ks-chat-list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; background: #fff;
  border: 1px solid #eee; border-radius: 10px;
  cursor: pointer; text-align: left; width: 100%;
  font-family: inherit;
}
#ks-chat-widget .ks-chat-list-item:hover { background: #f5f5f3; border-color: #ddd; }
#ks-chat-widget .ks-chat-list-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 13px;
}
#ks-chat-widget .ks-chat-list-meta { flex: 1; display: flex; flex-direction: column; gap: 2px; }
#ks-chat-widget .ks-chat-list-name { font-weight: 700; font-size: 14px; color: #1f1f1d; }
#ks-chat-widget .ks-chat-list-role { font-size: 12px; color: #888; }
#ks-chat-widget .ks-online-dot { color: #0a6b35; font-size: 12px; }
#ks-chat-widget .ks-chat-list-unread {
  background: #ff0d7b; color: #fff; font-size: 11px; font-weight: 800;
  padding: 2px 8px; border-radius: 999px; align-self: flex-start;
}

#ks-chat-widget .ks-chat-loading { padding: 40px; text-align: center; color: #888; font-size: 13px; }

/* DM Chat */
#ks-chat-widget .ks-dm-back {
  padding: 8px 12px; font-size: 12px; color: #5a5a55; cursor: pointer;
  background: #fff; border-bottom: 1px solid #eee;
}
#ks-chat-widget .ks-dm-back:hover { color: #0b0b0c; }

#ks-chat-widget .ks-dm-msgs {
  flex: 1; padding: 14px 12px; overflow-y: auto;
  background: #f9f9f6; display: flex; flex-direction: column; gap: 8px;
}

#ks-chat-widget .ks-dm-msg {
  max-width: 80%; align-self: flex-start;
  background: #fff; padding: 8px 12px; border-radius: 14px 14px 14px 4px;
  font-size: 13px; line-height: 1.4;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
#ks-chat-widget .ks-dm-msg.self {
  align-self: flex-end;
  background: #0b0b0c; color: #fff;
  border-radius: 14px 14px 4px 14px;
}
#ks-chat-widget .ks-dm-msg-by { font-size: 11px; font-weight: 700; color: #ff0d7b; margin-bottom: 3px; }
#ks-chat-widget .ks-dm-msg-body { white-space: pre-wrap; word-wrap: break-word; }
#ks-chat-widget .ks-dm-msg-time { font-size: 10px; opacity: .6; margin-top: 4px; }

#ks-chat-widget .ks-dm-msg-atts { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; }
#ks-chat-widget .ks-dm-att-img img {
  max-width: 200px; max-height: 200px; border-radius: 8px; display: block;
}
#ks-chat-widget .ks-dm-att-video {
  max-width: 240px; max-height: 240px; border-radius: 8px; display: block; background:#000;
}
#ks-chat-widget .ks-dm-att-audio { max-width: 240px; display: block; }
#ks-chat-widget .ks-dm-att-file {
  display: inline-flex; gap: 6px; align-items: center;
  padding: 6px 10px; background: rgba(0,0,0,.05);
  border-radius: 8px; font-size: 12px; text-decoration: none; color: inherit;
}
#ks-chat-widget .ks-dm-msg.self .ks-dm-att-file {
  background: rgba(255,255,255,.15); color: #fff;
}

#ks-chat-widget .ks-dm-input {
  background: #fff; border-top: 1px solid #eee; padding: 10px;
}
#ks-chat-widget .ks-dm-atts {
  display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px;
}
#ks-chat-widget .ks-dm-atts:empty { display: none; }
#ks-chat-widget .ks-dm-att-pill {
  background: #f5f5f3; border: 1px solid #ddd; border-radius: 30px;
  padding: 3px 10px; font-size: 11px;
}
#ks-chat-widget .ks-dm-att-pill span { cursor: pointer; color: #a8094c; font-weight: 800; margin-left: 6px; }

#ks-chat-widget .ks-dm-input form {
  display: flex; gap: 8px; align-items: flex-end;
}
#ks-chat-widget .ks-dm-input textarea {
  flex: 1; resize: none; border: 1.5px solid #eee;
  border-radius: 18px; padding: 9px 14px; font-family: inherit;
  font-size: 13px; max-height: 100px; line-height: 1.4;
}
#ks-chat-widget .ks-dm-input textarea:focus { outline: none; border-color: #0b0b0c; }
#ks-chat-widget .ks-dm-btn-att, #ks-chat-widget .ks-dm-btn-send {
  background: #0b0b0c; color: #fff; border: 0; border-radius: 50%;
  width: 36px; height: 36px; cursor: pointer; font-size: 16px; font-weight: 800;
}
#ks-chat-widget .ks-dm-btn-att { background: #f5f5f3; color: #0b0b0c; }

@media (max-width: 480px) {
  #ks-chat-widget .ks-chat-panel {
    width: calc(100vw - 16px);
    height: calc(100vh - 32px);
    bottom: 16px; right: 8px;
  }
  #ks-chat-widget .ks-chat-fab { bottom: 16px; right: 16px; padding: 12px 18px; }
}
