/* DV Pflege-Chat Widget – passt zu ihrteam24.de Brand */
:root {
  --dvc-deep: #03346D;
  --dvc-primary: #0796D6;
  --dvc-accent: #7fd3f5;
  --dvc-bg: #ffffff;
  --dvc-text: #1f2937;
  --dvc-muted: #64748b;
  --dvc-line: #e5e7eb;
  --dvc-shadow: 0 10px 40px rgba(3,52,109,0.18);
  --dvc-radius: 16px;
}

/* === Bubble (immer sichtbar, über OneTap rechts unten) === */
.dvchat-bubble {
  position: fixed;
  right: 18px;
  bottom: 100px; /* OneTap-Plugin sitzt bei 18px, ~60px hoch + 22px Abstand */
  z-index: 99998;
  background: linear-gradient(135deg, var(--dvc-deep), var(--dvc-primary));
  color: #fff;
  border-radius: 999px;
  padding: 12px 18px 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: var(--dvc-shadow);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  font-weight: 600;
  border: none;
  transition: transform 0.2s, box-shadow 0.2s;
  max-width: 240px;
}
.dvchat-bubble:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 50px rgba(7,150,214,0.35);
}
.dvchat-bubble .dvc-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #fff;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--dvc-deep);
  font-weight: 800;
  font-size: 16px;
}
.dvchat-bubble .dvc-label {
  line-height: 1.2;
  white-space: nowrap;
}
.dvchat-bubble .dvc-pulse {
  position: absolute;
  top: -4px; right: -4px;
  width: 14px; height: 14px;
  background: #ff5b3e;
  border-radius: 50%;
  border: 2px solid #fff;
  animation: dvc-pulse 1.8s ease-in-out infinite;
}
@keyframes dvc-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.7; }
}

