/* ObX Historian Chatbot Widget Styles */

/* Floating chat button */
.obx-chat-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9998;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f97316, #f59e0b);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 24px rgba(249, 115, 22, 0.4), 0 0 0 0 rgba(249, 115, 22, 0.3);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: obx-pulse 2.5s infinite;
}

.obx-chat-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 32px rgba(249, 115, 22, 0.5);
}

.obx-chat-btn:active {
  transform: scale(0.95);
}

.obx-chat-btn svg {
  width: 28px;
  height: 28px;
  color: white;
  transition: transform 0.3s ease;
}

.obx-chat-btn.open svg {
  transform: rotate(90deg);
}

@keyframes obx-pulse {
  0%, 100% { box-shadow: 0 4px 24px rgba(249, 115, 22, 0.4), 0 0 0 0 rgba(249, 115, 22, 0.3); }
  50% { box-shadow: 0 4px 24px rgba(249, 115, 22, 0.4), 0 0 0 12px rgba(249, 115, 22, 0); }
}

/* Chat panel */
.obx-chat-panel {
  position: fixed;
  bottom: 100px;
  right: 24px;
  z-index: 9999;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 140px);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: rgba(10, 10, 10, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 1px rgba(255, 255, 255, 0.1);
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.obx-chat-panel.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Chat header */
.obx-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.obx-chat-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.obx-chat-avatar {
  width: 36px;
  height: 36px;
  background: none;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.obx-chat-title {
  font-size: 15px;
  font-weight: 600;
  color: #ffffff;
  line-height: 1.2;
}

.obx-chat-subtitle {
  font-size: 11px;
  color: #9ca3af;
  line-height: 1.2;
  margin-top: 1px;
}

.obx-chat-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  color: #9ca3af;
}

.obx-chat-close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.obx-chat-close svg {
  width: 18px;
  height: 18px;
}

/* Messages area */
.obx-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(249, 115, 22, 0.3) transparent;
}

.obx-chat-messages::-webkit-scrollbar {
  width: 4px;
}

.obx-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.obx-chat-messages::-webkit-scrollbar-thumb {
  background: rgba(249, 115, 22, 0.3);
  border-radius: 2px;
}

/* Message bubbles */
.obx-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.55;
  word-break: break-word;
  animation: obx-msgIn 0.3s ease;
}

@keyframes obx-msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.obx-msg.bot {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: #e5e7eb;
  border-bottom-left-radius: 4px;
}

.obx-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: white;
  border-bottom-right-radius: 4px;
}

/* Typing indicator */
.obx-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  animation: obx-msgIn 0.3s ease;
}

.obx-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f97316;
  animation: obx-dot 1.4s infinite ease-in-out;
}

.obx-typing span:nth-child(2) { animation-delay: 0.2s; }
.obx-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes obx-dot {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

/* Quick replies */
.obx-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 12px;
  flex-shrink: 0;
}

.obx-quick-btn {
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid rgba(249, 115, 22, 0.3);
  background: rgba(249, 115, 22, 0.08);
  color: #f97316;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  font-family: inherit;
}

.obx-quick-btn:hover {
  background: rgba(249, 115, 22, 0.2);
  border-color: rgba(249, 115, 22, 0.5);
}

/* Input area */
.obx-chat-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
  flex-shrink: 0;
}

.obx-chat-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 10px 14px;
  color: #ffffff;
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}

.obx-chat-input::placeholder {
  color: #6b7280;
}

.obx-chat-input:focus {
  border-color: rgba(249, 115, 22, 0.4);
}

.obx-chat-send {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #f97316, #f59e0b);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
  color: white;
}

.obx-chat-send:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 12px rgba(249, 115, 22, 0.4);
}

.obx-chat-send:active {
  transform: scale(0.95);
}

.obx-chat-send svg {
  width: 18px;
  height: 18px;
}

/* Links inside bot messages */
.obx-msg.bot a {
  color: #f97316;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.obx-msg.bot a:hover {
  color: #f59e0b;
}

/* Mobile responsive */
@media (max-width: 480px) {
  .obx-chat-panel {
    bottom: 0;
    right: 0;
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }

  .obx-chat-btn {
    bottom: 16px;
    right: 16px;
    width: 54px;
    height: 54px;
  }

  .obx-chat-btn svg {
    width: 24px;
    height: 24px;
  }
}
