/**
 * Reha & Care Chatbot Widget — chatbot.css
 * Standalone stylesheet — no dependency on style.css
 * Rewritten 2026-03-21 for clean, professional healthcare look.
 *
 * Brand colors:
 *   Primary:  #014FA1
 *   Dark:     #013670
 *   Accent:   #014FA1 (no red — consistent blue throughout)
 *   BG body:  #f5f7fa
 */

/* ── Reset scope ──────────────────────────────────────────────────────────── */
#rc-chatbot-widget *,
#rc-chatbot-widget *::before,
#rc-chatbot-widget *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── CSS variables ────────────────────────────────────────────────────────── */
#rc-chatbot-widget {
  --rc-primary:       #014FA1;
  --rc-primary-dark:  #013670;
  --rc-white:         #ffffff;
  --rc-bg-messages:   #f5f7fa;
  --rc-border:        #e2e6ea;
  --rc-text:          #1c2a3a;
  --rc-text-light:    #6b7a8d;
  --rc-shadow:        0 8px 32px rgba(1, 54, 112, 0.16);
  --rc-radius:        16px;
  --rc-bubble-radius: 18px;
  font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
}

/* ── Launcher button ──────────────────────────────────────────────────────── */
#rc-launcher {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

#rc-launcher-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--rc-primary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(1, 79, 161, 0.38);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  position: relative;
  outline: none;
}

#rc-launcher-btn:hover {
  background: var(--rc-primary-dark);
  transform: scale(1.06);
  box-shadow: 0 6px 22px rgba(1, 79, 161, 0.48);
}

#rc-launcher-btn:active {
  transform: scale(0.95);
}

.rc-avatar-text {
  color: var(--rc-white);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.5px;
  user-select: none;
}

.rc-close-icon {
  display: none;
  color: var(--rc-white);
  font-size: 20px;
  line-height: 1;
}

#rc-chatbot-widget.rc-open .rc-avatar-text { display: none; }
#rc-chatbot-widget.rc-open .rc-close-icon  { display: block; }

/* Notification badge */
#rc-notification-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 16px;
  height: 16px;
  background: #e53e3e;
  border-radius: 50%;
  border: 2px solid white;
  display: none;
}

#rc-notification-badge.rc-visible {
  display: block;
  animation: rc-badge-pulse 1.5s infinite;
}

@keyframes rc-badge-pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.2); }
}

/* Proactive bubble */
#rc-proactive-bubble {
  background: var(--rc-white);
  color: var(--rc-text);
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: 0 3px 14px rgba(1, 54, 112, 0.14);
  border: 1px solid var(--rc-border);
  white-space: nowrap;
  display: none;
  animation: rc-fade-in 0.3s ease;
  position: relative;
  cursor: pointer;
}

#rc-proactive-bubble.rc-visible {
  display: block;
}

#rc-proactive-bubble::after {
  content: '';
  position: absolute;
  bottom: -7px;
  right: 18px;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 7px solid var(--rc-white);
}

#rc-proactive-dismiss {
  margin-left: 8px;
  color: var(--rc-text-light);
  font-size: 11px;
  cursor: pointer;
  opacity: 0.6;
}

#rc-proactive-dismiss:hover { opacity: 1; }

/* ── Chat window ──────────────────────────────────────────────────────────── */
#rc-chat-window {
  position: fixed;
  bottom: 96px;
  right: 28px;
  width: 370px;
  height: 540px;
  background: var(--rc-white);
  border-radius: var(--rc-radius);
  box-shadow: var(--rc-shadow);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 9998;
  border: 1px solid var(--rc-border);
  animation: rc-slide-up 0.26s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#rc-chatbot-widget.rc-open #rc-chat-window {
  display: flex;
}

@keyframes rc-slide-up {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Header (compact 52px) ────────────────────────────────────────────────── */
#rc-header {
  background: var(--rc-primary);
  color: var(--rc-white);
  height: 52px;
  min-height: 52px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.rc-header-avatar {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.rc-header-info {
  flex: 1;
  min-width: 0;
}

.rc-header-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rc-header-status {
  font-size: 11.5px;
  opacity: 0.82;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}

.rc-status-dot {
  width: 6px;
  height: 6px;
  background: #68d391;
  border-radius: 50%;
  flex-shrink: 0;
  animation: rc-status-pulse 2s infinite;
}

@keyframes rc-status-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.45; }
}

#rc-header-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.65);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  line-height: 1;
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
}

#rc-header-close:hover {
  color: var(--rc-white);
  background: rgba(255, 255, 255, 0.15);
}

/* ── Messages area ────────────────────────────────────────────────────────── */
#rc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
  background: var(--rc-bg-messages);
}

#rc-messages::-webkit-scrollbar { width: 4px; }
#rc-messages::-webkit-scrollbar-track { background: transparent; }
#rc-messages::-webkit-scrollbar-thumb {
  background: #d0d8e4;
  border-radius: 4px;
}

/* ── Message rows ─────────────────────────────────────────────────────────── */
.rc-msg-row {
  display: flex;
  align-items: flex-end;
  gap: 7px;
  animation: rc-fade-in 0.22s ease;
}

@keyframes rc-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* User rows: reverse so bubble is on the right */
.rc-msg-row.rc-user {
  flex-direction: row-reverse;
}

/* ── Message avatars ──────────────────────────────────────────────────────── */

