/* ============================================================
   Elmer Chatbot — Widget Styles
   ============================================================ */

/* ── Dock (collapsed pill button) ── */
.elmer-dock {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px 10px 12px;
  background: #06b6d4;
  color: #fff;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 4px 20px rgba(6, 182, 212, 0.35);
  transition: transform 0.2s, box-shadow 0.2s;
}
.elmer-dock:hover {
  transform: scale(1.04);
  box-shadow: 0 6px 28px rgba(6, 182, 212, 0.45);
}
.elmer-dock-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  padding: 3px;
  flex-shrink: 0;
}
.elmer-dock.hidden { display: none; }

/* ── Panel (expanded chat) ── */
.elmer-panel {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 380px;
  height: 520px;
  z-index: 10000;
  display: none;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  animation: elmerSlideUp 0.2s ease;
}
.elmer-panel.open { display: flex; }

@keyframes elmerSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Header ── */
.elmer-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.5);
  flex-shrink: 0;
}
.elmer-header-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(6, 182, 212, 0.08);
  border: 2px solid #06b6d4;
  padding: 4px;
  flex-shrink: 0;
}
.elmer-header-info { flex: 1; }
.elmer-header-name {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
}
.elmer-header-role {
  font-size: 11px;
  color: #64748b;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 5px;
}
.elmer-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  animation: elmerPulse 2s ease infinite;
}
@keyframes elmerPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.elmer-close {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  background: transparent;
  color: #64748b;
  font-size: 16px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.15s;
}
.elmer-close:hover { background: rgba(15, 23, 42, 0.05); }

/* ── Messages ── */
.elmer-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.elmer-bubble {
  max-width: 84%;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.55;
  border-radius: 14px 14px 14px 4px;
  background: rgba(241, 245, 249, 0.75);
  color: #0f172a;
  align-self: flex-start;
  word-wrap: break-word;
}
.elmer-bubble a {
  color: #06b6d4;
  font-weight: 600;
}
.elmer-bubble-user {
  background: #06b6d4;
  color: #fff;
  border-radius: 14px 14px 4px 14px;
  align-self: flex-end;
}
.elmer-bubble-user a { color: #fff; }

/* ── Typing indicator ── */
.elmer-typing {
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  align-self: flex-start;
}
.elmer-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #94a3b8;
  animation: elmerBounce 1.2s ease infinite;
}
.elmer-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.elmer-typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes elmerBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* ── Suggestions ── */
.elmer-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 12px;
  flex-shrink: 0;
}
.elmer-chip {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #f8fafc;
  color: #334155;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.elmer-chip:hover {
  border-color: #06b6d4;
  color: #06b6d4;
  background: rgba(6, 182, 212, 0.05);
}

/* ── Navigation links in bubbles ── */
.elmer-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #06b6d4;
  text-decoration: none;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.2);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 13px;
  margin: 2px 0;
}
.elmer-nav-link:hover {
  background: rgba(6, 182, 212, 0.15);
  border-color: #06b6d4;
}

/* ── Input bar ── */
.elmer-input-bar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.5);
  flex-shrink: 0;
}
.elmer-textarea {
  flex: 1;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
  font-family: system-ui, -apple-system, sans-serif;
  line-height: 1.4;
  resize: none;
  max-height: 80px;
  outline: none;
  color: #0f172a;
  background: #f8fafc;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.elmer-textarea:focus {
  border-color: #06b6d4;
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.1);
}
.elmer-textarea::placeholder { color: #94a3b8; }
.elmer-send {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #f1f5f9;
  color: #94a3b8;
  font-size: 16px;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: all 0.15s;
}
.elmer-send.active {
  background: #06b6d4;
  border-color: #06b6d4;
  color: #fff;
}
.elmer-send.active:hover { background: #0891b2; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .elmer-panel {
    width: calc(100vw - 32px);
    height: 55vh;
    max-height: 420px;
    bottom: 16px;
    right: 16px;
    border-radius: 14px;
  }
  .elmer-dock { bottom: 16px; right: 16px; font-size: 13px; padding: 8px 16px 8px 10px; }
  .elmer-dock-avatar { width: 24px; height: 24px; }
  .elmer-bubble { max-width: 92%; font-size: 14px; }
  .elmer-chip { font-size: 12px; padding: 6px 10px; }
}

@media (max-width: 400px) {
  .elmer-panel {
    width: calc(100vw - 24px);
    height: 50vh;
    max-height: 360px;
    bottom: 12px;
    right: 12px;
    border-radius: 14px;
  }
  .elmer-dock { bottom: 12px; right: 12px; }
}
