/* widget.css */

/* Theme */
:root {
  --brand: #005686;
  --brand-2: #007eff;
  --bg: #0f1222;
  --panel: rgba(255, 255, 255, 0.18);
  --panel-strong: rgba(255, 255, 255, 0.28);
  --text: #0f1222;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.20);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --ring: 0 0 0 3px rgba(108, 92, 231, 0.18);
}

/* Root & bubble */
.chatbot-root {
  position: fixed;
  right: clamp(12px, 2vw, 22px);
  bottom: calc(clamp(12px, 2vw, 22px) + var(--safe-bottom));
  z-index: 2147483647;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.chatbot-bubble {
  width: clamp(56px, 6.5vw, 42px);
  height: clamp(56px, 6.5vw, 42px);
  border-radius: 18px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  transform-origin: 100% 100%;
  transition: transform .2s ease, border-radius .2s ease;
}

.chatbot-bubble:hover {
  transform: translateY(-1px) scale(1.03);
}

.chatbot-bubble svg {
  width: 28px;
  height: 28px;
  stroke: white;
  fill: none;
  stroke-width: 2;
}

/* Panel */
.chatbot-panel {
  position: absolute;
  width: min(440px, calc(100vw - 24px));
  max-height: min(82vh, 760px);
  background: rgba(255, 255, 255);
  backdrop-filter: blur(14px);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
  right: 0;
  bottom: calc(100% + 12px);
  transform: translateY(12px) scale(0.98);
  opacity: 0;
  pointer-events: none;
}

.chatbot-panel.dragging {
  outline: 2px dashed var(--brand);
  outline-offset: -6px;
}

/* Header */
.chatbot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px;
  background: linear-gradient(175deg, var(--brand), var(--brand-2));
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 14px;
}

.chatbot-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chatbot-header .logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  overflow: hidden;
  background: white;
  display: flex;
  justify-content: center;
  place-items: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .04);
}

.chatbot-header .logo img{
    height:auto !important;
}

.chatbot-header .brand {
  display: flex;
  flex-direction: column;
}

.chatbot-header .brand b {
  line-height: 1.1;
  font-weight: 700;
  color: white;
}

.chatbot-header .brand small {
  color: #fff;
  opacity: .8;
  font-size: 14px;
}

.chatbot-header .controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 0 solid rgba(0, 0, 0, 0.08);
  background: white;
  cursor: pointer;
}

.icon-btn:hover {
  box-shadow: var(--ring);
}

/* Body */
.chatbot-body {
  padding: clamp(12px, 2vh, 16px);
  overflow: auto;
  max-height: calc(min(82vh, 760px) - 255px);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(255, 255, 255, 0.92));
  scroll-behavior: smooth;
}

/* Messages */
.chatbot-msg {
  display: flex;
  gap: 10px;
  margin: 10px 0;
}

.chatbot-msg .bubble {
  width: auto;
  max-width: 75%;
  padding: clamp(10px, 1.6vh, 14px) clamp(12px, 1.8vh, 16px);
  border-radius: 18px;
  line-height: 1.65;
  font-size: 14px;
  background: white;
  border: 1px solid rgba(0, 0, 0, .06);
  word-wrap: break-word;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .03);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chatbot-msg.user {
  justify-content: flex-end;
}

.chatbot-msg.user .bubble {
  background: #0f1222;
  color: white;
  border-color: #0f1222;
  border-bottom-right-radius: 8px;
}

.chatbot-msg.assistant .bubble {
  background: #fff;
  border-color: rgba(0, 0, 0, .06);
  border-bottom-left-radius: 8px;
}

/* Rendered markdown */
.bubble-text p {
  font-size: 14px;
  color: #000;
  font-weight: 400;
  margin: 0px 0;
}

.bubble-text h1,
.bubble-text h2,
.bubble-text h3 {
  margin: 8px 0 6px;
  line-height: 1.28;
}

.bubble-text h1 {
  font-size: 18px;
}

.bubble-text h2 {
  font-size: 16px;
}

.bubble-text h3 {
  font-size: 15px;
}

.bubble-text ul,
.bubble-text ol {
  margin: 8px 0 10px 18px;
  padding-left: 18px;
}

.bubble-text ul {
  list-style: disc;
}

.bubble-text ol {
  list-style: decimal;
}

.bubble-text li {
  margin: 6px 0;
}

/* Price highlight */
.bubble-text mark.price,
.bubble-text .price {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border-radius: 6px;
  padding: 0 .3em;
  font-weight: 700;
  color: #fff;
  box-decoration-break: clone;
}

/* Footer & input */
.chatbot-footer {
  padding: 10px;
  border-top: 1px solid rgba(0, 0, 0, .06);
  background: rgba(255, 255, 255, .92);
}

.chatbot-input {
  display: flex;
  gap: 8px;
  align-items: center;
  border: 1px solid rgba(0, 0, 0, .08);
  background: white;
  border-radius: 16px;
  padding: 6px 6px;
}

.chatbot-input:focus-within {
  box-shadow: var(--ring);
}

