/* ============================================================
   Oodles AI Chatbot Widget — chatbot.css
   All class names are prefixed with "ocb-" to avoid conflicts
   with any existing WordPress / theme styles.
   ============================================================ */

/* ---- Trigger button ---------------------------------------- */
.ocb-trigger {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3B94E0, #185E95);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(47, 131, 197, 0.4);
  z-index: 10000;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0;
}

.ocb-trigger:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(47, 131, 197, 0.5);
}

.ocb-trigger.open {
  transform: scale(0.9);
  background: linear-gradient(135deg, #64748b, #475569);
}

.ocb-trigger-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
}

.ocb-unread-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 16px;
  height: 16px;
  background: #ef4444;
  border-radius: 50%;
  border: 2px solid #fff;
  animation: ocb-pulse-badge 2s infinite;
}

/* ---- Chat window ------------------------------------------- */
.ocb-window {
  position: fixed;
  bottom: 100px;
  right: 24px;
  background: #f8fafc;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: 'Poppins', sans-serif;
}

.ocb-window.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

@media (max-width: 480px) {
  .ocb-window {
    width: calc(100vw - 16px) !important;
    height: calc(100vh - 120px) !important;
    right: 8px;
    bottom: 90px;
    border-radius: 12px;
  }
}

/* ---- Header ----------------------------------------------- */
.ocb-header {
  background: linear-gradient(135deg, #2f83c5, #185E95);
  color: #fff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.ocb-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ocb-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ocb-header-text {
  display: flex;
  flex-direction: column;
}

.ocb-header-title {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.ocb-header-status {
  font-size: 11px;
  opacity: 0.75;
  display: flex;
  align-items: center;
  gap: 4px;
}

.ocb-header-status.online::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ade80;
  display: inline-block;
}

.ocb-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ocb-header-btn {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 500;
  font-family: 'Poppins', sans-serif;
  white-space: nowrap;
  transition: background 0.2s;
}

.ocb-header-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.ocb-close-btn {
  width: 30px;
  padding: 0;
  font-size: 16px;
}

/* ---- Message body ------------------------------------------ */
.ocb-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ocb-body::-webkit-scrollbar        { width: 5px; }
.ocb-body::-webkit-scrollbar-track  { background: transparent; }
.ocb-body::-webkit-scrollbar-thumb  { background: #cbd5e1; border-radius: 10px; }

/* ---- Message wrappers ------------------------------------- */
.ocb-message-wrapper {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  max-width: 88%;
  animation: ocb-fadeInUp 0.3s ease;
}

.ocb-message-wrapper.user      { align-self: flex-end;  flex-direction: row-reverse; }
.ocb-message-wrapper.assistant { align-self: flex-start; }

.ocb-message-avatar {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, #EFF8FF, #dceffe);
  color: #2f83c5;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

/* ---- Bubbles ---------------------------------------------- */
.ocb-message-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.55;
  word-wrap: break-word;
  max-width: 100%;
}

.ocb-message-wrapper.user .ocb-message-bubble {
  background: #2f83c5;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.ocb-message-wrapper.assistant .ocb-message-bubble {
  background: #fff;
  color: #1a1a2e;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 4px;
}

.ocb-message-bubble strong { font-weight: 600; }
.ocb-message-bubble em     { font-style: italic; }

.ocb-message-bubble a {
  color: #2f83c5;
  text-decoration: underline;
  word-break: break-all;
}

.ocb-message-bubble a:hover { color: #1a5f9a; }

/* ---- Markdown code ---------------------------------------- */
.ocb-code-block {
  background: #1e293b;
  color: #e2e8f0;
  padding: 12px 14px;
  border-radius: 8px;
  font-family: 'SF Mono', 'Fira Code', 'Courier New', monospace;
  font-size: 12px;
  overflow-x: auto;
  margin: 8px 0;
  line-height: 1.5;
  white-space: pre-wrap;
}

.ocb-inline-code {
  background: #f1f5f9;
  color: #e11d48;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'SF Mono', 'Fira Code', 'Courier New', monospace;
  font-size: 12px;
}

/* ---- Typing indicator ------------------------------------- */
.ocb-typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 18px !important;
}

.ocb-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94a3b8;
  display: inline-block;
  animation: ocb-typing-bounce 1.4s infinite ease-in-out;
}

.ocb-dot:nth-child(2) { animation-delay: 0.2s; }
.ocb-dot:nth-child(3) { animation-delay: 0.4s; }

/* ---- Footer / input area ---------------------------------- */
.ocb-footer {
  padding: 12px 16px;
  border-top: 1px solid #e2e8f0;
  background: #fff;
  flex-shrink: 0;
}

/* ---- File preview bar ------------------------------------- */
.ocb-file-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  margin-bottom: 8px;
  background: #EFF8FF;
  border: 1px solid rgba(47, 131, 197, 0.2);
  border-radius: 8px;
  font-size: 12px;
  color: #1a1a2e;
  animation: ocb-fadeInUp 0.2s ease;
}

