/* ============================================================
   JeffBot Chat Widget v2 — McMillanAI Branded
   Now clearly branded as "JeffBot" AI Assistant
   ============================================================ */

:root {
  --jb-navy: #0A1628;
  --jb-navy-light: #132240;
  --jb-navy-mid: #1A2D4D;
  --jb-blue: #0066CC;
  --jb-blue-dark: #004C99;
  --jb-gold: #C8A44E;
  --jb-gold-light: #E0C872;
  --jb-gold-dim: rgba(200, 164, 78, 0.15);
  --jb-white: #FFFFFF;
  --jb-gray-100: #F7F8FA;
  --jb-gray-200: #E8EBF0;
  --jb-gray-300: #C4CAD4;
  --jb-gray-600: #6B7280;
  --jb-shadow: 0 8px 32px rgba(10, 22, 40, 0.28);
  --jb-shadow-sm: 0 2px 8px rgba(10, 22, 40, 0.12);
  --jb-radius: 16px;
  --jb-radius-sm: 10px;
  --jb-font: 'DM Serif Display', Georgia, serif;
  --jb-font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --jb-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* -- Launcher Button --------------------------------------- */
/* Expanded launcher — pill shape with label */
#jeffbot-launcher {
  position: fixed;
  bottom: 28px;
  right: 28px;
  height: 60px;
  padding: 0 24px 0 20px;
  border-radius: 30px;
  background: linear-gradient(135deg, var(--jb-blue) 0%, var(--jb-blue-dark) 100%);
  border: 2px solid var(--jb-gold);
  color: var(--jb-white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 8px 32px rgba(0, 102, 204, 0.35);
  transition: transform var(--jb-transition), box-shadow var(--jb-transition);
  z-index: 99998;
  outline: none;
  font-family: var(--jb-font-sans);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

#jeffbot-launcher:hover {
  transform: scale(1.05);
  box-shadow: 0 12px 40px rgba(0, 102, 204, 0.45);
}

#jeffbot-launcher svg {
  width: 24px;
  height: 24px;
  transition: transform var(--jb-transition);
  flex-shrink: 0;
}

#jeffbot-launcher.open {
  width: 60px;
  height: 60px;
  padding: 0;
  border-radius: 50%;
  gap: 0;
}

#jeffbot-launcher.open svg {
  transform: rotate(90deg);
}

#jeffbot-launcher.open .jb-launcher-label {
  display: none;
}

.jb-launcher-label {
  pointer-events: none;
}

#jeffbot-launcher::after {
  content: '';
  position: absolute;
  inset: -5px;
  border-radius: 30px;
  border: 2px solid var(--jb-gold);
  opacity: 0;
  animation: jb-pulse 3s ease-in-out infinite;
}

#jeffbot-launcher.open::after {
  border-radius: 50%;
}

@keyframes jb-pulse {
  0%, 100% { opacity: 0; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(1.08); }
}

/* -- Chat Window ------------------------------------------- */
#jeffbot-window {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 420px;
  height: 580px;
  max-height: calc(100vh - 140px);
  background: var(--jb-white);
  border-radius: var(--jb-radius);
  box-shadow: var(--jb-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 99999;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: opacity var(--jb-transition), transform var(--jb-transition);
}

#jeffbot-window.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  touch-action: none;
}

#jeffbot-window.visible .jb-messages {
  touch-action: pan-y;
  overscroll-behavior: contain;
}

/* -- Header ------------------------------------------------ */
.jb-header {
  background: linear-gradient(135deg, var(--jb-navy) 0%, var(--jb-navy-light) 100%);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  z-index: 10;
}

.jb-header::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--jb-gold) 20%, var(--jb-gold) 80%, transparent 100%);
  opacity: 0.6;
}

.jb-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--jb-gold-dim);
  border: 2px solid var(--jb-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.jb-avatar-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.jb-avatar-icon svg {
  width: 22px;
  height: 22px;
  color: var(--jb-gold);
}

.jb-header-info {
  flex: 1;
  min-width: 0;
}

.jb-header-name {
  font-family: var(--jb-font-sans);
  font-size: 16px;
  font-weight: 700;
  color: var(--jb-white);
  margin: 0;
  line-height: 1.2;
  display: flex;
  align-items: center;
  gap: 8px;
}

.jb-ai-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--jb-gold);
  color: var(--jb-navy);
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1.4;
}