.chatbot-input input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 14px;
  background: transparent;
  padding: 8px 6px;
}

/* Send button */
.action-btn {
  border: none;
  padding: 10px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  box-shadow: 0 6px 16px rgba(108, 92, 231, 0.22);
}

.action-btn:hover {
  transform: translateY(-1px);
}

.action-btn:active {
  transform: translateY(0);
}

/* Quick chips */
.quick-chips {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  flex-wrap: wrap;
  background-color: white;
}

.chip {
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #f2f2f7;
  cursor: pointer;
  border: 1px solid rgba(0, 0, 0, .05);
}

.chip:hover {
  background: #ececf4;
}

/* Typing dots */
.typing {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #999;
  opacity: .5;
  animation: blink 1.2s infinite;
}

.dot:nth-child(2) {
  animation-delay: .2s
}

.dot:nth-child(3) {
  animation-delay: .4s
}

@keyframes blink {

  0%,
  60% {
    opacity: .2
  }

  30% {
    opacity: 1
  }
}

/* Layout tweaks */
@media (max-width: 520px) {
  .chatbot-panel {
    width: calc(100vw - 45px);
    right: 10px;
    max-height: calc(100vh - 90px - var(--safe-bottom));
    bottom: calc(75px + var(--safe-bottom));
  }

  .chatbot-body {
    max-height: calc(65vh - 130px - var(--safe-bottom));
    overflow-y: auto;
  }

  .quick-chips {
    padding-bottom: 8px;
  }

  .chatbot-msg {
    gap: 8px;
  }

  .chatbot-msg .bubble {
    padding: 10px;
    font-size: 14px;
  }
}

/* RTL */
[dir="rtl"] .chatbot-msg.user {
  justify-content: flex-start;
}

[dir="rtl"] .chatbot-msg .bubble {
  text-align: right;
}

/* Page defaults */
body {
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Optional demo hero */
.demo-hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(108, 92, 231, 0.15), transparent),
    radial-gradient(800px 400px at 10% 110%, rgba(0, 184, 148, 0.15), transparent);
  padding: 20px;
}

.demo-card {
  max-width: fit-content;
  background: white;
  border-radius: 20px;
  padding: 32px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .08);
  width: 100%;
  margin: 0 16px;
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  overflow: auto;
}

.modal-content {
  background-color: #fefefe;
  margin: 5% auto;
  padding: 20px;
  border: 1px solid #888;
  width: 80%;
  max-width: 600px;
  border-radius: 10px;
  position: relative;
}

.close-btn {
  color: #aaa;
  font-size: 28px;
  font-weight: bold;
  position: absolute;
  right: 20px;
  top: 20px;
  cursor: pointer;
  border: 0px;
  background-color: #fff;
}

.close-btn:hover,
.close-btn:focus {
  color: black;
  text-decoration: none;
  cursor: pointer;
}

/* Book demo form */
.book-demo-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.book-demo-form label {
  font-size: 14px;
  color: #333;
}

.book-demo-form input,
.book-demo-form select,
.book-demo-form textarea {
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 10px;
  font-size: 14px;
  width: auto;
}

.book-demo-form textarea {
  resize: vertical;
  min-height: 80px;
}

.book-demo-form button {
  padding: 10px 14px;
  background-color: var(--brand);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.book-demo-form button:hover {
  background-color: var(--brand-2);
}

/* ===== APPENDED: badge + nudge (like screenshot) ===== */
#chat-toggle {
  position: relative;
}

.chatbot-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 700;
  border: 2px solid #fff;
  box-shadow: var(--shadow);
}

.chatbot-nudge {
  position: absolute;
  right: calc(56px + 12px);
  bottom: 6px;
  width: 260px;
  padding: 14px 16px;
  background: #fff;
  color: #0f1222;
  border-radius: 14px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(0, 0, 0, .06);
  font-size: 14px;
  line-height: 1.45;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 1;
  opacity: 0;
  display: none;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}

/* lucide icon inside the nudge close button */
.chatbot-nudge .nudge-close svg {
  width: 28px;
  height: 28px;
  stroke: currentColor; /* inherits the button color */
}

.chatbot-nudge.show {
  opacity: 1;
  display:flex;
  transform: translateY(0);
  pointer-events: auto;
}

.chatbot-nudge::after {
  content: "";
  position: absolute;
  right: -6px;
  bottom: 12px;
  width: 12px;
  height: 12px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, .06);
  transform: rotate(45deg);
  box-shadow: 1px 1px 6px rgba(0, 0, 0, .08);
}

.chatbot-nudge .nudge-close {
  position: absolute;
  top: -10px;
  left: -10px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, .08);
  display: flex;
  place-items: center;
  font-size: 14px;
  color: #666;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
}

.chatbot-nudge .nudge-close:hover {
  color: #111;
}

@media (max-width:520px) {
  .chatbot-nudge {
    right: 0;
    bottom: 70px;
    max-width: 70vw;
  }

  .chatbot-nudge::after {
    right: 18px;
    bottom: -6px;
  }
}