/* ===================================================
   CRISMATECH AUTOMATION - CORPORATE CHATBOT WIDGET
   Matches primary theme: #3c72fc, Inter font, dark corporate UI
=================================================== */

:root {
  --cb-theme-blue: #3c72fc;
  --cb-theme-blue-hover: #2957d6;
  --cb-bg-base: #0a0f1d;
  --cb-bg-surface: #121929;
  --cb-bg-bubble-bot: #182235;
  --cb-border-subtle: rgba(255, 255, 255, 0.08);
  --cb-border-hover: rgba(60, 114, 252, 0.4);
  --cb-text-main: #f1f5f9;
  --cb-text-muted: #94a3b8;
  --cb-font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --cb-radius: 12px;
}

/* Floating Trigger Button */
.crismatech-bot-trigger {
  position: fixed;
  bottom: 85px;
  right: 25px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--cb-theme-blue);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 25px rgba(60, 114, 252, 0.35);
  cursor: pointer;
  z-index: 9998;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.25s ease;
  outline: none;
}

.crismatech-bot-trigger:hover {
  background: var(--cb-theme-blue-hover);
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(60, 114, 252, 0.45);
}

.crismatech-bot-trigger i {
  font-size: 22px;
  color: #ffffff;
}

.crismatech-bot-trigger.active i.fa-comment-alt-dots,
.crismatech-bot-trigger.active i.fa-comments {
  display: none;
}

.crismatech-bot-trigger.active i.fa-times {
  display: block;
}

.crismatech-bot-trigger i.fa-times {
  display: none;
  font-size: 20px;
}

/* Badge Indicator */
.crismatech-bot-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: #ef4444;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--cb-bg-base);
}

/* Main Chat Window */
.crismatech-chat-window {
  position: fixed;
  bottom: 95px;
  right: 25px;
  width: 370px;
  max-width: calc(100vw - 30px);
  height: 530px;
  max-height: calc(100vh - 120px);
  background: var(--cb-bg-base);
  border: 1px solid var(--cb-border-subtle);
  border-radius: var(--cb-radius);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.6), 0 0 25px rgba(60, 114, 252, 0.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transform: translateY(15px);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
  font-family: var(--cb-font-family);
}

.crismatech-chat-window.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Header */
.crismatech-chat-header {
  padding: 14px 18px;
  background: var(--cb-bg-surface);
  border-bottom: 1px solid var(--cb-border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.crismatech-chat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: rgba(60, 114, 252, 0.15);
  border: 1px solid rgba(60, 114, 252, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cb-theme-blue);
  font-size: 17px;
  position: relative;
}

.crismatech-online-dot {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  background: #10b981;
  border: 2px solid var(--cb-bg-surface);
  border-radius: 50%;
}

.crismatech-chat-header-text h4 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: 0.2px;
  font-family: var(--cb-font-family);
}

.crismatech-chat-header-text p {
  margin: 2px 0 0 0;
  font-size: 11.5px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--cb-font-family);
}

.crismatech-chat-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.crismatech-chat-btn-icon {
  background: transparent;
  border: 1px solid transparent;
  color: #94a3b8;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 13px;
  outline: none;
}

.crismatech-chat-btn-icon:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  border-color: var(--cb-border-subtle);
}

/* Chat Body */
.crismatech-chat-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #090e19;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

.crismatech-chat-body::-webkit-scrollbar {
  width: 5px;
}

.crismatech-chat-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
}

/* Message Items */
.crismatech-msg {
  display: flex;
  flex-direction: column;
  max-width: 90%;
  animation: cb-fade-in 0.2s ease forwards;
}

@keyframes cb-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.crismatech-msg.bot {
  align-self: flex-start;
}

.crismatech-msg.user {
  align-self: flex-end;
}

.crismatech-msg-bubble {
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.55;
  word-break: break-word;
  font-family: var(--cb-font-family);
}

.crismatech-msg.bot .crismatech-msg-bubble {
  background: var(--cb-bg-bubble-bot);
  color: var(--cb-text-main);
  border: 1px solid var(--cb-border-subtle);
}