.jb-header-status {
  font-family: var(--jb-font-sans);
  font-size: 12px;
  color: var(--jb-gold-light);
  margin: 2px 0 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.jb-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ADE80;
  display: inline-block;
}

.jb-close-btn {
  background: none;
  border: none;
  color: var(--jb-gray-300);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: color var(--jb-transition), background var(--jb-transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.jb-close-btn svg {
  width: 20px;
  height: 20px;
}

.jb-close-btn:hover {
  color: var(--jb-white);
  background: rgba(255, 255, 255, 0.1);
}

/* Mobile close bar — hidden on desktop */
.jb-mobile-close {
  display: none;
}

/* Mobile close button in header — hidden on desktop */
.jb-close-btn-mobile {
  display: none;
}

/* Typing cursor animation */
.jb-cursor {
  animation: jb-blink 0.6s step-end infinite;
  color: var(--jb-gold);
  font-weight: 300;
}

@keyframes jb-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* -- Messages Area ----------------------------------------- */
.jb-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--jb-gray-100);
  min-height: 0;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.jb-messages::-webkit-scrollbar { width: 5px; }
.jb-messages::-webkit-scrollbar-track { background: transparent; }
.jb-messages::-webkit-scrollbar-thumb { background: var(--jb-gray-300); border-radius: 10px; }

/* -- Individual Message ------------------------------------ */
.jb-msg {
  display: flex;
  gap: 10px;
  max-width: 88%;
  animation: jb-msg-in 0.35s ease-out;
}

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

.jb-msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.jb-msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--jb-font-sans);
  font-size: 11px;
  font-weight: 700;
}

.jb-msg.bot .jb-msg-avatar {
  background: var(--jb-gold-dim);
  color: var(--jb-gold);
  border: 1.5px solid var(--jb-gold);
}

.jb-msg.bot .jb-msg-avatar svg {
  width: 16px;
  height: 16px;
}

.jb-msg.user .jb-msg-avatar {
  background: var(--jb-blue);
  color: var(--jb-white);
}

.jb-msg-bubble {
  padding: 12px 16px;
  font-family: var(--jb-font-sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--jb-navy);
  word-wrap: break-word;
}

.jb-msg.bot .jb-msg-bubble {
  background: var(--jb-white);
  border-radius: 2px var(--jb-radius-sm) var(--jb-radius-sm) var(--jb-radius-sm);
  box-shadow: var(--jb-shadow-sm);
}

.jb-msg.user .jb-msg-bubble {
  background: var(--jb-blue);
  color: var(--jb-white);
  border-radius: var(--jb-radius-sm) 2px var(--jb-radius-sm) var(--jb-radius-sm);
}

/* -- Typing Indicator -------------------------------------- */
.jb-typing {
  display: flex;
  gap: 4px;
  padding: 8px 0;
  align-items: center;
}

.jb-typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--jb-gold);
  animation: jb-bounce 1.4s ease-in-out infinite;
}

.jb-typing-dot:nth-child(2) { animation-delay: 0.16s; }
.jb-typing-dot:nth-child(3) { animation-delay: 0.32s; }

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

/* -- Input Area -------------------------------------------- */
.jb-input-area {
  padding: 14px 16px;
  background: var(--jb-white);
  border-top: 1px solid var(--jb-gray-200);
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-shrink: 0;
}

.jb-input-wrapper { flex: 1; position: relative; }

.jb-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--jb-gray-200);
  border-radius: var(--jb-radius-sm);
  font-family: var(--jb-font-sans);
  font-size: 14px;
  color: var(--jb-navy);
  background: var(--jb-gray-100);
  outline: none;
  resize: none;
  max-height: 100px;
  line-height: 1.4;
  transition: border-color var(--jb-transition), background var(--jb-transition);
  box-sizing: border-box;
}

.jb-input::placeholder { color: var(--jb-gray-300); }
.jb-input:focus { border-color: var(--jb-blue); background: var(--jb-white); }

.jb-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--jb-blue);
  color: var(--jb-white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--jb-transition), transform var(--jb-transition);
}

