/* Benjuriy custom chat widget (isolated styles) */
#benj-chat-widget,
#benj-chat-widget * {
  box-sizing: border-box;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

#benj-chat-widget {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 999999;
}

/* Floating button */
#benj-chat-fab {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: #d85a6e;
  color: #fff;
  font-size: 24px;
  box-shadow: 0 10px 30px rgba(0,0,0,.18);
  position: relative; /* for badge */
}

/* Unread badge */
.benj-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #ff3b30;
  color: #fff;
  font-size: 12px;
  line-height: 20px;
  text-align: center;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(0,0,0,.18);
}

#benj-chat-panel {
  position: absolute;
  right: 0;
  bottom: 76px;
  width: 360px;
  height: 520px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 18px 55px rgba(0,0,0,.22);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.benj-hidden {
  display: none !important;
}

/* Header */
#benj-chat-header {
  background: #0f1433;
  color: #fff;
  padding: 14px 14px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.benj-chat-title {
  font-size: 18px;
  font-weight: 700;
}

#benj-chat-close {
  border: none;
  background: transparent;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  opacity: .9;
}

#benj-chat-subtitle {
  background: #0f1433;
  color: rgba(255,255,255,.86);
  padding: 0 14px 12px;
  font-size: 13px;
}

/* Messages area */
#benj-chat-messages {
  flex: 1;
  overflow: auto;
  padding: 14px;
  background: #f6f7fb;
}

.benj-row {
  display: flex;
  margin: 8px 0;
}

.benj-row.user { justify-content: flex-end; }
.benj-row.agent { justify-content: flex-start; }

.benj-bubble {
  max-width: 82%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
}

.benj-row.user .benj-bubble {
  background: #52b7a3;
  color: #fff;
  border-bottom-right-radius: 6px;
}

.benj-row.agent .benj-bubble {
  background: #fff;
  color: #111;
  border: 1px solid #e7e7e7;
  border-bottom-left-radius: 6px;
}

/* Input bar */
#benj-chat-inputbar {
  display: flex;
  gap: 10px;
  padding: 12px;
  background: #fff;
  border-top: 1px solid #e9e9ef;
}

#benj-chat-input {
  flex: 1;
  border: 1px solid #e1e1ea;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
}

#benj-chat-send {
  width: 44px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  background: #0f1433;
  color: #fff;
  font-size: 16px;
}

/* Toast (Nuevo mensaje) */
#benj-chat-toast {
  position: fixed;
  right: 18px;
  bottom: 92px; /* above the FAB */
  z-index: 1000000;
  background: rgba(15, 20, 51, 0.96);
  color: #fff;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  box-shadow: 0 18px 55px rgba(0,0,0,.22);
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

#benj-chat-toast .benj-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #52b7a3;
  flex: 0 0 auto;
}

#benj-chat-toast .benj-toast-title {
  font-weight: 700;
  margin-right: 6px;
}

/* Mobile */
@media (max-width: 420px) {
  #benj-chat-panel {
    width: calc(100vw - 24px);
    height: 70vh;
    right: 0;
  }
}
