/* ═══════════════════════════════════════════════
   CHATBOT N12A — Premium Edition
   css/chatbot-n12a.css
   ═══════════════════════════════════════════════ */

:root {
  --cb-primary: #06A3DA;
  --cb-primary-dark: #0580ad;
  --cb-primary-light: #e8f6fc;
  --cb-accent: #6f42c1;
  --cb-bg: #ffffff;
  --cb-surface: #f5f7fa;
  --cb-text: #1a2332;
  --cb-text-muted: #6b7a8d;
  --cb-border: #e2e8f0;
  --cb-shadow: 0 20px 60px rgba(6, 163, 218, 0.15), 0 8px 20px rgba(0,0,0,0.08);
  --cb-radius: 18px;
  --cb-font: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Launcher Button ── */

#n12a-chatbot-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9998;
  background: linear-gradient(135deg, var(--cb-primary), var(--cb-primary-dark));
  color: #fff;
  border: none;
  border-radius: 60px;
  padding: 0 20px 0 6px;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 8px 30px rgba(6, 163, 218, 0.35);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: var(--cb-font);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.2px;
  overflow: hidden;
}

#n12a-chatbot-launcher:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 12px 40px rgba(6, 163, 218, 0.45);
}

#n12a-chatbot-launcher.active {
  border-radius: 50%;
  width: 52px;
  padding: 0;
  justify-content: center;
}

.cb-launcher-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.cb-launcher-avatar img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: contain;
  background: #fff;
  padding: 2px;
}

.cb-launcher-text {
  white-space: nowrap;
  transition: opacity 0.2s, max-width 0.3s;
}

#n12a-chatbot-launcher.active .cb-launcher-text {
  opacity: 0;
  max-width: 0;
  overflow: hidden;
}

.cb-launcher-pulse {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 14px;
  height: 14px;
  background: #10b981;
  border-radius: 50%;
  border: 2.5px solid #fff;
  animation: cb-pulse 2s ease-in-out infinite;
}

@keyframes cb-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.7; }
}

/* ── Widget Container ── */

#n12a-chatbot-widget {
  position: fixed;
  right: 24px;
  bottom: 90px;
  width: 380px;
  max-height: 72vh;
  min-height: 420px;
  background: var(--cb-bg);
  border-radius: var(--cb-radius);
  box-shadow: var(--cb-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  font-family: var(--cb-font);
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

#n12a-chatbot-widget.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* ── Header ── */

.cb-header {
  background: linear-gradient(135deg, var(--cb-primary), var(--cb-primary-dark));
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.cb-header::before {
  content: '';
  position: absolute;
  top: -30px;
  right: -30px;
  width: 100px;
  height: 100px;
  background: rgba(255,255,255,0.06);
  border-radius: 50%;
}

.cb-header::after {
  content: '';
  position: absolute;
  bottom: -20px;
  left: 40%;
  width: 60px;
  height: 60px;
  background: rgba(255,255,255,0.04);
  border-radius: 50%;
}

.cb-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 1;
}

.cb-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
}

.cb-header-avatar img {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  object-fit: contain;
  background: #fff;
  padding: 2px;
}

.cb-header-meta h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.3px;
}

.cb-header-status {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}

.cb-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  animation: cb-pulse 2s ease-in-out infinite;
}

.cb-header-status span {
  font-size: 11px;
  color: rgba(255,255,255,0.8);
  font-weight: 600;
}

.cb-header-actions {
  display: flex;
  gap: 6px;
  z-index: 1;
}

.cb-header-btn {
  background: rgba(255,255,255,0.12);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: background 0.2s;
  backdrop-filter: blur(10px);
}

.cb-header-btn:hover {
  background: rgba(255,255,255,0.22);
}

/* ── Messages Container ── */

.cb-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  background: var(--cb-surface);
  scroll-behavior: smooth;
}

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

/* ── Message Bubbles ── */

.cb-msg {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  animation: cb-msg-in 0.35s ease-out;
}

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

.cb-msg.user {
  flex-direction: row-reverse;
}

.cb-msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: var(--cb-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  flex-shrink: 0;
  align-self: flex-end;
}

.cb-msg.user .cb-msg-avatar {
  background: #64748b;
}

.cb-msg-content {
  max-width: 78%;
}

.cb-msg-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--cb-text);
  word-wrap: break-word;
}