.ocb-file-preview-info {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  min-width: 0;
}

.ocb-file-preview-info svg { color: #2f83c5; flex-shrink: 0; }

.ocb-file-name {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.ocb-file-size { color: #64748b; flex-shrink: 0; }

.ocb-file-remove {
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
  flex-shrink: 0;
}

.ocb-file-remove:hover { color: #ef4444; background: rgba(239, 68, 68, 0.1); }

/* ---- Upload progress bar ---------------------------------- */
.ocb-upload-progress {
  height: 3px;
  background: rgba(47, 131, 197, 0.1);
  border-radius: 2px;
  margin-bottom: 8px;
  overflow: hidden;
}

.ocb-upload-bar {
  height: 100%;
  background: linear-gradient(90deg, #2f83c5, #3B94E0);
  border-radius: 2px;
  animation: ocb-upload-slide 1.5s infinite;
}

/* ---- Input row -------------------------------------------- */
.ocb-input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 6px 6px 6px 8px;
  transition: border-color 0.2s;
}

.ocb-input-wrapper:focus-within {
  border-color: #2f83c5;
  box-shadow: 0 0 0 3px rgba(47, 131, 197, 0.1);
}

.ocb-attach-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
  padding: 0;
}

.ocb-attach-btn:hover:not(:disabled) { color: #2f83c5; background: rgba(47, 131, 197, 0.08); }
.ocb-attach-btn:disabled             { opacity: 0.3; cursor: not-allowed; }

.ocb-chat-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: 'Poppins', sans-serif;
  font-size: 13.5px;
  resize: none;
  max-height: 80px;
  line-height: 1.4;
  padding: 6px 0;
  color: #1a1a2e;
  overflow-y: auto;
}

.ocb-chat-input::placeholder { color: #94a3b8; }
.ocb-chat-input:disabled     { opacity: 0.6; }

.ocb-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, #3B94E0, #2f83c5);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
  padding: 0;
}

.ocb-send-btn:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 2px 12px rgba(47, 131, 197, 0.3);
}

.ocb-send-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---- File attachment inside bubble ------------------------ */
.ocb-file-attachment { margin-bottom: 6px; }

.ocb-attachment-thumbnail {
  max-width: 200px;
  max-height: 150px;
  border-radius: 8px;
  object-fit: cover;
  display: block;
}

.ocb-attachment-file-icon {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 6px;
  font-size: 12px;
  color: #64748b;
}

.ocb-attachment-file-icon svg  { flex-shrink: 0; }
.ocb-attachment-file-icon span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

/* ---- Keyframe animations ---------------------------------- */
@keyframes ocb-fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0);   }
}

@keyframes ocb-typing-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40%            { transform: scale(1);   opacity: 1;   }
}

@keyframes ocb-pulse-badge {
  0%, 100% { transform: scale(1);   }
  50%      { transform: scale(1.2); }
}

@keyframes ocb-upload-slide {
  0%   { width: 0%;   margin-left: 0%;   }
  50%  { width: 60%;  margin-left: 20%;  }
  100% { width: 0%;   margin-left: 100%; }
}