.jb-send-btn:hover:not(:disabled) { background: var(--jb-blue-dark); transform: scale(1.06); }
.jb-send-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.jb-send-btn svg { width: 18px; height: 18px; }

/* -- Welcome Screen ---------------------------------------- */
.jb-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  text-align: center;
  flex: 1;
}

.jb-welcome-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--jb-gold-dim);
  border: 2px solid var(--jb-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.jb-welcome-icon span {
  display: flex;
  align-items: center;
  justify-content: center;
}

.jb-welcome-icon svg {
  width: 30px;
  height: 30px;
  color: var(--jb-gold);
}

.jb-welcome h3 {
  font-family: var(--jb-font);
  font-size: 22px;
  color: var(--jb-navy);
  margin: 0 0 4px;
  font-weight: 700;
}

.jb-ai-disclaimer {
  font-family: var(--jb-font-sans);
  font-size: 12px;
  color: var(--jb-gray-600);
  background: var(--jb-gray-200);
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  margin: 0 0 12px;
  letter-spacing: 0.02em;
}

.jb-welcome p {
  font-family: var(--jb-font-sans);
  font-size: 13.5px;
  color: var(--jb-gray-600);
  margin: 0 0 20px;
  line-height: 1.5;
}

.jb-suggestions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.jb-suggestion {
  padding: 10px 16px;
  border: 1.5px solid var(--jb-gray-200);
  border-radius: var(--jb-radius-sm);
  background: var(--jb-white);
  font-family: var(--jb-font-sans);
  font-size: 13px;
  color: var(--jb-navy);
  cursor: pointer;
  text-align: left;
  transition: border-color var(--jb-transition), background var(--jb-transition);
}

.jb-suggestion:hover {
  border-color: var(--jb-blue);
  background: rgba(0, 102, 204, 0.05);
}

/* -- Footer ------------------------------------------------ */
.jb-footer {
  padding: 8px 16px;
  text-align: center;
  font-family: var(--jb-font-sans);
  font-size: 11px;
  color: var(--jb-gray-300);
  background: var(--jb-white);
  flex-shrink: 0;
}

/* -- Mobile Responsive ------------------------------------- */
@media (max-width: 480px) {
  #jeffbot-window {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    max-height: none;
    border-radius: 0;
    z-index: 999999;
  }

  /* Floating close button — ALWAYS visible on mobile */
  .jb-mobile-close {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 12px;
    right: 12px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.5);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    z-index: 9999999;
    padding: 0;
  }

  .jb-mobile-close-bar {
    display: none;
  }

  .jb-mobile-close-text {
    font-family: var(--jb-font-sans);
    font-size: 22px;
    font-weight: 400;
    color: white;
    line-height: 1;
  }

  .jb-mobile-close:active {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(0.95);
  }

  .jb-header {
    padding: 12px 16px;
    padding-right: 60px;
  }

  /* Hide desktop close button on mobile */
  .jb-close-btn {
    display: none;
  }

  .jb-close-btn-mobile {
    display: none;
  }

  /* Hide launcher when chat is open on mobile */
  #jeffbot-launcher.open {
    display: none;
  }

  #jeffbot-launcher {
    bottom: 16px;
    right: 16px;
    height: 52px;
    padding: 0 18px 0 14px;
    font-size: 14px;
  }

  /* Lock body scroll when chat is open */
  body.jeffbot-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
  }

  .jb-messages {
    padding: 16px 12px;
  }

  .jb-input-area {
    padding: 10px 12px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }

  .jb-input {
    font-size: 16px;
  }

  .jb-welcome {
    padding: 24px 16px;
  }

  .jb-welcome h3 {
    font-size: 20px;
  }

  .jb-welcome p {
    font-size: 13px;
  }

  .jb-suggestion {
    font-size: 12.5px;
    padding: 9px 14px;
  }

  .jb-msg {
    max-width: 92%;
  }

  .jb-footer {
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }
}

/* ============================================================
   JeffBot Page Section — for embedding on the main site
   ============================================================ */

