/* ============================================================
   Lekdetectie Chat Widget v2 — Stylesheet
   ============================================================ */

:root {
  --ldcw-primary:      #0057b8;
  --ldcw-primary-dk:   #003f8a;
  --ldcw-accent:       #00a651;   /* groen — algemeen */
  --ldcw-accent-dk:    #007a3c;
  --ldcw-spoed:        #e8610a;   /* warm oranje — spoed/direct */
  --ldcw-spoed-dk:     #c04f06;
  --ldcw-danger:       #d32f2f;
  --ldcw-bg:           #f5f8fc;
  --ldcw-white:        #ffffff;
  --ldcw-text:         #1a2b45;
  --ldcw-muted:        #6b7a90;
  --ldcw-border:       #d6e0ef;
  --ldcw-shadow:       0 8px 32px rgba(0,50,120,0.18), 0 2px 8px rgba(0,0,0,0.08);
  --ldcw-radius:       16px;
  --ldcw-panel-w:      370px;
  --ldcw-panel-h:      600px;
  --ldcw-z:            999999;
}

/* ── Root ────────────────────────────────────────────────── */
#ldcw-root {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: var(--ldcw-z);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ldcw-text);
}

/* ── Toggle button ───────────────────────────────────────── */
#ldcw-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--ldcw-primary);
  color: #fff;
  border: none;
  border-radius: 32px;
  padding: 0 20px 0 14px;
  height: 54px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,87,184,0.4);
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  white-space: nowrap;
}
#ldcw-btn:hover {
  background: var(--ldcw-primary-dk);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0,87,184,0.5);
}
#ldcw-btn:active { transform: translateY(0); }

.ldcw-btn-label { font-weight: 600; font-size: 14px; letter-spacing: 0.01em; }

.ldcw-badge {
  position: absolute;
  top: -5px; right: -5px;
  background: #e53935;
  color: #fff;
  font-size: 11px; font-weight: 700;
  width: 20px; height: 20px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff;
  animation: ldcw-pulse 2s infinite;
}
@keyframes ldcw-pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.15); }
}