.crismatech-msg.user .crismatech-msg-bubble {
  background: var(--cb-theme-blue);
  color: #ffffff;
}

.crismatech-msg-title {
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 6px;
  display: block;
}

.crismatech-msg-time {
  font-size: 10.5px;
  color: #64748b;
  margin-top: 4px;
  display: block;
}

.crismatech-msg.user .crismatech-msg-time {
  text-align: right;
  color: rgba(255, 255, 255, 0.65);
}

/* Chips / Buttons */
.crismatech-chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.crismatech-chip-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  padding: 6px 11px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  outline: none;
  font-family: var(--cb-font-family);
}

.crismatech-chip-btn i {
  font-size: 11px;
  color: var(--cb-theme-blue);
}

.crismatech-chip-btn:hover {
  background: var(--cb-theme-blue);
  border-color: var(--cb-theme-blue);
  color: #ffffff;
}

.crismatech-chip-btn:hover i {
  color: #ffffff;
}

/* Action Links in Messages */
.crismatech-msg-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 7px 12px;
  background: rgba(60, 114, 252, 0.12);
  border: 1px solid rgba(60, 114, 252, 0.3);
  color: #93c5fd !important;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none !important;
  transition: all 0.2s ease;
  font-family: var(--cb-font-family);
}

.crismatech-msg-link:hover {
  background: var(--cb-theme-blue);
  color: #ffffff !important;
  border-color: var(--cb-theme-blue);
}

.crismatech-msg-link.whatsapp-link {
  background: rgba(34, 197, 94, 0.12) !important;
  border-color: rgba(34, 197, 94, 0.3) !important;
  color: #4ade80 !important;
}

.crismatech-msg-link.whatsapp-link:hover {
  background: #16a34a !important;
  color: #ffffff !important;
  border-color: #16a34a !important;
}

/* Typing Indicator */
.crismatech-typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: var(--cb-bg-bubble-bot);
  border: 1px solid var(--cb-border-subtle);
  border-radius: 8px;
  width: fit-content;
}

.crismatech-typing-dot {
  width: 5px;
  height: 5px;
  background: #94a3b8;
  border-radius: 50%;
  animation: cb-typing 1.2s infinite ease-in-out;
}

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

@keyframes cb-typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* Footer / Input Area */
.crismatech-chat-footer {
  padding: 12px 14px;
  background: var(--cb-bg-surface);
  border-top: 1px solid var(--cb-border-subtle);
}

.crismatech-chat-form {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #090e19 !important;
  border: 1px solid var(--cb-border-subtle) !important;
  border-radius: 8px;
  padding: 4px 6px 4px 12px;
  transition: border-color 0.2s ease;
}

.crismatech-chat-form:focus-within {
  border-color: var(--cb-theme-blue) !important;
  box-shadow: 0 0 0 1px var(--cb-theme-blue);
}

.crismatech-chat-input {
  flex: 1;
  background: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  color: #ffffff !important;
  font-size: 13px !important;
  height: 36px !important;
  padding: 0 !important;
  font-family: var(--cb-font-family);
}

.crismatech-chat-input::placeholder {
  color: #64748b !important;
}

.crismatech-chat-send-btn {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--cb-theme-blue);
  border: none;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
  font-size: 13px;
  padding: 0;
}

.crismatech-chat-send-btn:hover {
  background: var(--cb-theme-blue-hover);
}

.crismatech-chat-powered {
  text-align: center;
  font-size: 10px;
  color: #64748b;
  margin-top: 6px;
  letter-spacing: 0.2px;
  font-family: var(--cb-font-family);
}

/* Mobile Responsiveness */
@media (max-width: 575px) {
  .crismatech-chat-window {
    right: 12px;
    bottom: 80px;
    width: calc(100vw - 24px);
    height: 72vh;
    border-radius: 10px;
  }
  
  .crismatech-bot-trigger {
    right: 15px;
    bottom: 80px;
    width: 48px;
    height: 48px;
  }
}
