.chat-container {
  max-width: 720px;
  margin: 40px auto;
  background: transparent;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  overflow: scroll;
  display: flex;
  flex-direction: column;
  border: 3px solid #333333;
  position: relative;
}
/* The expand/minimize button */
.chat-expand-btn{
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 10;
  display: none;            /* hidden by default, shown â‰¥1000px */
  align-items: center;
  gap: .5rem;
  padding: 6px 10px;
  font-size: 14px;
  line-height: 1;
  border: 1px solid rgba(0,0,0,.15);
  border-radius: 6px;
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  cursor: pointer;
  padding: 0px !important;
  background: transparent !important;
}
.chat-expand-btn svg { height: 20px; }

/* Only show the button on wide screens */
@media (min-width: 1000px){
  .chat-expand-btn{ display: inline-flex; }
   .chat-expand-btn + .chat-pin-btn { left: 8px; display: block !important; }
}

/* Smooth transitions (scoped to the row that holds the two columns) */
.with-expand .col-md-5,
.with-expand .col-md-7,
.with-expand .col-lg-5,
.with-expand .col-lg-7{
  transition: flex-basis .3s ease, max-width .3s ease, width .3s ease, opacity .25s ease;
  will-change: flex-basis, max-width, width, opacity;
}

/* Collapsing the left column (5-wide) */
.with-expand .is-collapsing{
  flex: 0 0 0 !important;
  max-width: 0 !important;
  width: 0 !important;
  opacity: 0;
  overflow: hidden;
  visibility: hidden;
  pointer-events: none;
}

/* Expanding the right column (7-wide) to fill */
.with-expand .is-expanding{
  flex: 0 0 100% !important;
  max-width: 100% !important;
  width: 100% !important;
  margin: 10px;
}

.chat-output {
  padding: 20px;
  height: 500px;
  overflow-y: auto;
  background: transparent;
  overflow: scroll;
  overflow-x: hidden !important;
}

.chat-input-form {
  display: flex;
  padding: 16px;
  border-top: 3px solid #333333;
  background: transparent;
}

.chat-input::placeholder {
    color: #e5e5e5;
}
.chat-input {
    flex: 1;
    padding: 19px !important;
    margin-right: 18px !important;
    margin: 0px;
    background: transparent;
    font-size: 1rem;
    border: 1px solid #333333 !important;
    border-radius: 33px;
    color: #ffffff !important;
	text-transform: unset;
	
}
.code-block {
    background: #ffffff;
    padding: 10px;
    border-radius: 10px;
    margin-top: 10px;
    margin-bottom: 10px;
}
pre {
  max-width: 90%;          /* donâ€™t exceed container */
  overflow-x: auto;         /* if still too wide, allow horizontal scroll */
  white-space: pre-wrap;    /* allow wrapping */
  word-break: break-word;   /* break long tokens if needed */
  word-wrap: break-word;    /* legacy alias */
  box-sizing: border-box;   /* include padding in width */
}

pre code {
  display: block;           /* fill pre */
  max-width: 100%;
  white-space: inherit;     /* inherit wrapping behavior from pre */
}

/* Wrap + button layout */
.code-block {
  position: relative;
}

/* Give pre room so the button doesn't overlap text if you want */
.code-block pre {
  padding-top: 2.2rem; /* optional; tweak or remove */
}

/* Copy button */
.code-copy-btn{
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 4px 10px;
  font-size: 12px;
  line-height: 1;
  border: 1px solid rgba(0,0,0,.12);
  border-radius: 6px;
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 6px rgba(0,0,0,.08);
  cursor: pointer;
  user-select: none;
  transition: opacity .2s ease, transform .06s ease;
  opacity: .75;
}
.code-copy-btn:hover { opacity: 1; }
.code-copy-btn:active { transform: translateY(1px); }
.code-copy-btn.is-copied {
  background: #e8ffe8;          /* subtle success state */
  border-color: #b5e6b5;
}

.chat-submit {
    color: #000000 !important;
    padding: 18px 30px !important;
    margin-top: 20px !important;
    font-weight: 400 !important;
    text-transform: uppercase !important;
    border-radius: 44px !important;
    margin: 0px !important;
    border: 0px !important;
    background: #e5e5e5 !important;
    font-family: 'Outfit' !important;
}

.chat-submit:hover {
  background: #0056b3;
}

/* BUBBLES */

.chat-bubble {
  display: flex;
  align-items: flex-start;
  margin-bottom: 16px;
  gap: 10px;
}

.chat-bubble.user {
  justify-content: flex-end;
  text-align: left;
}

.chat-bubble.user .message {
  background: #d1eaff;
  color: #000;
}

.chat-bubble.bot {
  justify-content: flex-start;
}

.chat-bubble.bot .message {
  background: #f1f1f1;
  color: #000;
}

.avatar {
  font-size: 1.8rem;
  width: 40px;
  text-align: center;
}

