/* RunBy Chat Widget — Styles */
.runby-chat-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FF3838, #D40000);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(255, 56, 56, 0.4);
  z-index: 9999;
  transition: transform 0.2s, box-shadow 0.2s;
}
.runby-chat-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(255, 56, 56, 0.55);
}
.runby-chat-toggle svg { width: 26px; height: 26px; fill: #fff; }
.runby-chat-toggle .chat-close { display: none; }
.runby-chat-toggle.open .chat-open { display: none; }
.runby-chat-toggle.open .chat-close { display: block; }

.runby-chat-window {
  position: fixed;
  bottom: 92px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 48px);
  height: 520px;
  max-height: calc(100vh - 120px);
  background: rgba(14, 14, 26, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  z-index: 9998;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  backdrop-filter: blur(20px);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
}
.runby-chat-window.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.runby-chat-header {
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(255, 56, 56, 0.15), rgba(212, 0, 0, 0.08));
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  gap: 10px;
}
.runby-chat-header-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  animation: chatPulse 2s infinite;
}
@keyframes chatPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.runby-chat-header-text {
  font-size: 0.88rem;
  font-weight: 600;
  color: #fff;
}
.runby-chat-header-sub {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.5);
  font-weight: 400;
}

.runby-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.runby-chat-messages::-webkit-scrollbar { width: 4px; }
.runby-chat-messages::-webkit-scrollbar-track { background: transparent; }
.runby-chat-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.runby-chat-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.85rem;
  line-height: 1.5;
  word-wrap: break-word;
  animation: chatMsgIn 0.2s ease-out;
}
@keyframes chatMsgIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.runby-chat-msg.bot {
  background: rgba(67, 97, 238, 0.15);
  color: rgba(255, 255, 255, 0.9);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.runby-chat-msg.bot strong {
  color: #fff;
}
.runby-chat-msg.user {
  background: linear-gradient(135deg, #FF3838, #D40000);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.runby-chat-msg.typing {
  background: rgba(67, 97, 238, 0.1);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  display: flex;
  gap: 4px;
  padding: 12px 18px;
}
.runby-chat-msg.typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  animation: typingBounce 1.2s infinite;
}
.runby-chat-msg.typing span:nth-child(2) { animation-delay: 0.15s; }
.runby-chat-msg.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-4px); }
}

/* ---- CTA Action Buttons ---- */
.runby-chat-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 85%;
  align-self: flex-start;
  animation: chatMsgIn 0.2s ease-out;
}

.runby-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 10px;
  background: rgba(67, 97, 238, 0.2);
  border: 1px solid rgba(67, 97, 238, 0.3);
  color: #7B93FF;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.runby-action-btn:hover {
  background: rgba(67, 97, 238, 0.35);
  transform: translateY(-1px);
}

.runby-action-btn.accent {
  background: linear-gradient(135deg, rgba(255, 56, 56, 0.2), rgba(212, 0, 0, 0.15));
  border-color: rgba(255, 56, 56, 0.35);
  color: #FF6B6B;
}
.runby-action-btn.accent:hover {
  background: linear-gradient(135deg, rgba(255, 56, 56, 0.35), rgba(212, 0, 0, 0.25));
}

/* ---- Quick Reply Chips ---- */
.runby-chat-quickreplies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 16px 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.runby-quick-btn {
  padding: 7px 12px;
  background: rgba(255, 56, 56, 0.08);
  border: 1px solid rgba(255, 56, 56, 0.2);
  border-radius: 16px;
  color: #FF6B6B;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.runby-quick-btn:hover {
  background: rgba(255, 56, 56, 0.18);
  border-color: rgba(255, 56, 56, 0.4);
}

/* ---- Input Area ---- */
.runby-chat-input-wrap {
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  gap: 8px;
}
.runby-chat-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 10px 14px;
  color: #fff;
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.runby-chat-input::placeholder { color: rgba(255,255,255,0.3); }
.runby-chat-input:focus { border-color: #FF3838; }
.runby-chat-send {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #FF3838, #D40000);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s, transform 0.15s;
  flex-shrink: 0;
}
.runby-chat-send:hover { transform: translateY(-1px); }
.runby-chat-send:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.runby-chat-send svg { width: 16px; height: 16px; fill: #fff; }

/* ---- Nudge Bubble ---- */
.runby-chat-nudge {
  position: fixed;
  bottom: 88px;
  right: 24px;
  background: rgba(14, 14, 26, 0.95);
  border: 1px solid rgba(255, 56, 56, 0.25);
  border-radius: 12px;
  padding: 10px 16px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.82rem;
  font-weight: 500;
  z-index: 9997;
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s, transform 0.3s;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(12px);
}
.runby-chat-nudge.visible {
  opacity: 1;
  transform: translateY(0);
}
.runby-chat-nudge:hover {
  border-color: rgba(255, 56, 56, 0.5);
}

/* ---- Mobile Fullscreen ---- */
@media (max-width: 480px) {
  .runby-chat-window {
    bottom: 0;
    right: 0;
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
  .runby-chat-toggle.open {
    bottom: 12px;
    right: 12px;
    z-index: 10000;
  }
}

/* ---- Mobile ---- */
@media (max-width: 480px) {
  .runby-chat-window {
    bottom: 0;
    right: 0;
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
  .runby-chat-nudge {
    right: 12px;
    bottom: 82px;
  }
}
