/* ai_assistant_detail.css */
.guest-toast{
  position:fixed; left:50%; bottom:24px; transform:translateX(-50%);
  z-index:10000; background:#111; color:#fff; border-radius:12px;
  padding:12px 16px; box-shadow:0 8px 30px rgba(0,0,0,.25);
  display:flex; gap:10px; align-items:center; font-size:14px;
}
.guest-toast a{ color:#fff; text-decoration:underline; }
.guest-toast .close{ background:transparent; border:0; color:#bbb; font-size:18px; margin-left:6px; }
/* Mic listening pulse */
#voiceButton.listening { background: #eef6ff; }
#voiceButton.listening i { color: #0ea5e9; }
@keyframes micPulse { 0% { box-shadow: 0 0 0 0 rgba(14,165,233,.35); } 70% { box-shadow: 0 0 0 10px rgba(14,165,233,0); } 100% { box-shadow: 0 0 0 0 rgba(14,165,233,0); } }
#voiceButton.listening { animation: micPulse 1.25s ease-out infinite; }


/* the floating copy icon */
.user-copy-btn {
  position: absolute;
  bottom: -22px;
  right: 6px;
  background: transparent;
  border: none;
  color: #999;
  font-size: 15px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease, color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
}

.message.user .user-bubble:hover .user-copy-btn {
  opacity: 1;
}

.user-copy-btn:hover {
  color: #333;
}

.user-copy-btn i {
  pointer-events: none;
}



/* Mobile */
@media (max-width: 430px) {
  .message .message-image {
    max-width: 220px;
    max-height: 220px;
  }
}

/* Limit image size inside chat bubbles (user uploads + assistant markdown) */
.message .message-image {
  max-width: 250px;
  max-height: 250px;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 10px;
  display: block;
  margin: 0.5rem 0;
  cursor: zoom-in;
  border: 0.5px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 1px 3px rgba(27, 145, 248, 0.06);
}


/* Images rendered inside markdown (bot responses) */
.message .bubble .md img {
  max-width: 100%;
  max-height: 400px;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  display: block;
  margin: 0.5rem 0;
}

/* keep alignment consistent with bubble side */
.message.user .bubble .message-image { margin-left: auto; }
.message.bot  .bubble .message-image { margin-right: auto; }


.message .message-image:hover {
  opacity: 0.9;
}

/* a bit tighter on very small phones */
@media (max-width: 430px) {
  .message .message-image,
  .message .bubble .md img {
    max-height: 220px;
  }
}

:root {
    --dock-h: 170px; /* height of the bottom dock/scrim */
    --text-primary: #2d2d2d;
    --text-secondary: #666;
    --border-light: #e5e5e5;
}

/* Markdown inside bot bubbles */
.bubble .md { font-size: 0.95rem; line-height: 1.6; color: var(--text-primary); white-space: normal; }
.bubble .md p { margin: .45rem 0 .8rem; }
.bubble .md ul, .bubble .md ol { margin: .4rem 0 .8rem 1.25rem; }
.bubble .md li { margin: .2rem 0; }
.bubble .md h1, .bubble .md h2, .bubble .md h3,
.bubble .md h4, .bubble .md h5, .bubble .md h6 { margin: .6rem 0 .3rem; line-height: 1.25; font-weight: 700; }
.bubble .md h1{ font-size:1.15rem; }
.bubble .md h2{ font-size:1.05rem; }
.bubble .md h3{ font-size:.98rem; }
.bubble .md a { color:#1d4ed8; text-decoration: underline; word-break: break-word; }
.bubble .md blockquote{ border-left: 3px solid #e5e7eb; margin: .4rem 0; padding: .2rem .75rem; color: var(--text-secondary); background:#fafafa; border-radius: 0 8px 8px 0; }
.bubble .md code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .78rem; background: #f6f8fa; padding: 0 .25rem; border-radius: 4px; }
.bubble .md pre { background: #f6f8fa; padding: .75rem; border-radius: 8px; overflow-x: auto; margin: .6rem 0; }
.bubble .md pre code { background: transparent; padding: 0; }

/* --- Guest limit banner card (used in JS as a reply) --- */
.limit-banner{ background: transparent; border: 0; border-radius: 24px; padding: 14px 16px; display: flex; align-items: center; gap: 14px; }
.limit-banner .limit-left{ display: flex; align-items: flex-start; gap: 10px; }
.limit-banner .limit-icon{ width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; background: #f0f4ff; color: #1d4ed8; }
.limit-banner .limit-title{ font-size: .95rem; font-weight: 600; color: var(--text-primary); line-height: 1.2; }
.limit-banner .limit-sub{ font-size: .85rem; color: var(--text-secondary); margin-top: 2px; }
.limit-banner .actions{ margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }

/* Buttons styled like the rest of site (primary + subtle outline) */
.btn-primary-soft{ background: #1d4ed8; color: #fff; border: 0; padding: 10px 14px; border-radius: 10px; font-weight: 600; }
.btn-primary-soft:hover{ filter: brightness(0.95); }
.btn-ghost{ background: transparent; color: #1d4ed8; border: 1px solid #c7d2fe; padding: 10px 14px; border-radius: 10px; font-weight: 600; }
.btn-ghost:hover{ background: #eef2ff; border-color: #aab4fe; }

/* --- Copy button for code blocks --- */
.md pre {
  position: relative;
  background: #f6f8fa;
  border-radius: 8px;
  overflow: auto;
  padding: 0.75rem;
  padding-top: 2.5rem;  /* ← Make room for sticky button */
}

/* Code block container */
.code-block-container {
  position: relative;
  margin: 1rem 0;
  background: #f6f8fa;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 0.75rem;
  padding-top: 2.75rem;  /* Space for button */
  overflow-x: auto; /* [YES] Enable horizontal scroll */
  overflow-y: hidden;
}

.code-copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 100;

  background: transparent !important;
  border: 0px solid rgba(0, 0, 0, 0.1);
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  padding: 6px 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  user-select: none;
  -webkit-user-select: none;
  /* [YES] NO transition - instant movement */
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.code-copy-btn:hover {
  background: #fff;
  color: #333;
  border-color: rgba(0, 0, 0, 0.2);
}

.code-copy-btn i {
  pointer-events: none;
  font-size: 13px;
  line-height: 1;
}
/* Pre element - NO scrollbar */
.code-block-container pre {
  margin: 0 !important;
  border: none !important;
  border-radius: 8px;
  background: transparent !important;
  padding: 0 !important;
  overflow-x: auto; /* [YES] Enable horizontal scroll */
  overflow-y: hidden;
}

.code-block-container pre code {
  background: transparent !important;
  padding: 0 !important;
  white-space: pre; /* [YES] Preserve formatting, don't wrap */
  display: block;
  min-width: max-content; /* [YES] Allow content to expand */
}


/* Optional dark-mode tweak */
@media (prefers-color-scheme: dark){
  .limit-banner .limit-icon{ background: #1f2937; color: #a5b4fc; }
  .btn-ghost{ border-color: #4b5563; color: #93c5fd; }
  .btn-ghost:hover{ background: #374151; border-color: #6b7280; }
}

/* Make icon buttons same visual box and perfectly centered */

/* don't double-frame when our cards are inside the bubble */
.message.bot .bubble-furobox:has(.tool-browser),
.message.bot .bubble-furobox:has(.tool-card){
  padding: 0; border: none !important; background: transparent; box-shadow: none;
}

/* refine "View all tools" link inside the card */
.tool-card .tc-actions{ gap: 10px; }
.tool-card .tc-link{ margin-left: auto; padding-left: 6px; color: var(--text-secondary); text-decoration: none; line-height: 1; }
.tool-card .tc-link:hover{ color: var(--text-primary); }

/* --- All tools browser --- */
.tool-browser{ background:#fff; border-radius:12px; padding:14px; max-width:560px; }
.tool-browser .tb-title{ font-weight:700; color:var(--text-primary); margin-bottom: 2px; font-size:.95rem; }
.tool-browser .tb-sub{ color:var(--text-secondary); font-size:.85rem; margin-bottom:10px; }
.tool-browser .tb-grid{ display:grid; grid-template-columns: repeat(1, minmax(0,1fr)); gap:8px; }
.tool-browser .tb-chip{ display:inline-flex; align-items:center; justify-content:center; padding:8px 10px; border-radius:10px; font-size:.82rem; font-weight:500; border:1px solid var(--border-light); background:#fff; color:var(--text-primary); text-decoration:none; transition:background .15s ease, border-color .15s ease; }
.tool-browser .tb-chip:hover{ background:#f7f7f8; border-color:#d7d7d7; }

/* Minimal tool card – matches page style */
.tool-card{ background: #fff; border-radius: 12px; padding: 12px 14px; box-shadow: none; max-width: 560px; }
.tool-card .tc-head{ display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.tool-card .tc-icon{ width: 18px; height: 18px; display: grid; place-items: center; color: var(--text-secondary); }
.tool-card .tc-title{ font-size: .9rem; font-weight: 600; color: var(--text-primary); }
.tool-card .tc-desc{ font-size: .85rem; color: var(--text-secondary); margin: 2px 0 8px; }
.tool-card .tc-actions{ display: grid; align-items: center; gap: 8px; flex-wrap: wrap; }



/* the button */
.tool-card .tc-btn{
  display: inline-flex;      /* you already have this */
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: .82rem;
  font-weight: 500;
  border: 1px solid var(--border-light);
  background: #fff;
  color: var(--text-primary);
  text-decoration: none;
  transition: background .15s ease, border-color .15s ease;

  /* key bits to size to text */
  flex: 0 0 auto;            /* don’t grow in a flex row */
  white-space: nowrap;       /* don’t wrap text */
  width: fit-content;        /* shrink to text + padding (modern browsers) */
  /* inline-size: max-content;  alternative if you prefer */
}

.tc-actions {
  display: grid;
  grid-auto-flow: row;
  grid-auto-rows: 1fr;       /* equal row sizing */
  justify-content: start;    /* align to left */
  gap: 10px;
  width: max-content;        /* shrink-wrap around widest button */
}

.tc-actions .tc-btn {
  white-space: nowrap;
  width: 100%;               /* all buttons equal width */
}


.tool-card .tc-btn:hover{ background:#f7f7f8; border-color:#d7d7d7; }
.tool-card .tc-link{ margin-left: auto; font-size: .82rem; color: var(--text-secondary); text-decoration: none; }
.tool-card .tc-link:hover{ color: var(--text-primary); }

.image-btn,
.send-btn { width: 32px; height: 32px; min-width: 32px; min-height: 32px; display: inline-flex; align-items: center; justify-content: center; line-height: 1; padding: 0; border-radius: 8px; }
.image-btn .bi,
.send-btn .bi { font-size: 18px; display: block; }

.upload-option { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.upload-option-text { flex: 1; }
.upload-option-badge {
    margin-right: 18px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 9999px;
    background: #e6f0ff;
    color: #004085;
    margin-top: 2px;
}
.upload-option-badge.disabled { background: #f8d7da; color: #721c24; }
.upload-option-badge.placeholder { background: transparent; color: transparent; pointer-events: none; }

/* full-width white scrim behind the input */
.bottom-scrim{ position: fixed; bottom: 0; left: 0; width: 100vw; height: 5vw; background: #fff; pointer-events: none; z-index: 99; }

/* mobile tweak */
@media (max-width: 768px) { :root { --dock-h: 150px; } }

/* Top navigation bar */
.chat-nav { background: white; border-bottom: 1px solid var(--border-light); padding: 0.75rem 1rem; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 100; }
.chat-nav-left { display: flex; align-items: center; gap: 1rem; }
.chat-nav-title { font-size: 0.875rem; font-weight: 600; color: var(--text-primary); cursor: pointer; padding: 0.25rem 0.5rem; border-radius: 6px; transition: background 0.2s; }
.chat-nav-title:hover { background: #f7f7f8; }

.chat-nav-actions { display: flex; gap: 0rem; }
.nav-btn { background: none; border: 0px solid var(--border-light); color: var(--text-secondary); padding: 0.4rem 0.6rem; border-radius: 6px; cursor: pointer; transition: all 0.2s; font-size: 0.8rem; text-decoration: none; display: inline-flex; align-items: center; gap: 0.25rem; }
.nav-btn:hover { background: #f7f7f8; color: var(--text-primary); }
.nav-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Vision access indicator */
.vision-indicator { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.7rem; color: #10a37f; background: rgba(16, 163, 127, 0.1); padding: 0.2rem 0.4rem; border-radius: 8px; margin-left: 0.5rem; }
.vision-indicator.disabled { color: var(--text-secondary); background: rgba(108, 117, 125, 0.1); }

/* Messages area */

.messages-container::-webkit-scrollbar {
  width: 6px;
}

.messages-container::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,.1);
  border-radius: 3px;
}

/* Message wrapper for consistent width */
.message-wrapper { width: 100%; max-width: 48rem; margin: 0 auto; scroll-margin-top: 64px; scroll-margin-bottom: calc(var(--dock-h) + 12px);  margin-bottom: 36px; }
.user-bubble-with-inline-actions {
  padding-bottom: 32px; /* Make room inside bubble */
}
.user-actions-inline {
  position: absolute;
  bottom: 4px;
  right: 0px;
  display: flex;
  gap: 5px;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.message.user .user-bubble:hover .user-actions-inline {
  opacity: 1;
}
/* Message styles */
.message { display: flex; align-items: flex-start; gap: 0.75rem; animation: fadeInUp .25s ease-out both; width: 100%; }
.message.bot { justify-content: flex-start; }
.message.user { justify-content: flex-end; }

.avatar { flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%; object-fit: cover; margin-top: 0.125rem; }

/* Message bubbles */
.bubble .bubble-furobox{ position: relative; padding: 0.625rem 0.875rem; border-radius: 8px; font-size: 0.875rem; line-height: 1.5; word-wrap: break-word; }
.message.user .bubble { position: relative; padding: 0.625rem 0.875rem; border-radius: 8px; font-size: 0.875rem; line-height: 1.5; word-wrap: break-word; background: #eff2f5; color: var(--text-primary); border: none; max-width: 70%; }
.bubble-furobox { box-shadow: none !important; border: none !important; }
.message.bot .bubble-furobox{ background: white; max-width: calc(100% - 40px); }
.message.user .bubble-furobox{ background: #f7f7f8; color: var(--text-primary); max-width: 70%; }

/* Message actions */
.message-actions { display: flex; gap: 0.5rem; margin-top: 0.25rem; width: 100%; max-width: 48rem; margin-left: auto; margin-right: auto; padding-left: 36px; }
.message.user + .message-actions { padding-left: 0; padding-right: 36px; justify-content: flex-end; }
.message-action { background: transparent; border: none; padding: 0.2rem 0.4rem; border-radius: 6px; font-size: 0.75rem; color: var(--text-secondary); cursor: pointer; transition: all 0.2s; display: flex; align-items: center; gap: 0.2rem; }
.message-action:hover { background: #f7f7f8; color: var(--text-primary); }

/* Model indicator */
.model-indicator { font-size: 0.65rem; color: var(--text-secondary); margin-top: 0.25rem; padding: 0.1rem 0.3rem; background: rgba(0,0,0,0.05); border-radius: 6px; display: inline-block; }


/* File previews */
.file-previews {
    display: none;
    padding: 0.1rem 0.75rem;
    background: transparent;
    gap: 0.5rem;
    flex-wrap: wrap;
    min-width: 200px;
}

.file-previews:not(:empty) {
    display: flex !important;
    padding: 0.5rem 0.75rem;
}

/* ============================================================================
   IMAGE CHIP - EXACT MATCH TO HOME.CSS
   ============================================================================ */

.image-chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    height: auto;
    gap: 8px;
    border-radius: 12px;
    padding: 4px;
    max-width: 280px;
    transition: all 0.2s ease;
}

.image-chip:hover {
    background: transparent !important;
}

/* Image thumbnail */
.image-chip img {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    border: 0.5px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 1px 3px rgba(27, 145, 248, 0.06);
    cursor: zoom-in;
}

.image-chip img:hover {
    opacity: 0.9;
}

/* File placeholder for documents */
.image-chip .file-placeholder {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    border: 0.5px solid #1B91F880;
    padding: 8px 12px;
    border-radius: 8px;
    /* All other styles via inline styles from JS */
}

.image-chip .file-placeholder span {
    font-size: 13px;
    color: #374151;
    font-weight: 400;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    /* max-width set via inline styles */
}

/* File icon wrapper - NO default styles, colors come from inline styles */
.image-chip .file-icon-wrapper {
    flex-shrink: 0;
    /* All sizing and background colors via inline styles from JS */
}

.image-chip .file-icon-wrapper svg {
    display: block;
}

/* Remove button - EXACT MATCH to home.css */
.chip-remove {
    position: absolute;
    right: -5px;
    top: -5px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: none;
    background: #0B2F4E;
    color: white;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
    line-height: 1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.chip-remove:hover {
    background: #08243B;
    color: #F1F7FF;
}

/* ============================================================================
   MESSAGE DOCUMENT - For files in sent messages
   ============================================================================ */

.message-document {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0;
    padding: 4px;
    margin: 6px 0;
    max-width: 280px;
    background: transparent;
}

.message-document .file-placeholder {
    display: flex;
    align-items: center;
    gap: 8px;
    /* All other styles via inline styles from JS */
}

.message-document .file-icon-wrapper {
    flex-shrink: 0;
    /* All sizing and colors via inline styles from JS */
}

.message-document .file-icon-wrapper svg {
    display: block;
}

/* ============================================================================
   MESSAGE IMAGES
   ============================================================================ */

.message-image {
    max-width: 280px;
    max-height: 260px;
    border-radius: 10px;
    object-fit: contain;
    display: block;
    margin: 0.5rem 0;
    cursor: zoom-in;
    border: 0.5px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 1px 3px rgba(27, 145, 248, 0.06);
}

.message-image:hover {
    opacity: 0.9;
}

/* ============================================================================
   IMAGE PREVIEW (for input area)
   ============================================================================ */

.image-preview {
    position: relative;
    display: inline-block;
}

.image-preview img {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    display: block;
    flex-shrink: 0;
    cursor: zoom-in;
    border: 0.5px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 1px 3px rgba(27, 145, 248, 0.06);
}

.image-preview img:hover {
    opacity: 0.9;
}

.remove-image {
    position: absolute;
    right: -5px;
    top: 5px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: none;
    background: #0B2F4E;
    color: white;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
    line-height: 1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.remove-image:hover {
    background: #08243B;
    color: #F1F7FF;
}

/* ============================================================================
   MOBILE ADJUSTMENTS - EXACT MATCH TO HOME.CSS
   ============================================================================ */

@media (max-width: 576px) {
    .image-chip,
    .message-document {
        max-width: 240px;
        padding: 6px 10px;
        padding-right: 28px;
    }

    .image-chip img,
    .image-preview img {
        width: 50px;
        height: 50px;
    }

    .chip-remove,
    .remove-image {
        width: 18px;
        height: 18px;
        font-size: 12px;
        right: -3px;
        top: -3px;
    }

    .message-image {
        max-width: 220px;
        max-height: 220px;
    }
}

/* =========================================================
   FIX: Upload dropdown (image/document)
   ========================================================= */
/* .upload-dropdown{
  position:absolute;
  bottom:100%;
  left:0;
  background:#fff;
  border:1px solid var(--border-light);
  border-radius:12px;
  padding:6px;
  min-width:280px;
  z-index:1000;
  display:none;
} */

.upload-dropdown{
  position:absolute;
  bottom:100%;
  left:0;
  border-radius:12px;
  padding:6px;
  min-width:280px;
  z-index:1000;
  display:none;  /* ← ADD THIS LINE */
}

.error-message.persistent {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-size: 0.9rem;
  margin: 0.5rem 0;
  animation: fadeInUp 0.3s ease;
}

.error-message.persistent .upgrade-btn {
  background: #EF4444;
  color: #fff;
  border-radius: 8px;
  padding: 6px 10px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85rem;
  transition: background 0.2s ease;
}

.error-message.persistent .upgrade-btn:hover {
  background: #b91c1c;
}

/* reset native button look */
.upload-dropdown .upload-option{
  all:unset;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:10px 12px;
  border-radius:10px;
  cursor:pointer;
  width: calc(90% - 20px);  /* Changed from 90% */
  border: 1px solid #E2E8F0;
  box-shadow: 5 5px 25px rgba(11, 47, 78, 0.1);
  background: white;
}

.upload-dropdown .upload-option:hover{ background:#F1F7FF; max-width: 232px;}


/* parts */
.upload-option-icon{ font-size:1.25rem; line-height:1; }
.upload-option-text{ flex:1; min-width:0; }
.upload-option-title{ font-weight:400; font-size:14px; color:var(--text-primary); }
.upload-option-desc{ font-size:.8rem; color:var(--text-secondary); }
.upload-option-badge{ margin-left:auto; font-size:.72rem; font-weight:700; padding:3px 8px; border-radius:9999px; background:#e6f0ff; color:#004085; }
.upload-option-badge.disabled{ background:#fde8e8; color:#b91c1c; }


/* Quick access chips */
.quick-tools{ margin:6px 0 10px; }
.quick-tools-title{ font-size:.8rem; color:var(--text-secondary); margin-bottom:6px; }
.quick-tools-grid{
  display:grid; grid-auto-flow:column; grid-auto-columns:max-content;
  gap:6px; overflow-x:auto; padding-bottom:4px;
}
/* File attachment card */
.file-attachment {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #f8f9fa;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    margin: 8px 0;
    max-width: 400px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
    cursor: pointer;
}

.file-attachment:hover {
    background: #e9ecef;
    border-color: #c5c5c5;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.file-icon {
    font-size: 2rem;
    line-height: 1;
    flex-shrink: 0;
}

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

.file-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.file-download-icon {
    font-size: 1.25rem;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.file-attachment:hover .file-download-icon {
    color: var(--text-primary);
}

/* Multiple files container */
.files-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}
.quick-tool{
  display:inline-flex; align-items:center; gap:6px;
  padding:6px 10px; border-radius:8px; border:1px solid var(--border-light);
  background:#fff; text-decoration:none; color:var(--text-primary); font-size:.82rem;
  white-space:nowrap;
}
.quick-tool:hover{ background:#f7f7f8; }

/* Categories */
.tools-grid{ display:grid; gap:8px; }
.tool-category{
  border:1px solid var(--border-light); border-radius:12px; background:#fff;
}
.category-header{
  display:flex; align-items:center; justify-content:space-between;
  padding:10px 12px; cursor:pointer; user-select:none; font-weight:600;
}
.category-header .category-arrow{ font-size:.85rem; color:var(--text-secondary); transition:transform .2s ease; }
.tool-category.expanded .category-header .category-arrow{ transform:rotate(180deg); }
.tool-category .category-tools{
  display:none; padding:8px 12px 12px; border-top:1px dashed #eee;
}
.tool-category.expanded .category-tools{
  display:grid; grid-template-columns:repeat(2, minmax(0,1fr)); gap:8px;
}

/* Items as chips */
.tool-item-ai{
  display:inline-flex; align-items:center;
  padding:6px 10px; border-radius:8px; border:1px solid var(--border-light);
  background:#fff; text-decoration:none; color:var(--text-primary); font-size:.85rem;
}
.tool-item-ai:hover{ background:#f7f7f8; }

/* =========================================================
   Mobile tweaks
   ========================================================= */
@media (max-width: 768px){
  .upload-dropdown{ min-width:min(92vw, 360px); left:8px; }
}


@media (max-width: 768px) {
  :root { --dock-h: 160px; }
  .messages-container{ padding-bottom: var(--dock-h); }
}

/* Input field */
.input-field {
    flex: 1;
    padding: 0.5rem 0;
    border: none;
    font-size: 16px !important; /* prevent iOS zoom */
    line-height: 1.5;
    outline: 0;
    resize: none;
    min-height: 24px;
    max-height: 200px;
    font-family: inherit;
    background: transparent;
    color: var(--text-primary);
}
.input-field::placeholder { color: #9a9a9a; }
.send-btn { background: transparent; border: none; color: var(--text-secondary); padding: 0.375rem; border-radius: 8px; font-size: 1rem; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; justify-content: center; min-height: 32px; min-width: 32px; flex-shrink: 0; }

.send-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.upload-container { position: relative; }
.image-btn { background: transparent; border: none; color: var(--text-secondary); padding: 0.375rem; border-radius: 8px; font-size: 1.25rem; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; justify-content: center; min-height: 32px; min-width: 32px; flex-shrink: 0; }
.image-btn:hover:not(:disabled) { background: #f7f7f8; color: var(--text-primary); }
.image-btn:disabled { opacity: 0.3; cursor: not-allowed; }


.upload-dropdown {
  position: absolute;
  bottom: 100%;
  left: 0;
  border-radius: 12px;
  margin-bottom: -0.2rem;
  z-index: 1000;
  padding: 6px 6px 6px 2px;  /* Changed from 0.25rem 0 */
  min-width: 280px;  /* Changed from 263px */
}

.upload-dropdown.show { display: block; }

/* Compact on mobile */
@media (max-width: 768px) {
  .chat-container { max-width: 100%; }
  .messages-container { padding: 1rem; gap: 0.75rem; padding-bottom: 140px; }
  .ai-disclaimer { font-size: 0.65rem; padding: 0.375rem 0.75rem 0.25rem; }
}

/* subtle translucent bar + blur on scroll */
.chat-nav{
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,.9);
  backdrop-filter: saturate(120%) blur(8px);
}

/* title truncation so it doesn’t wrap */
.chat-nav-title{
  max-width: 52vw;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* make action buttons look like compact pills and allow horizontal scroll when cramped */
.chat-nav-actions{
  display: flex; gap: 0rem;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.chat-nav-actions::-webkit-scrollbar{ display: none; }

.nav-btn{
  border-radius: 9999px;
  border: 0px solid var(--border-light);
  padding: .4rem .6rem;
  font-size: .78rem;
  background: #fff;
}

/* on small screens, tighten spacing; keep icons visible and text slightly smaller */
@media (max-width: 768px){
  .chat-nav{ padding: .5rem .75rem; }
  .nav-btn{ padding: .35rem .55rem; font-size: .72rem; }
  .nav-btn i{ font-size: 1rem; }
}
@media (max-width: 420px){
  .chat-nav-actions .nav-btn{ gap: 0; }
  .chat-nav-actions .nav-btn > i{ margin-right: 0; }
  .chat-nav-actions .nav-btn{ font-size: 0; }        /* hide label text */
  .chat-nav-actions .nav-btn > i{ font-size: 1.05rem; } /* keep icons readable */
}

/* mobile: give the scrim real height */
@media (max-width: 768px){
  :root{ --dock-h: 180px; } /* room for input + disclaimer */
}

/* Sticky nav improvements (desktop + mobile) */
.chat-nav{
  position: sticky;
  top: 0;
  z-index: 120;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
}

/* Add a shadow once page is scrolled a bit (JS toggles .is-stuck) */
.chat-nav.is-stuck{
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
}

/* Mobile compaction */
@media (max-width:768px){
  .chat-nav{ padding:.5rem .75rem; }
  .chat-nav-left{ gap:.5rem; }
  .chat-nav-title{
    font-size:.9rem;
    max-width:50vw;
    white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  }
  /* Icon-only action buttons on phones */
  .chat-nav-actions .nav-btn{
    width:36px; height:36px;
    padding:0; border:none; border-radius:10px;
    display:inline-grid; place-items:center;
    font-size:0;
  }
  .chat-nav-actions .nav-btn i{ font-size:18px; }
}

/* AI Disclaimer */
.ai-disclaimer {
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-secondary);
    padding-top: 0.5rem;
    margin: 0;
}

/* Typing indicator */
.typing-indicator { display: none; width: 100%; max-width: 48rem; margin: 0 auto; animation: fadeInUp .25s ease-out both; }
.typing-indicator.show { display: block; }
.typing-indicator .bubble .bubble-furobox{ display: flex; align-items: center; gap: 0.5rem; padding: 0.625rem 0.875rem; background: white; border: 1px solid var(--border-light); }
.typing-dots { display: flex; gap: 3px; }
.typing-dots span { width: 6px; height: 6px; background: var(--text-secondary); border-radius: 50%; animation: typing 1.4s infinite; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

/* Error states */
.error-message { background: #fef2f2; border: 1px solid #fecaca; color: #dc2626; padding: 0.625rem 0.875rem; border-radius: 8px; font-size: 0.8rem; margin: 0.5rem 0; }
.warning-message { background: #fff3cd; border: 1px solid #ffeaa7; color: #856404; padding: 0.625rem 0.875rem; border-radius: 8px; font-size: 0.8rem; margin: 0.5rem 0; }

/* Image modal */
.image-modal { display: none; position: fixed; z-index: 2000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.8); backdrop-filter: blur(4px); }
.image-modal.show { display: flex; align-items: center; justify-content: center; }
.image-modal img { max-width: 90vw; max-height: 90vh; border-radius: 12px; box-shadow: 0 8px 32px rgba(0,0,0,0.3); }
.image-modal-close { position: absolute; top: 20px; right: 20px; color: white; font-size: 2rem; cursor: pointer; background: rgba(0,0,0,0.5); border: none; border-radius: 50%; width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; }

@keyframes fadeInUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes typing { 0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); } 30% { opacity: 1; transform: scale(1); } }

/* Prevent iOS Safari zoom on input focus (extra guard) */
@media (max-width: 768px) {
  .fx-input input,
  .fx-select,
  input[type="text"],
  input[type="search"],
  input[type="email"],
  input[type="url"],
  input[type="tel"],
  input[type="number"],
  textarea {
    font-size: 16px !important;   /* ≥16px stops the auto-zoom */
    line-height: 1.4;
  }
}
/* Typing indicator - improved styling */
.typing-indicator {
    display: none;
    width: 100%;
    max-width: 48rem;
    margin: 0 auto;
    animation: fadeInUp .25s ease-out both;
}
.typing-indicator.show {
    display: block;
}

.typing-indicator .message {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.typing-indicator .bubble {
    background: white;
    border: 0px solid var(--border-light);
    border-radius: 18px;
    padding: 0.75rem 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
}

.typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.typing-dots span {
    width: 7px;
    height: 7px;
    background: #94a3b8;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) {
    animation-delay: 0s;
}

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

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

.typing-indicator .typing-text {
    font-size: 0.875rem;
    color: #64748b;
    font-weight: 500;
    margin: 0;
    line-height: 1;
}

@keyframes typing {
    0%, 60%, 100% {
        opacity: 0.25;
        transform: translateY(0);
    }
    30% {
        opacity: 1;
        transform: translateY(-4px);
    }
}
/* Better formatted math and content */
.bubble .md {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-primary);
}

/* Math blocks */
.bubble .md .katex-display {
  margin: 1rem 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.5rem;
  background: #f8f9fa;
  border-radius: 8px;
}

.bubble .md .katex {
  font-size: 1.05em;
}

/* Step headers */
.bubble .md h3,
.bubble .md h4 {
  color: #1d4ed8;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  font-weight: 600;
  padding-bottom: 0.25rem;
  border-bottom: 2px solid #e5e7eb;
}

/* Lists */
.bubble .md ul,
.bubble .md ol {
  margin: 0.75rem 0;
  padding-left: 1.5rem;
}

.bubble .md li {
  margin: 0.5rem 0;
  line-height: 1.6;
}

/* Code blocks - better spacing */
.bubble .md pre {
  margin: 1rem 0;
  border: 1px solid #e5e7eb;
}

/* Blockquotes - better styling */
.bubble .md blockquote {
  border-left: 4px solid #3b82f6;
  background: #eff6ff;
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  border-radius: 0 8px 8px 0;
}

/* Tables */
.bubble .md table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

.bubble .md th,
.bubble .md td {
  border: 1px solid #e5e7eb;
  padding: 0.5rem 0.75rem;
  text-align: left;
}

.bubble .md th {
  background: #f3f4f6;
  font-weight: 600;
}
.message.user .user-bubble {
  position: relative;
  padding-bottom: 8px;
}

.user-actions {
  position: absolute;
  bottom: -30px;
  right: 6px;
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 10;
}

.message.user .user-bubble:hover .user-actions {
  opacity: 1;
}

.user-action-btn {
  background: white;
  /* border: 0px solid var(--border-light); */
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  padding: 5px 5px; /* Adjusted padding */
  border-radius: 6px;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap; /* Prevent text wrapping */
  /* outline: 0.5px solid transparent; */
  border: 0.5px solid transparent;
}

.user-action-btn:hover {
  /* background: #f7f7f8; */
  color: var(--text-primary);
  /* border-color: #c5c5c5; */
  /* outline: 0.5px solid rgba(27, 145, 248, 0.4); */
  border: 0.5px solid rgba(27, 145, 248, 0.4);
}

.user-action-btn i {
  font-size: 12px; /* Slightly smaller icons */
}

/* Edit mode styling */
.user-bubble.editing {
  background: #fff !important;
  min-width: 0 !important;
  border: 1px solid #e5e5e5 !important;
  padding: 8px !important;
  max-width: none !important;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  width: 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

.message.user:has(.user-bubble.editing) .bubble {
  max-width: 100% !important;
  width: 100% !important;
}

.edit-textarea {
  width: 100%;
  min-height: 80px;
  max-width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.875rem;
  line-height: 1.5;
  resize: vertical;
  margin-bottom: 10px;
  box-sizing: border-box;
  background: #fafafa;
  transition: all 0.2s ease;
}

.edit-textarea:focus {
  outline: none;
  /* border-color: rgba(27, 145, 248, 0.4); */
  background: #fafafa;
}

.edit-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
}

.edit-btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.edit-btn-save {
  background: #0B2F4E;
  color: white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  font-weight: 400;
}

.edit-btn-save:hover {
  background: #0B2F4E;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.edit-btn-save:active {
  transform: translateY(0);
}

.edit-btn-cancel {
  background: transparent;
  color: var(--text-primary);
  border: 0.5px solid var(--border-light);
  /* outline: 0.5px solid transparent; */
  /* border: 0.5px solid transparent; */
  font-weight: 400;
}

.edit-btn-cancel:hover {
  background: transparent;
  color: var(--text-primary);
  /* border-color: #d0d0d0; */
  /* outline: 0.5px solid rgba(27, 145, 248, 0.4); */
  border: 0.5px solid rgba(27, 145, 248, 0.4);

}

/* Edited indicator - more subtle */
.edited-indicator {
  font-size: 0.7rem;
  color: #999;
  font-style: italic;
  margin-left: 6px;
  display: inline-block;
  opacity: 0.7;
}
/* Model indicator row - left-aligned, tight spacing */
.message.bot .model-indicator-row {
  display: flex;
  align-items: center;
  gap: 0.5rem; /* Small gap between model name and copy button */
  margin-top: 0.5rem;
}

.model-indicator {
  font-size: 0.65rem;
  color: var(--text-secondary);
  padding: 0.2rem 0.4rem;
  background: rgba(0,0,0,0.05);
  border-radius: 4px;
  display: inline-block;
  margin: 0;
}

/* Inline copy button - always visible */
.message-action-inline {
  background: transparent;
  border: none;
  padding: 2px 2px;
  border-radius: 4px;
  font-size: 0.7rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  /* outline: 0.5px solid transparent; */
  border: 0.5px solid transparent;
}

.message-action-inline {
  opacity: 0.6;
}

.message-action-inline:hover {
  opacity: 1;
  /* outline: 0.5px solid rgba(27, 145, 248, 0.4); */
  border: 0.5px solid rgba(27, 145, 248, 0.4);
}


.message-action-inline:hover {
  /* background: #f7f7f8;  */
  color: var(--text-primary);
}

.message-action-inline i {
  font-size: 11px;
}

/* Hide old message-actions completely */
.message-actions {
  display: none !important;
}

/* Business agent page */
/* [YES] Business chat specific styles */
.business-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 1rem;
}

.business-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.business-header p {
    margin: 0.5rem 0 0;
    opacity: 0.95;
    font-size: 0.95rem;
}

/* Hide certain elements for business chats */
.is-business-chat .chat-nav-actions {
    display: none !important;  /* Hide edit/delete/export buttons */
}


.is-business-chat .upload-container {
    display: none !important;  /* Hide file upload */
}

.is-business-chat .voiceButton {
    display: none !important;  /* Hide voice input */
}

/* Email container - styled exactly like code blocks */
.email-container {
  position: relative;
  margin: 1rem 0;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 0.75rem;
  padding-top: 2.75rem;  /* Space for buttons */
}

.email-content {
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-primary);
  white-space: pre-wrap;
}

.email-subject {
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: #1d4ed8;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #e5e7eb;
}

.email-body {
  color: var(--text-primary);
}

/* Action buttons bar - positioned like code copy button */
.email-actions-bar {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 6px;
  align-items: center;
  z-index: 100;
}

/* Copy button - same style as code copy */
.email-copy-btn {
  background: white;
  backdrop-filter: blur(8px);
  /* border: none; */
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  padding: 5px 5px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #374151;
  transition: background 0.2s ease, color 0.2s ease;
  /* outline: 0.5px solid transparent; */
  border: 0.5px solid transparent;
}

.email-copy-btn:hover {
  background: transparent;
  color: #333;
  /* outline: 0.5px solid rgba(27, 145, 248, 0.4); */
  border: 0.5px solid rgba(27, 145, 248, 0.4);
}

.email-copy-btn i {
  font-size: 13px;
  line-height: 1;
}

/* Three-dot menu button */
.email-menu-btn {
  background: white;
  backdrop-filter: blur(8px);
  /* border: none; */
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  padding: 7px 7px;
  display: inline-flex;
  align-items: center;
  /* justify-content: center; */
  gap: 4px;
  color: #374151;
  transition: background 0.2s ease, color 0.2s ease;
  position: relative;
  /* outline: 0.5px solid transparent; */
  border: 0.5px solid transparent;
}

.email-menu-btn:hover {
  background: transparent;
  color: #333;
  /* outline: 0.5px solid rgba(27, 145, 248, 0.4); */
  border: 0.5px solid rgba(27, 145, 248, 0.4);
}

.email-menu-btn i {
  font-size: 15px;
  line-height: 1;
}

/* Dropdown menu */
.email-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  padding: 4px;
  min-width: 180px;
  display: none;
  z-index: 1000;
}

.email-dropdown.show {
  display: block;
}

.email-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
  color: var(--text-primary);
  text-decoration: none;
  transition: background 0.15s ease;
  cursor: pointer;
  /* outline: 0.5px solid transparent; */
  border: 0.5px solid transparent;
}

.email-dropdown-item:hover {
  /* background: #f7f7f8; */
  /* outline: 0.5px solid rgba(27, 145, 248, 0.4); */
  border: 0.5px solid rgba(27, 145, 248, 0.4);
}

.email-dropdown-item i {
  font-size: 16px;
  width: 18px;
  text-align: center;
}

.email-dropdown-item:first-child i {
  color: #1a73e8;
}

.email-dropdown-item:last-child i {
  color: #0078d4;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .file-preview,
  .message-document {
    filter: brightness(0.85);
  }

  .message-document-name {
    color: #d1d5db;
  }

  .message-document-size {
    color: #9ca3af;
  }
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .email-container {
    padding-top: 3.5rem;  /* More space on mobile */
  }

  .email-actions-bar {
    top: 10px;
    right: 10px;
  }
}
/* Hide email wrapper text in markdown when email container is present */
.bubble-furobox:has(.email-container) .md > p:first-child {
  display: none;
}

.bubble-furobox:has(.email-container) .md > p:last-child {
  display: none;
}

.bubble-furobox:has(.email-container) .md > hr {
  display: none;
}
.email-subject {
  font-size: 14px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  color: var(--text-primary, #1f2937);
  line-height: 1.5;
}

.email-subject strong {
  font-weight: 600;
  color: var(--text-secondary, #6b7280);
  margin-right: 4px;
}

.email-body {
  font-size: 14px;
  line-height: 1.8;  /* ← Better spacing between lines */
  color: var(--text-primary, #1f2937);
  white-space: normal;  /* ← Allow wrapping */
}

.email-body strong {
  font-weight: 600;
  color: #374151;
  display: inline-block;
  margin-top: 0.75rem;  /* ← Space above bold labels */
}

.email-body br + strong {
  margin-top: 0.75rem;  /* ← Extra space above bold labels after line breaks */
}


/* Ensure page can scroll */
html, body {
    height: auto !important;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto !important;
}

/* Chat container should not constrain scrolling */
.chat-container {
    background: white;
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    max-width: 800px;
    font-size: 15px;
    margin: 0 auto;
    -webkit-text-size-adjust: 100%;
    touch-action: manipulation;
    min-height: 100vh; /* ← Add this */
    height: auto; /* ← Add this */
}

/* Messages container - no overflow, just padding */
.messages-container {
    position: relative;
    flex: 1;
    min-height: 100vh;
    padding-top: 4rem;
    padding-bottom: calc(var(--dock-h) + 10px);
    background: white;
    scroll-behavior: auto;
     overflow: visible !important;
}
/* Scroll to bottom button - positioned above input */
.scroll-to-bottom {
  position: fixed;
  bottom: calc(var(--dock-h) + -17px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 150;

  width: 30px;
  height: 30px;
  border-radius: 50%;

  background: white;
  border: 1px solid var(--border-light);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);

  display: flex;
  align-items: center;
  justify-content: center;

  cursor: pointer;

  /* [YES] Added 'left' to transitions for sidebar movement */
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease, left 0.3s ease;
}

/* [YES] NEW: Adjust position when sidebar is expanded (desktop only) */
@media (min-width: 769px) {
  body.sidebar-open .scroll-to-bottom {
    left: calc(50% + 120px); /* Half of 240px sidebar width */
  }
}

.scroll-to-bottom.show {
  opacity: 1;
  pointer-events: auto;
}

.scroll-to-bottom:hover {
  background: #f7f7f8;
  border-color: #c5c5c5;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.scroll-to-bottom:active {
  transform: translateX(-50%) scale(0.95);
}

.scroll-to-bottom i {
  font-size: 14px;
  color: var(--text-primary);
  transition: transform 0.2s ease;
}

.scroll-to-bottom:hover i {
  transform: translateY(2px);
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .scroll-to-bottom {
    bottom: calc(var(--dock-h) + -7px);
    width: 36px;
    height: 36px;
  }

  .scroll-to-bottom i {
    font-size: 16px;
  }
}

.code-block-container::-webkit-scrollbar {
  height: 8px;
}

.code-block-container::-webkit-scrollbar-track {
  background: #e5e7eb;
  border-radius: 4px;
}

.code-block-container::-webkit-scrollbar-thumb {
  background: #9ca3af;
  border-radius: 4px;
}

.code-block-container::-webkit-scrollbar-thumb:hover {
  background: #6b7280;
}
/* Connection error styling */


.error-content {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 12px;
}

.error-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.error-text strong {
    display: block;
    margin-bottom: 4px;
    font-size: 14px;
    font-weight: 400;
}

.error-text p {
    font-size: 13px;
    margin: 0;
}

.retry-message-btn {
    background: #EF4444;
    color: white;
    border: none;
    padding: 4px 0px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 400;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s ease;
    width: 20%;
    justify-content: center;
}

.retry-message-btn:hover {
    background: #B91C1C;
}

.retry-message-btn i {
    font-size: 14px;
}
.user-action-btn img {
  width: 16px;
  height: 16px;
  display: block;
  transition: filter 0.2s ease;
}

.user-action-btn:hover img {
  filter: brightness(0.8);
}

.user-action-btn:active img {
  filter: brightness(0.6);
}
@media (max-width: 768px) {
    .message.bot .avatar {
        display: none;
    }
}
/* ============================================================================
   INPUT CONTAINER - Match Home Page Design
   ============================================================================ */



/* Buttons - Match home page styling EXACTLY */

.send-btn {
    width: clamp(32px, 8vw, 30px);
    height: clamp(32px, 8vw, 30px);
    min-width: 25px;
    min-height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    border-radius: clamp(6px, 0.8vw, 8px);
    transition: all 0.15s ease;
    position: relative;
    overflow: hidden;
}


/* Send button - Dark blue background */
.send-btn {
    background: #0B2F4E;
}

.send-btn i,
.send-btn .bi,
.send-btn svg {
    font-size: clamp(0.9rem, 2vw, 1rem);
    color: white;
    width: 28px;
    height: 28px;
}


/* Voice listening state - Match home page */

/* Drag state - Match home page */


/* Icon buttons */
.icon-btn {
    width: clamp(36px, 8vw, 30px);
    height: clamp(36px, 8vw, 30px);
    min-width: 25px;
    min-height: 25px;
    background: #0B2F4E;
    place-items: center;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.icon-btn {
    background: #ffffff;
    position: relative;
    overflow: hidden;
}

.icon-btn i {
    font-size: clamp(0.9rem, 2vw, 1rem);
    color: #0B2F4E;
}

.icon-btn.listening {
    background: #E8F1FF;
    border-color: #0071E3;
}

.icon-btn.listening i {
    color: #0071E3;
    animation: pulse 1.5s infinite;
}

/* Model selector */
.search-model-selector {
    display: flex;
    align-items: center;
}

.search-model-selector .model-selector:hover {
    background-color: #F1F7FF;
    inset: 1px !important; /* controls padding of the pill */
    border-radius: var(--radius-sm);
}
.search-model-selector {
    position: relative;
}


@keyframes modelSlideUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auto-expand {
  overflow-y: hidden;
  resize: none;
}
.furo-input-shell textarea {
   min-height: clamp(40px, 6vh, 44px);
}



/* ============================================================================
   MODEL DROPDOWN - UPWARD OPENING (CHAT PAGE ONLY)
   ============================================================================ */

/* Only apply upward positioning on chat page */
.chat-container .search-model-selector .model-dropdown {
    position: absolute !important;
    bottom: calc(100% + 8px) !important; /* 8px gap above button */
    top: auto !important;
    left: 0 !important;
    animation: modelSlideUp 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

@keyframes modelSlideUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile: Keep at bottom (chat page only) */
@media (max-width: 768px) {
    .chat-container .search-model-selector .model-dropdown {
        position: fixed !important;
        bottom: 80px !important;
        top: auto !important;
        left: 16px !important;
        right: 16px !important;
    }
}

/* ============================================================================
   INPUT CONTAINER - SYNCHRONIZED WITH MESSAGE CONTAINER
   ============================================================================ */

.input-container {
    position: fixed;
    bottom: 0;
    z-index: 100;

    /* Match messages container width */
    width: 100%;
    max-width: 800px;

    /* Center it */
    left: 50%;
    transform: translateX(-50%);

    padding: 1rem 1rem 0.2rem 1rem;
    background: transparent;

    /* ADD: Same transition as main-content-wrapper for sidebar toggle */
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    opacity: 1;
}

/* Desktop: Shift with sidebar */
@media (min-width: 769px) {
    /* When sidebar is closed (60px collapsed width) */
    body:not(.sidebar-open) .input-container {
        left: calc(50% + 30px) !important; /* 60px / 2 = 30px */
        transform: translateX(-50%) !important;
    }

    /* When sidebar is open (235px expanded width) */
    body.sidebar-open .input-container {
        left: calc(50% + 117.5px) !important; /* 235px / 2 = 117.5px */
        transform: translateX(-50%) !important;
    }
}

/* Mobile: Full width */
@media (max-width: 768px) {
    .input-container {
        left: 0 !important;
        right: 0;
        transform: none !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 0.75rem;
        transition: none; /* No transitions on mobile */
    }
}

/* CRITICAL: Disable transitions during page navigation */
.loading .input-container,
.page-transition-enter .input-container {
    opacity: 0 !important;
    pointer-events: none !important;
    transition: none !important; /* No transition during page load */
}

/* Bottom scrim - same synchronized transition */
.bottom-scrim {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100vw;
    height: 5vw;
    background: #fff;
    pointer-events: none;
    z-index: 99;

    /* ADD: Same transition for smooth movement */
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (min-width: 769px) {
    /* When sidebar is closed */
    body:not(.sidebar-open) .bottom-scrim {
        left: 60px;
        width: calc(100vw - 60px);
    }

    /* When sidebar is open */
    body.sidebar-open .bottom-scrim {
        left: 235px;
        width: calc(100vw - 235px);
    }
}

/* Disable transitions during page navigation */
.loading .bottom-scrim,
.page-transition-enter .bottom-scrim {
    opacity: 0;
    transition: none !important;
}

/* CRITICAL: Prevent scroll during page transitions */
body.loading,
body:has(.page-transition-enter) {
    overflow: hidden !important;
}

/* Restore scroll after transition */
body {
    overflow-y: auto;
    overflow-x: hidden;
}

/* Input container - ensure it doesn't block scrolling */
@media (max-width: 768px) {
    .input-container {
        padding: 1rem 0.75rem 0.75rem 0.75rem;
        /* Add background to prevent transparency issues */
        background: linear-gradient(to top, white 80%, transparent);
    }
}


@media (max-width: 768px) {

    /* Add bottom margin to scroll anchor */
    #chat-scroll-anchor {
        display: block;
        height: 80px; /* Extra clearance */
        margin-bottom: 0;
    }
}

.typing-indicator .typing-text {
    display: block;
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
    min-height: 16px;
}

.typing-indicator .typing-text:empty {
    display: none;
}
.user-bubble.editing .user-actions {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Also hide on hover while editing (prevent flicker) */
.message.user .user-bubble.editing:hover .user-actions {
  opacity: 0 !important;
  display: none !important;
}


.messages-container:has(.tool-card) {
  min-height: unset !important;
}

/* Remove the giant spacer if it somehow survives into blocked state */
.messages-container:has(.tool-card) #temp-scroll-spacer {
  display: none !important;
}

.add-item--disabled {
    pointer-events: none;
}

.add-item--disabled .add-item__icon,
.add-item--disabled .add-item__title {
    opacity: 0.5;
}

.add-item--disabled a {
    pointer-events: all !important;
    cursor: pointer !important;
    color: #1B91F8 !important;
    opacity: 1 !important;
    filter: none !important;
}

.add-item--disabled .add-item__desc-text {
    color: #9CA3AF;
}

.add-item--disabled .add-item__desc a {
    color: #1B91F8 !important;
    pointer-events: all !important;
    cursor: pointer !important;
}