/* ── Panel ───────────────────────────────────────────────── */
#ldcw-panel {
  position: absolute;
  bottom: 66px; right: 0;
  width: var(--ldcw-panel-w);
  max-height: var(--ldcw-panel-h);
  background: var(--ldcw-bg);
  border-radius: var(--ldcw-radius);
  box-shadow: var(--ldcw-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.92) translateY(16px);
  transform-origin: bottom right;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1), opacity 0.2s ease;
}
#ldcw-panel.ldcw-open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* ── Header ──────────────────────────────────────────────── */
.ldcw-header {
  background: linear-gradient(135deg, var(--ldcw-primary) 0%, #1a6fd4 100%);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.ldcw-header-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.ldcw-header-info { flex: 1; min-width: 0; }
.ldcw-header-name { color: #fff; font-weight: 700; font-size: 15px; }
.ldcw-header-status {
  color: rgba(255,255,255,0.82);
  font-size: 12px;
  display: flex; align-items: center; gap: 5px;
}
.ldcw-dot {
  width: 7px; height: 7px;
  background: #4cff91;
  border-radius: 50%;
  display: inline-block;
}
.ldcw-close-btn {
  background: rgba(255,255,255,0.15);
  border: none; border-radius: 50%;
  width: 32px; height: 32px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
}
.ldcw-close-btn:hover { background: rgba(255,255,255,0.28); }

/* ── Messages ────────────────────────────────────────────── */
.ldcw-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ldcw-messages::-webkit-scrollbar { width: 4px; }
.ldcw-messages::-webkit-scrollbar-thumb { background: var(--ldcw-border); border-radius: 4px; }

.ldcw-msg {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 100%;
  animation: ldcw-fadeup 0.22s ease;
}
@keyframes ldcw-fadeup {
  from { opacity:0; transform: translateY(6px); }
  to   { opacity:1; transform: translateY(0); }
}

.ldcw-msg.ldcw-bot  { align-self: flex-start; }
.ldcw-msg.ldcw-user { align-self: flex-end; flex-direction: row-reverse; }

.ldcw-msg-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.ldcw-bubble {
  padding: 10px 14px;
  border-radius: 18px;
  max-width: 82%;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}
.ldcw-bot .ldcw-bubble {
  background: var(--ldcw-white);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.07);
  color: var(--ldcw-text);
}
.ldcw-user .ldcw-bubble {
  background: var(--ldcw-primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* Typing */
.ldcw-typing .ldcw-bubble { padding: 12px 16px; }
.ldcw-typing-dots { display: flex; gap: 4px; align-items: center; }
.ldcw-typing-dots span {
  width: 7px; height: 7px;
  background: var(--ldcw-muted);
  border-radius: 50%;
  animation: ldcw-dot-bounce 1.2s infinite;
}
.ldcw-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.ldcw-typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes ldcw-dot-bounce {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.5; }
  40%            { transform: scale(1.1); opacity: 1; }
}

.ldcw-bubble a { color: var(--ldcw-primary); text-decoration: underline; }
.ldcw-user .ldcw-bubble a { color: #cce0ff; }

/* Info card */
.ldcw-info-card {
  margin-top: 8px;
  background: #f0f6ff;
  border-left: 3px solid var(--ldcw-primary);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
}
.ldcw-info-card strong { color: var(--ldcw-primary); }

/* ── Telefoonblok ─────────────────────────────────────────── */
.ldcw-phone-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ldcw-phone-cta {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 15px;
  border-radius: 10px;
  text-decoration: none !important;
  color: #fff;
  transition: opacity 0.15s, transform 0.1s;
}
.ldcw-phone-cta:hover { opacity: 0.92; transform: translateY(-1px); }
.ldcw-phone-cta svg  { flex-shrink: 0; }

/* Spoed/direct — warm oranje, hoog contrast */
.ldcw-phone-direct  { background: var(--ldcw-spoed); }
.ldcw-phone-direct:hover { background: var(--ldcw-spoed-dk); }

/* Algemeen/planning — blauw */
.ldcw-phone-general { background: var(--ldcw-primary); }
.ldcw-phone-general:hover { background: var(--ldcw-primary-dk); }

.ldcw-phone-label  { font-size: 11px; font-weight: 500; letter-spacing: 0.03em; text-transform: uppercase; color: #fff !important; opacity: 0.88; }
.ldcw-phone-number { font-weight: 700; font-size: 16px; letter-spacing: 0.02em; color: #fff !important; }

/* ── Quick replies ────────────────────────────────────────── */
.ldcw-quickreplies {
  padding: 4px 12px 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
}

.ldcw-qr-btn {
  background: var(--ldcw-white);
  border: 1.5px solid var(--ldcw-primary);
  color: var(--ldcw-primary);
  border-radius: 20px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.1s;
  white-space: nowrap;
}
.ldcw-qr-btn:hover {
  background: var(--ldcw-primary);
  color: #fff;
  transform: translateY(-1px);
}

/* Primaire knop (bellen) — groen, groter */
.ldcw-qr-btn.ldcw-qr-primary {
  background: var(--ldcw-accent);
  border-color: var(--ldcw-accent);
  color: #fff;
  padding: 9px 18px;
  font-size: 14px;
}
.ldcw-qr-btn.ldcw-qr-primary:hover {
  background: var(--ldcw-accent-dk);
  border-color: var(--ldcw-accent-dk);
  transform: translateY(-1px);
}

/* Secundaire knop (afspraak) — subtiel grijs */
.ldcw-qr-btn.ldcw-qr-secondary {
  background: transparent;
  border-color: var(--ldcw-border);
  color: var(--ldcw-muted);
  font-size: 13px;
}
.ldcw-qr-btn.ldcw-qr-secondary:hover {
  border-color: var(--ldcw-primary);
  color: var(--ldcw-primary);
  background: transparent;
}

/* Danger */
.ldcw-qr-btn.ldcw-qr-danger {
  background: var(--ldcw-danger);
  border-color: var(--ldcw-danger);
  color: #fff;
}

/* ── Inputveld — altijd zichtbaar ─────────────────────────── */
.ldcw-input-area {
  display: flex;
  padding: 8px 12px 12px;
  gap: 8px;
  flex-shrink: 0;
  background: var(--ldcw-bg);
  border-top: 1px solid var(--ldcw-border);
}
.ldcw-input {
  flex: 1;
  border: 1.5px solid var(--ldcw-border);
  border-radius: 22px;
  padding: 9px 16px;
  font-size: 14px;
  outline: none;
  background: var(--ldcw-white);
  color: var(--ldcw-text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.ldcw-input::placeholder { color: var(--ldcw-muted); }
.ldcw-input:focus {
  border-color: var(--ldcw-primary);
  box-shadow: 0 0 0 3px rgba(0,87,184,0.1);
}

/* Formuliermodus: iets prominenter */
.ldcw-input-active .ldcw-input {
  border-color: var(--ldcw-primary);
  background: #f0f6ff;
}

.ldcw-send-btn {
  width: 40px; height: 40px;
  background: var(--ldcw-primary);
  border: none; border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
}
.ldcw-send-btn:hover { background: var(--ldcw-primary-dk); transform: scale(1.05); }

/* ── Samenvatting ─────────────────────────────────────────── */
.ldcw-summary {
  background: #f0f6ff;
  border-radius: 10px;
  padding: 10px 13px;
  font-size: 13px;
  margin-top: 6px;
}
.ldcw-summary-row {
  display: flex;
  gap: 6px;
  padding: 3px 0;
  border-bottom: 1px solid var(--ldcw-border);
}
.ldcw-summary-row:last-child { border-bottom: none; }
.ldcw-summary-label {
  color: var(--ldcw-muted);
  font-weight: 600;
  min-width: 90px;
  flex-shrink: 0;
}

/* ── Bevestig-knop ────────────────────────────────────────── */
.ldcw-submit-btn {
  width: 100%;
  margin-top: 10px;
  padding: 11px;
  background: var(--ldcw-accent);
  color: #fff;
  border: none; border-radius: 10px;
  font-size: 15px; font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.ldcw-submit-btn:hover { background: var(--ldcw-accent-dk); transform: translateY(-1px); }
.ldcw-submit-btn:disabled { background: var(--ldcw-muted); cursor: not-allowed; }

/* ── Mobile ───────────────────────────────────────────────── */
@media (max-width: 480px) {
  /* Knop rechtsonder, vaste positie, overlapt geen tekst */
  #ldcw-root {
    bottom: 100px;
    right: 12px;
    left: auto;
    width: auto;
  }
  /* Verborgen tot scrollen — voorkomt overlap met belknop bovenaan */
  #ldcw-root:not(.ldcw-visible) #ldcw-btn {
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
  }
  #ldcw-root #ldcw-btn {
    transition: opacity 0.6s ease, transform 0.6s ease;
  }
  #ldcw-btn {
    width: fit-content;
    margin-left: auto;
  }
  /* Chatpaneel opent omhoog vanuit de knop, breed maar niet vol */
  #ldcw-panel {
    position: fixed;
    bottom: 168px;
    right: 10px;
    left: 10px;
    width: auto;
    max-height: calc(100dvh - 180px);
    border-radius: 16px;
  }
  .ldcw-bubble { max-width: 88%; }
}

/* ── Input font consistent met chat bubbles ─────────────────── */
.ldcw-input,
.ldcw-input::placeholder {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ldcw-text);
}
.ldcw-input::placeholder {
  color: var(--ldcw-muted);
}