.cb-msg.bot .cb-msg-bubble {
  background: #fff;
  border: 1px solid var(--cb-border);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.cb-msg.user .cb-msg-bubble {
  background: linear-gradient(135deg, var(--cb-primary), var(--cb-primary-dark));
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 8px rgba(6, 163, 218, 0.25);
}

.cb-msg-time {
  font-size: 10px;
  color: var(--cb-text-muted);
  margin-top: 4px;
  padding: 0 4px;
}

.cb-msg.user .cb-msg-time {
  text-align: right;
}

/* Markdown inside messages */
.cb-msg-bubble a {
  color: var(--cb-primary);
  text-decoration: underline;
  font-weight: 600;
}
.cb-msg.user .cb-msg-bubble a {
  color: #fff;
  text-decoration: underline;
}
.cb-msg-bubble strong {
  font-weight: 700;
}
.cb-msg-bubble ul, .cb-msg-bubble ol {
  margin: 6px 0 2px 16px;
  padding: 0;
}
.cb-msg-bubble li {
  margin-bottom: 2px;
}
.cb-msg-bubble code {
  background: rgba(0,0,0,0.06);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
}

/* ── Typing Indicator ── */

.cb-typing {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  animation: cb-msg-in 0.3s ease-out;
}

.cb-typing-avatar {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: var(--cb-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  flex-shrink: 0;
  align-self: flex-end;
}

.cb-typing-dots {
  background: #fff;
  border: 1px solid var(--cb-border);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  padding: 12px 18px;
  display: flex;
  gap: 5px;
  align-items: center;
}

.cb-typing-dots span {
  width: 7px;
  height: 7px;
  background: var(--cb-primary);
  border-radius: 50%;
  opacity: 0.4;
  animation: cb-dot-bounce 1.4s ease-in-out infinite;
}

.cb-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.cb-typing-dots span:nth-child(3) { animation-delay: 0.4s; }

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

/* ── Action Buttons ── */

.cb-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.cb-action-btn {
  border: 1.5px solid var(--cb-border);
  background: #fff;
  color: var(--cb-text);
  border-radius: 20px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s;
  font-family: var(--cb-font);
  display: flex;
  align-items: center;
  gap: 5px;
}

.cb-action-btn:hover {
  border-color: var(--cb-primary);
  color: var(--cb-primary);
  background: var(--cb-primary-light);
  transform: translateY(-1px);
}

.cb-action-btn i {
  font-size: 11px;
}

/* ── Quick Suggestions ── */

.cb-suggestions {
  padding: 10px 16px 6px;
  background: #fff;
  border-top: 1px solid var(--cb-border);
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.cb-suggestions::-webkit-scrollbar { display: none; }

.cb-suggestion {
  border: 1.5px solid var(--cb-border);
  background: var(--cb-surface);
  color: var(--cb-text-muted);
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  font-family: var(--cb-font);
  flex-shrink: 0;
}

.cb-suggestion:hover {
  border-color: var(--cb-primary);
  color: var(--cb-primary);
  background: var(--cb-primary-light);
}

/* ── Input Area ── */

.cb-input-area {
  padding: 12px 14px;
  background: #fff;
  border-top: 1px solid var(--cb-border);
  display: flex;
  gap: 8px;
  align-items: center;
}

.cb-input-field {
  flex: 1;
  border: 1.5px solid var(--cb-border);
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 13.5px;
  font-family: var(--cb-font);
  background: var(--cb-surface);
  color: var(--cb-text);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.cb-input-field:focus {
  border-color: var(--cb-primary);
  box-shadow: 0 0 0 3px rgba(6, 163, 218, 0.1);
  background: #fff;
}

.cb-input-field::placeholder {
  color: #a0aec0;
}

.cb-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--cb-primary), var(--cb-primary-dark));
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: all 0.25s;
  flex-shrink: 0;
}

.cb-send-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 15px rgba(6, 163, 218, 0.35);
}

.cb-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ── Powered by ── */

.cb-footer {
  text-align: center;
  padding: 6px;
  font-size: 10px;
  color: #b0bec5;
  background: #fff;
  border-top: 1px solid #f0f2f5;
}

.cb-footer a {
  color: var(--cb-primary);
  text-decoration: none;
  font-weight: 700;
}

/* ── Mobile Responsive ── */

@media (max-width: 575.98px) {
  #n12a-chatbot-widget {
    right: 0;
    left: 0;
    bottom: 0;
    top: 0;
    width: 100%;
    max-height: 100vh;
    min-height: 100vh;
    border-radius: 0;
  }
  #n12a-chatbot-launcher {
    right: 12px;
    bottom: 12px;
  }
  .cb-header {
    padding: 14px 16px;
    border-radius: 0;
  }
}