/* Bot avatar: small (28px), left of bubble */
.rc-msg-avatar {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 50%;
  background: var(--rc-primary);
  color: white;
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0.3px;
}

/* Hide user avatar completely — no person emoji clutter */
.rc-msg-row.rc-user .rc-msg-avatar {
  display: none !important;
}

/* ── Bubbles ──────────────────────────────────────────────────────────────── */
.rc-bubble {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: var(--rc-bubble-radius);
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--rc-text);
  word-break: break-word;
}

/* Bot bubble: white, subtle border, left-aligned */
.rc-msg-row.rc-bot .rc-bubble {
  background: #ffffff;
  color: var(--rc-text);
  border-radius: 4px 18px 18px 18px;
  border: 1px solid var(--rc-border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* User bubble: brand blue, white text, right-aligned, no avatar gap */
.rc-msg-row.rc-user .rc-bubble {
  background: var(--rc-primary);
  color: #ffffff;
  border-radius: 18px 18px 4px 18px;
  border: none;
  margin-left: auto;
}

.rc-bubble a {
  color: var(--rc-primary);
  text-decoration: underline;
}

.rc-msg-row.rc-user .rc-bubble a {
  color: rgba(255, 255, 255, 0.88);
}

/* Strong tags in bot bubbles */
.rc-msg-row.rc-bot .rc-bubble strong {
  color: var(--rc-primary-dark);
}

/* ── Typing indicator ─────────────────────────────────────────────────────── */
#rc-typing-indicator { display: none; }
#rc-typing-indicator.rc-visible { display: flex; }

.rc-typing-dots {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 3px 2px;
}

.rc-typing-dots span {
  width: 6px;
  height: 6px;
  background: var(--rc-text-light);
  border-radius: 50%;
  animation: rc-bounce 1.2s infinite;
}

.rc-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.rc-typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes rc-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40%            { transform: translateY(-5px); opacity: 1; }
}

/* ── Quick action buttons ─────────────────────────────────────────────────── */
.rc-quick-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

/* All buttons: clean white pills, blue border + text */
.rc-quick-btn {
  background: #ffffff !important;
  color: var(--rc-primary) !important;
  border: 1.5px solid var(--rc-primary) !important;
  border-radius: 20px !important;
  padding: 6px 14px !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.3;
  transition: background 0.15s, color 0.15s;
}

.rc-quick-btn:hover {
  background: var(--rc-primary) !important;
  color: #ffffff !important;
}

/* Override red accent — make lead/phone buttons the same blue style */
.rc-quick-btn.rc-btn-accent {
  background: #ffffff !important;
  color: var(--rc-primary) !important;
  border-color: var(--rc-primary) !important;
}

.rc-quick-btn.rc-btn-accent:hover {
  background: var(--rc-primary) !important;
  color: #ffffff !important;
}

/* Disabled state (after click) */
.rc-quick-btn:disabled {
  opacity: 0.45;
  cursor: default !important;
  pointer-events: none;
}

/* Muted variant */
.rc-quick-btn.rc-btn-muted {
  border-color: var(--rc-border) !important;
  color: var(--rc-text-light) !important;
}

.rc-quick-btn.rc-btn-muted:hover {
  background: #f0f4f8 !important;
  color: var(--rc-text) !important;
}

/* ── DSGVO disclaimer ─────────────────────────────────────────────────────── */
.rc-disclaimer {
  font-size: 11.5px;
  color: #3a5a8a;
  background: #eef4fb;
  border: 1px solid #c8ddf5;
  border-radius: 8px;
  padding: 9px 12px;
  line-height: 1.5;
  width: 100%;
}

.rc-disclaimer a {
  color: var(--rc-primary);
  text-decoration: underline;
}

/* ── Lead mini-form ───────────────────────────────────────────────────────── */
.rc-lead-form-input {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--rc-border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  margin-top: 8px;
  outline: none;
  transition: border-color 0.15s;
  color: var(--rc-text);
  background: var(--rc-white);
}

.rc-lead-form-input:focus {
  border-color: var(--rc-primary);
}

/* ── Input area ───────────────────────────────────────────────────────────── */
#rc-input-area {
  padding: 10px 12px;
  border-top: 1px solid var(--rc-border);
  display: flex;
  gap: 8px;
  background: #ffffff;
  flex-shrink: 0;
  align-items: flex-end;
}

#rc-input {
  flex: 1;
  border: 1.5px solid var(--rc-border);
  border-radius: 20px;
  padding: 9px 15px;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  color: var(--rc-text);
  background: #f8f9fb;
  resize: none;
  min-height: 38px;
  max-height: 96px;
  line-height: 1.4;
  transition: border-color 0.15s, background 0.15s;
}

#rc-input:focus {
  border-color: var(--rc-primary);
  background: #ffffff;
}

#rc-input::placeholder {
  color: var(--rc-text-light);
}

#rc-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--rc-primary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.12s;
}

#rc-send-btn:hover {
  background: var(--rc-primary-dark);
  transform: scale(1.06);
}

#rc-send-btn:active {
  transform: scale(0.93);
}

#rc-send-btn svg {
  width: 17px;
  height: 17px;
  fill: white;
}

/* ── Mobile ───────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  #rc-chat-window {
    right: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 88vh;
    max-height: 620px;
    border-radius: var(--rc-radius) var(--rc-radius) 0 0;
  }

  #rc-launcher {
    bottom: 18px;
    right: 18px;
  }
}