/* === Panel (Chat-Fenster) === */
.dvchat-panel {
  position: fixed;
  right: 18px;
  bottom: 100px;
  width: 400px;
  max-width: calc(100vw - 36px);
  height: 620px;
  max-height: calc(100vh - 140px);
  z-index: 99999;
  background: var(--dvc-bg);
  border-radius: var(--dvc-radius);
  box-shadow: var(--dvc-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--dvc-text);
  animation: dvc-slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes dvc-slide-up {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.dvchat-panel-header {
  background: linear-gradient(135deg, var(--dvc-deep), var(--dvc-primary));
  color: #fff;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.dvchat-panel-header .dvc-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--dvc-deep);
  font-weight: 800;
  font-size: 18px;
  flex-shrink: 0;
}
.dvchat-panel-header .dvc-title {
  flex: 1;
  line-height: 1.25;
  min-width: 0;
}
.dvchat-panel-header .dvc-title strong {
  display: block;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dvchat-panel-header .dvc-title span {
  font-size: 12px;
  opacity: 0.9;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dvchat-panel-header .dvc-status {
  display: inline-block;
  width: 8px; height: 8px;
  background: #4ade80;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}
.dvchat-panel-header .dvc-close {
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.dvchat-panel-header .dvc-close:hover { background: rgba(255,255,255,0.25); }

.dvchat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #f9fafb;
}
.dvchat-messages::-webkit-scrollbar { width: 6px; }
.dvchat-messages::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

.dvc-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}
.dvc-msg.user {
  background: var(--dvc-primary);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.dvc-msg.assistant {
  background: #fff;
  color: var(--dvc-text);
  align-self: flex-start;
  border: 1px solid var(--dvc-line);
  border-bottom-left-radius: 4px;
}
.dvc-msg.assistant a {
  color: var(--dvc-primary);
  text-decoration: underline;
  font-weight: 600;
}
.dvc-msg.system {
  background: #fef3c7;
  color: #92400e;
  align-self: center;
  border-radius: 8px;
  font-size: 12px;
  padding: 8px 12px;
  max-width: 100%;
  text-align: center;
}
.dvc-msg.error {
  background: #fee2e2;
  color: #991b1b;
}
.dvc-msg .dvc-typing {
  display: inline-block;
  width: 8px; height: 8px;
  background: var(--dvc-muted);
  border-radius: 50%;
  animation: dvc-typing 1.4s infinite ease-in-out;
}
.dvc-msg .dvc-typing:nth-child(2) { animation-delay: 0.2s; }
.dvc-msg .dvc-typing:nth-child(3) { animation-delay: 0.4s; }
@keyframes dvc-typing {
  0%, 60%, 100% { opacity: 0.3; transform: scale(0.85); }
  30% { opacity: 1; transform: scale(1); }
}

.dvc-tool-indicator {
  font-size: 12px;
  color: var(--dvc-muted);
  font-style: italic;
  padding: 4px 12px;
}

/* === Dezenter CTA-Link am Ende einer Antwort (kein dicker Button) === */
.dvchat-messages button.dvc-cta-link,
.dvchat-panel button.dvc-cta-link {
  all: unset !important;
  align-self: flex-start !important;
  display: inline-block !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 4px 0 2px !important;
  margin: -4px 0 0 4px !important;
  color: var(--dvc-primary) !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  font-family: inherit !important;
  line-height: 1.4 !important;
  cursor: pointer !important;
  text-decoration: underline !important;
  text-decoration-color: rgba(7,150,214,0.4) !important;
  text-underline-offset: 3px !important;
  text-align: left !important;
  width: auto !important;
  min-width: 0 !important;
  height: auto !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  border-radius: 0 !important;
}
.dvchat-messages button.dvc-cta-link:hover,
.dvchat-panel button.dvc-cta-link:hover {
  color: var(--dvc-deep) !important;
  text-decoration-color: var(--dvc-deep) !important;
  background: transparent !important;
}

/* === Input === */
.dvchat-input-area {
  border-top: 1px solid var(--dvc-line);
  background: #fff;
  padding: 12px 14px;
  flex-shrink: 0;
}
.dvchat-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.dvchat-input {
  flex: 1;
  border: 1px solid var(--dvc-line);
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 14px;
  line-height: 1.4;
  font-family: inherit;
  resize: none;
  max-height: 110px;
  min-height: 44px;
  color: var(--dvc-text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.dvchat-input:focus {
  border-color: var(--dvc-primary);
  box-shadow: 0 0 0 3px rgba(7,150,214,0.12);
}
.dvchat-send {
  background: var(--dvc-deep);
  color: #fff;
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.1s;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(3,52,109,0.2);
}
.dvchat-send:hover { background: var(--dvc-primary); }
.dvchat-send:active { transform: scale(0.95); }
.dvchat-send:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }

.dvchat-consent {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--dvc-muted);
  line-height: 1.3;
}
.dvchat-consent input[type="checkbox"] {
  flex-shrink: 0;
  cursor: pointer;
  width: 16px;
  height: 16px;
  accent-color: var(--dvc-primary);
}
.dvchat-consent label {
  cursor: pointer;
  flex: 1;
}
.dvchat-consent a {
  color: var(--dvc-primary);
  text-decoration: underline;
  font-weight: 500;
}
.dvchat-consent-info {
  font-size: 10px;
  color: #94a3b8;
  margin-top: 4px;
  padding-left: 24px;
  line-height: 1.3;
}

.dvchat-counter {
  text-align: right;
  font-size: 10px;
  color: #94a3b8;
  padding: 6px 4px 0;
  letter-spacing: 0.02em;
}

/* === Eigenes Funnel-Modal (iframe-Wrapper für DVCF-Funnels) === */
.dvchat-funnel-modal {
  position: fixed;
  inset: 0;
  z-index: 100001;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.dvchat-funnel-modal.is-open { display: flex; }
.dvchat-funnel-backdrop {
  position: absolute; inset: 0;
  background: rgba(3,52,109,0.6);
  backdrop-filter: blur(2px);
}
.dvchat-funnel-frame {
  position: relative;
  width: 100%;
  max-width: 720px;
  height: min(92vh, 880px);
  background: #fff;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,0.4);
}
.dvchat-funnel-close {
  position: absolute;
  top: 12px; right: 12px;
  z-index: 5;
  width: 40px; height: 40px;
  border: none;
  border-radius: 50%;
  background: #fff;
  color: var(--dvc-deep);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.15s;
}
.dvchat-funnel-close:hover { transform: scale(1.05); background: #f1f5f9; }
.dvchat-funnel-iframe {
  width: 100%; height: 100%;
  border: 0;
  display: block;
  background: #fff;
}
@media (max-width: 600px) {
  .dvchat-funnel-modal { padding: 8px; }
  .dvchat-funnel-frame { height: min(96vh, 920px); border-radius: 12px; }
}

@media (max-width: 480px) {
  .dvchat-panel {
    right: 8px;
    left: 8px;
    width: auto;
    max-width: none;
    bottom: 90px;
    height: calc(100vh - 120px);
  }
  .dvchat-bubble {
    right: 12px;
    bottom: 90px;
    max-width: 200px;
  }
}