.message {
  padding: 12px 16px;
  border-radius: 14px;
  max-width: 75%;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.typing-indicator {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 8px 12px;
  border-radius: 12px;
  background: #f1f1f1;
  width: fit-content;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  background: #666;
  border-radius: 50%;
  display: inline-block;
  animation: blink 1.4s infinite both;
}

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

@keyframes blink {
  0% { opacity: 0.2; transform: translateY(0); }
  20% { opacity: 1; transform: translateY(-3px); }
  40% { opacity: 0.2; transform: translateY(0); }
}


/* Chromium/WebKit */
#chat-output::-webkit-scrollbar {
  width: 10px;
}
#chat-output::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.18);
  border-radius: 999px;
}
#chat-output::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.85);
  border-radius: 999px;
  border: 2px solid transparent;   /* creates a nice pill */
  background-clip: padding-box;
}
#chat-output::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.95);
}

/* Firefox */
#chat-output {
  scrollbar-width: thin;                             /* auto | thin | none */
  scrollbar-color: rgba(255,255,255,0.85) transparent; /* thumb | track */
}

/* ────────────────────────────────────────────────────────────────────────────
   OxiEE AI message styling (scoped to bot bubble)
   ──────────────────────────────────────────────────────────────────────────── */
:root {
  --ox-ai-fg:            #0f172a; /* slate-900 */
  --ox-ai-muted:         #475569; /* slate-600 */
  --ox-ai-border:        #e2e8f0; /* slate-200 */
  --ox-ai-accent:        #2563eb; /* blue-600 */
  --ox-ai-accent-2:      #1d4ed8; /* blue-700 */
  --ox-ai-code-bg:       #0b1020; /* deep navy for code */
  --ox-ai-code-border:   #1e293b; /* slate-800 */
  --ox-ai-table-head:    #f8fafc; /* slate-50 */
  --ox-ai-table-row-alt: #f1f5f9; /* slate-100 */
}

/* Dark mode polish */
@media (prefers-color-scheme: dark) {
  :root {
 /*   --ox-ai-fg:            #e2e8f0;
    --ox-ai-muted:         #94a3b8;
    --ox-ai-border:        #2a3342;
    --ox-ai-accent:        #60a5fa;
    --ox-ai-accent-2:      #3b82f6;
    --ox-ai-code-bg:       #0b1020;
    --ox-ai-code-border:   #1f2937;
    --ox-ai-table-head:    #0f172a;
    --ox-ai-table-row-alt: #111827; */
  }
}

/* Container + typography */
.chat-bubble.bot .message { 
  overflow-x: auto !important; /* allow wide tables to scroll */
}

.chat-bubble.bot .message .typed-output {
  display: block !important;
  color: var(--ox-ai-fg) !important;
  line-height: 1 !important;
  font-size: 16px !important;
  -webkit-font-smoothing: antialiased !important;
  -moz-osx-font-smoothing: grayscale !important;

  /* prevent layout explosions */
  word-break: break-word !important;
  overflow-wrap: anywhere !important;
}

/* Spacing rhythm */
.chat-bubble.bot .message .typed-output > * {
  margin: 0 0 0.85em 0 !important;
}
.chat-bubble.bot .message .typed-output > *:last-child {
  margin-bottom: 0 !important;
}

/* Headings */
.chat-bubble.bot .message .typed-output h1 { font-size: 1.6rem !important; line-height: 1.25 !important; margin: 0 0 .6em 0 !important; }
.chat-bubble.bot .message .typed-output h2 { font-size: 1.4rem !important; line-height: 1.3  !important; margin: 0 0 .6em 0 !important; }
.chat-bubble.bot .message .typed-output h3 { font-size: 1.2rem !important; line-height: 1.35 !important; margin: 0 0 .5em 0 !important; }
.chat-bubble.bot .message .typed-output h4,
.chat-bubble.bot .message .typed-output h5,
.chat-bubble.bot .message .typed-output h6 { font-size: 1.05rem !important; line-height: 1.4 !important; margin: 0 0 .5em 0 !important; }

/* Text elements */
.chat-bubble.bot .message .typed-output p { color: var(--ox-ai-fg) !important; }
.chat-bubble.bot .message .typed-output em { font-style: italic !important; }
.chat-bubble.bot .message .typed-output strong { font-weight: 700 !important; }

/* Links (Swup-safe; you already set data-no-swup on generated anchors) */
.chat-bubble.bot .message .typed-output a {
  color: var(--ox-ai-accent) !important;
  text-decoration: underline !important;
  text-underline-offset: 2px !important;
}
.chat-bubble.bot .message .typed-output a:hover { color: var(--ox-ai-accent-2) !important; }

/* Lists */
.chat-bubble.bot .message .typed-output ul,
.chat-bubble.bot .message .typed-output ol {
  padding-left: 1.25em !important;
}
.chat-bubble.bot .message .typed-output li { margin: .35em 0 !important; }