.jeffbot-section {
  padding: 6rem 2rem;
  background: linear-gradient(180deg, var(--gray-50, #F8FAFB) 0%, var(--white, #FFFFFF) 100%);
}

.jeffbot-section-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
}

.jeffbot-section-content {
  padding-right: 1rem;
}

.jeffbot-section-label {
  font-family: var(--font-body, 'DM Sans', sans-serif);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--blue, #0066CC);
  margin-bottom: 1rem;
}

.jeffbot-section-title {
  font-family: var(--font-display, 'DM Serif Display', Georgia, serif);
  font-size: 2.6rem;
  color: var(--navy, #0A1628);
  line-height: 1.15;
  margin-bottom: 1.25rem;
}

.jeffbot-section-title span {
  color: var(--blue, #0066CC);
}

.jeffbot-section-desc {
  font-family: var(--font-body, 'DM Sans', sans-serif);
  font-size: 1.05rem;
  color: var(--gray-600, #4A5568);
  line-height: 1.7;
  margin-bottom: 2rem;
}

.jeffbot-capabilities {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
}

.jeffbot-capability {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.jeffbot-capability-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0, 102, 204, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.jeffbot-capability-icon svg {
  width: 14px;
  height: 14px;
  color: var(--blue, #0066CC);
}

.jeffbot-capability-text {
  font-family: var(--font-body, 'DM Sans', sans-serif);
  font-size: 0.95rem;
  color: var(--gray-600, #4A5568);
  line-height: 1.5;
}

.jeffbot-capability-text strong {
  color: var(--navy, #0A1628);
}

.jeffbot-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.9rem 2rem;
  background: var(--blue, #0066CC);
  color: white;
  border: none;
  border-radius: 8px;
  font-family: var(--font-body, 'DM Sans', sans-serif);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.2s ease;
  text-decoration: none;
}

.jeffbot-cta-btn:hover {
  background: var(--blue-dark, #004C99);
  transform: translateY(-1px);
}

.jeffbot-cta-btn svg {
  width: 18px;
  height: 18px;
}

/* Demo window preview */
.jeffbot-demo-window {
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(10, 22, 40, 0.15);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.jeffbot-demo-header {
  background: linear-gradient(135deg, #0A1628 0%, #132240 100%);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-top: 2px solid rgba(200, 164, 78, 0.5);
}

.jeffbot-demo-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(200, 164, 78, 0.15);
  border: 1.5px solid #C8A44E;
  display: flex;
  align-items: center;
  justify-content: center;
}

.jeffbot-demo-avatar svg {
  width: 18px;
  height: 18px;
  color: #C8A44E;
}

.jeffbot-demo-name {
  font-family: var(--font-body, 'DM Sans', sans-serif);
  font-size: 14px;
  font-weight: 700;
  color: white;
  display: flex;
  align-items: center;
  gap: 6px;
}

.jeffbot-demo-badge {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.08em;
  background: #C8A44E;
  color: #0A1628;
  padding: 2px 5px;
  border-radius: 3px;
}

.jeffbot-demo-msgs {
  padding: 20px 16px;
  background: #F7F8FA;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 260px;
}

.jeffbot-demo-msg {
  display: flex;
  gap: 8px;
  max-width: 85%;
}

.jeffbot-demo-msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.jeffbot-demo-msg-bubble {
  padding: 10px 14px;
  font-family: var(--font-body, 'DM Sans', sans-serif);
  font-size: 13px;
  line-height: 1.5;
  border-radius: 10px;
}

.jeffbot-demo-msg.bot .jeffbot-demo-msg-bubble {
  background: white;
  color: #0A1628;
  border-top-left-radius: 2px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.jeffbot-demo-msg.user .jeffbot-demo-msg-bubble {
  background: #0066CC;
  color: white;
  border-top-right-radius: 2px;
}

.jeffbot-demo-input {
  padding: 14px 16px;
  border-top: 1px solid #E8EBF0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.jeffbot-demo-input-field {
  flex: 1;
  padding: 8px 12px;
  border: 1.5px solid #E8EBF0;
  border-radius: 8px;
  font-family: var(--font-body, 'DM Sans', sans-serif);
  font-size: 13px;
  color: #C4CAD4;
  background: #F7F8FA;
}

.jeffbot-demo-disclaimer {
  padding: 8px 16px;
  text-align: center;
  font-family: var(--font-body, 'DM Sans', sans-serif);
  font-size: 10px;
  color: #C4CAD4;
}

@media (max-width: 768px) {
  .jeffbot-section-inner {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }
  
  .jeffbot-section-title {
    font-size: 2rem;
  }
}