/* Blockquote */
.chat-bubble.bot .message .typed-output blockquote {
  margin: 0 0 1em 0 !important;
  padding: .6em .9em !important;
  border-left: 3px solid var(--ox-ai-accent) !important;
  background: rgba(37,99,235,.07) !important;
  color: var(--ox-ai-muted) !important;
}

/* Horizontal rule */
.chat-bubble.bot .message .typed-output hr {
  border: 0 !important;
  border-top: 1px solid var(--ox-ai-border) !important;
  margin: 1.1em 0 !important;
}

/* Inline code */
.chat-bubble.bot .message .typed-output p code,
.chat-bubble.bot .message .typed-output li code,
.chat-bubble.bot .message .typed-output h1 code,
.chat-bubble.bot .message .typed-output h2 code,
.chat-bubble.bot .message .typed-output h3 code {
  background: rgba(2,6,23,.08) !important;
  padding: .15em .35em !important;
  border-radius: .35rem !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace !important;
  font-size: 0.95em !important;
}

/* Code blocks (+ Copy button) — matches your JS enhanceCodeBlocks wrapper */
.chat-bubble.bot .message .typed-output .code-block {
  position: relative !important;
  margin: .9em 0 1.1em !important;
  border: 1px solid var(--ox-ai-code-border) !important;
  border-radius: .6rem !important;
  background: var(--ox-ai-code-bg) !important;
  overflow: hidden !important;
}

.chat-bubble.bot .message .typed-output .code-block pre {
  margin: 0 !important;
  padding: 1rem 1.15rem !important;
  overflow: auto !important;
  color: #e5e7eb !important;
  font-size: 0.92rem !important;
  line-height: 1.55 !important;
  tab-size: 4 !important;
}

.chat-bubble.bot .message .typed-output .code-block code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace !important;
  display: block !important;
  white-space: pre !important;
}

/* Copy button */
.chat-bubble.bot .message .typed-output .code-copy-btn {
  position: absolute !important;
  top: .5rem !important;
  right: .5rem !important;
  padding: .35rem .55rem !important;
  font-size: .75rem !important;
  line-height: 1 !important;
  border-radius: .4rem !important;
  border: 1px solid rgba(255,255,255,.15) !important;
  background: rgba(255,255,255,.08) !important;
  color: #fff !important;
  cursor: pointer !important;
  opacity: .85 !important;
  transition: opacity .15s ease, transform .06s ease !important;
}
.chat-bubble.bot .message .typed-output .code-copy-btn:hover { opacity: 1 !important; }
.chat-bubble.bot .message .typed-output .code-copy-btn.is-copied {
  background: rgba(34,197,94,.25) !important; /* green-ish feedback */
  border-color: rgba(34,197,94,.5) !important;
}

/* Tables — clean, compact, responsive */
.chat-bubble.bot .message .typed-output table {
  width: 100% !important;
  border-collapse: collapse !important;
  border-spacing: 0 !important;
  border: 1px solid var(--ox-ai-border) !important;
  background: transparent !important;
  font-size: 0.95rem !important;
}

.chat-bubble.bot .message .typed-output thead th {
  position: sticky; /* keeps headers visible when message scrolls */
  top: 0;
  background: var(--ox-ai-table-head) !important;
  color: var(--ox-ai-fg) !important;
  text-align: left !important;
  font-weight: 700 !important;
  border-bottom: 1px solid var(--ox-ai-border) !important;
}

.chat-bubble.bot .message .typed-output th,
.chat-bubble.bot .message .typed-output td {
  padding: .6rem .8rem !important;
  border-bottom: 1px solid var(--ox-ai-border) !important;
  vertical-align: top !important;
  line-height: 1.5 !important;
}

.chat-bubble.bot .message .typed-output tbody tr:nth-child(even) td {
  background: var(--ox-ai-table-row-alt) !important;
}

.chat-bubble.bot .message .typed-output tbody tr:hover td {
  background: rgba(37,99,235,.06) !important; /* subtle hover */
}

/* Make super-wide tables scroll horizontally without breaking layout */
.chat-bubble.bot .message { scrollbar-gutter: stable both-edges; }
.chat-bubble.bot .message .typed-output table { min-width: 560px !important; }

/* Images (if any from model) */
.chat-bubble.bot .message .typed-output img {
  max-width: 100% !important;
  height: auto !important;
  border-radius: .4rem !important;
  border: 1px solid var(--ox-ai-border) !important;
}

/* Selection highlight inside bot output */
.chat-bubble.bot .message .typed-output ::selection {
  background: rgba(37,99,235,.25) !important;
}

/* Reduce vertical jitter when Typed.js completes */
.chat-bubble.bot .message .typed-output .typed-cursor { display: none !important; }
@media (max-width: 1000px) {
  .chat-expand-btn + .chat-pin-btn {
    left: 8px;
    display: block;
  }
}

.chat-expand-btn + .chat-pin-btn { left: 40px; }