:root{
  --bg0:#000000;            /* pure black */
  --bg1:#12121a;
  --panel:rgba(255,255,255,.04);
  --glass:rgba(255,255,255,.06);
  --text:#e7e7ea;
  --text-dim:#a9a9b3;
  --brand:#814ACB;          /* StrataMind purple */
  --brand-2:#814ACB;
  --stroke:rgba(255,255,255,.08);
}
/* Stop iOS auto-zoom on focus */
html { -webkit-text-size-adjust: 100%; }
input, textarea, select, button { font-size: 16px; }

/* Make the chat app height stable on mobile (no jump when URL bar hides) */
.app { height: 100dvh; }        /* modern mobile units */
@supports not (height: 100dvh) {
  .app { height: 100vh; }       /* fallback */
}

/* Keep the composer pinned above the keyboard */
.composer { position: sticky; bottom: 0; }

/* Ensure the textarea itself is 16px too (your body is 14px) */
.composer textarea {
  font-size: 16px;
  line-height: 1.35;
}

/* Reduce bouncing & accidental page scrolls inside the chat */
.messages { overscroll-behavior: contain; }
*{ box-sizing:border-box }
html,body{ height:100% }

body{
  margin:0;
  background: var(--bg0);   /* remove old orange/cyan gradients */
  color:var(--text);
  font: 500 14px/1.45 Inter, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji","Segoe UI Emoji";
}

/* ====== Layout ====== */
.app{
  height:100vh;
  display:grid;
  grid-template-columns: 280px 1fr;
  gap:1px;
  background:var(--stroke);
}

.sidebar{
  background:var(--bg1);
  padding:16px;
  display:flex;
  flex-direction:column;
  gap:12px;
}
.brand{
  font-family:Poppins, Inter, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial;
  font-weight:700; letter-spacing:.2px; font-size:18px;
  color:#fff; opacity:.9; margin-bottom:4px;
}
.btn{
  border:1px solid var(--stroke); background:var(--glass);
  color:#fff; padding:10px 12px; border-radius:12px; cursor:pointer
}
.btn--full{ width:100%; text-align:center }
.btn--glass:hover{ background:rgba(255,255,255,.09) }

.history{
  margin-top:8px; display:flex; flex-direction:column; gap:8px; overflow:auto
}
.history-item{
  padding:10px 12px; border-radius:10px; background:rgba(255,255,255,.03);
  border:1px solid var(--stroke); color:var(--text-dim); cursor:pointer
}
.history-item.active{ outline:1px solid rgba(255,255,255,.18); color:#fff }

.main{ background:var(--bg1); display:flex; flex-direction:column; }
.topbar{
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 16px; border-bottom:1px solid var(--stroke);
  position:sticky; top:0; backdrop-filter:saturate(140%) blur(6px);
  background:linear-gradient(to bottom, rgba(12,12,16,.65), rgba(12,12,16,.35));
}
.title{ font-weight:600; color:#fff; opacity:.95 }
.actions{ display:flex; gap:8px; align-items:center }

.pill{
  display:inline-flex; align-items:center; justify-content:center;
  height:36px; padding:0 14px; border-radius:999px;
  text-decoration:none; font-weight:600; letter-spacing:.2px;
  border:1px solid var(--stroke);
}
.pill--primary{
  background:linear-gradient(180deg, var(--brand), var(--brand-2));
  color:#fff; box-shadow:0 0 22px rgba(129,74,203,.35);
}
.pill--primary:hover{ filter:brightness(1.05) }
.pill--secondary{ background:rgba(255,255,255,.06); color:#fff }
.pill--secondary:hover{ background:rgba(255,255,255,.1) }

/* ====== Chat ====== */
.chatwrap{ display:flex; flex-direction:column; height:100% }
.messages{
  flex:1; overflow:auto; padding:18px;
  display:flex; flex-direction:column; gap:12px;
  scroll-behavior:smooth;
}
.msg{
  max-width:820px; padding:12px 14px; border-radius:14px; border:1px solid var(--stroke);
  background:rgba(255,255,255,.03);
}
.msg.user{ align-self:flex-end; background:rgba(255,255,255,.06) }
.msg.bot{  align-self:flex-start }
.msg small{ display:block; margin-top:6px; color:var(--text-dim) }

/* content container inside a bubble (for typewriter, etc.) */
.msg .bubble{ display:block }

/* Tidy markdown inside bubbles */
.msg .bubble h1,
.msg .bubble h2,
.msg .bubble h3{
  margin: 6px 0 6px;
  font-size: 14px;
  line-height: 1.2;
  font-weight: 700;
}
.msg .bubble p{ margin: 6px 0; }
.msg .bubble ul, .msg .bubble ol{
  list-style-position: outside;
  margin: 6px 0 10px 18px;
  padding-left: 18px;
}
.msg .bubble ul li{ list-style-type: disc;  margin:2px 0; }
.msg .bubble ol li{ list-style-type: decimal; margin:2px 0; }
.msg .bubble code{
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  background: rgba(255,255,255,.06);
  border: 1px solid var(--stroke);
  padding: 0 4px; border-radius: 4px;
}

/* Optional pre/code blocks */
.msg pre{
  background: rgba(255,255,255,.05);
  border:1px solid var(--stroke);
  padding:10px; border-radius:8px;
  overflow:auto; font-size:12px;
}

/* ====== Composer ====== */
.composer{
  display:flex; gap:10px; padding:14px 16px; border-top:1px solid var(--stroke);
  background:rgba(7,7,11,.65); backdrop-filter: blur(6px) saturate(130%);
}
.composer textarea{
  flex:1; resize:vertical; min-height:44px; max-height:30vh;
  border-radius:12px; padding:12px 12px; border:1px solid var(--stroke);
  background:rgba(255,255,255,.04); color:#fff; outline:none;
}
.composer textarea::placeholder{ color:rgba(255,255,255,.45) }

/* ====== Modal (Create Ticket) ====== */
.modal{
  position: fixed; inset: 0;
  display: none;
  align-items: center; justify-content: center;
  z-index: 50;
}
.modal.show { display: flex; }

/* dark blur behind */
.modal::before{
  content:"";
  position:absolute; inset:0;
  backdrop-filter: blur(10px) saturate(120%);
  background: rgba(0,0,0,0.45);
}

/* dialog card */
.modal-card{
  position: relative;
  width: min(720px, 92vw);
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: rgba(18,18,26,0.92);    /* less transparent */
  box-shadow: 0 10px 40px rgba(0,0,0,.45);
  padding: 16px;
  color: var(--text);
}
.modal header{ font-weight:700; margin-bottom:10px }
.modal footer{ display:flex; gap:8px; justify-content:flex-end; margin-top:8px }
.modal textarea{
  width:100%; min-height:120px; border-radius:10px;
  border:1px solid var(--stroke); background: rgba(255,255,255,.04);
  color:#fff; padding:10px
}
.modal input{
  width:100%; border-radius:10px; border:1px solid var(--stroke);
  background: rgba(255,255,255,.04); color:#fff; padding:10px; margin-bottom:8px
}

/* ====== Responsive ====== */
@media (max-width: 960px){
  .app{ grid-template-columns: 1fr }
  .sidebar{ display:none }
}
/* make markdown bold visibly bold */
.msg .bubble strong { font-weight: 700; }
/* clear visual split between history and chat */
.sidebar { border-right: 1px solid var(--stroke); }
.msg .bubble ul,
.msg .bubble ol {
  margin: 8px 0 10px 20px;
  padding-left: 18px;
}
.msg .bubble li { margin: 2px 0; }
/* Only the chat pane scrolls */
html, body { height: 100%; overflow: hidden; }
.app { height: 100vh; }
.main, .chatwrap { min-height: 0; }
.messages { overflow: auto; }

/* Sidebar has its own scroll if long */
.sidebar { overflow: auto; border-right: 1px solid var(--stroke); }

/* Make markdown look crisp inside bubbles */
.msg .bubble strong { font-weight: 700; }
.msg .bubble ul, .msg .bubble ol { margin: 8px 0 10px 20px; padding-left: 18px; }
.msg .bubble li { margin: 2px 0; }
/* Step headings like "1. Title:" */
.msg .bubble h3.step{
  margin: 10px 0 6px;
  font-size: 14px;
  line-height: 1.25;
  font-weight: 700;
}
.msg .bubble .step-num{
  opacity: .75;
  margin-right: 6px;
}

/* Make sure numbered lists actually show numbers cleanly */
.msg .bubble ol{
  list-style: decimal outside;
  margin: 6px 0 6px 20px;
  padding-left: 0;
}
.msg .bubble ul{
  list-style: disc outside;
  margin: 6px 0 6px 20px;
  padding-left: 0;
}
/* —— EMBED MODE (for Framer iframe) —— */
.embed .app{ grid-template-columns:1fr; height:100dvh; }
.embed .sidebar{ display:none; }
.embed .actions{ display:none; }        /* hides KnowledgeHub/Tickets buttons in topbar */
.embed .topbar{ padding:10px 12px; }
.embed body, .embed html{ height:100%; }
/* --- Mobile layout pass --- */
@media (max-width: 768px) {

  /* Hide the chat history column */
  #history {
    display: none !important;
  }

  /* Let the main area use the full width */
  .main, #messages {
    width: 100% !important;
  }

  /* Make the messages panel fill the viewport,
     leaving room for the input at the bottom */
  #messages {
    /* adjust the 76px if your input bar is taller/shorter */
    height: calc(100dvh - 76px) !important;
    overflow-y: auto;
  }

  /* Keep the composer (form) stuck to the bottom */
  #chatForm {
    position: sticky;
    bottom: 0;
    background: rgba(0,0,0,0.6);      /* or your panel color */
    backdrop-filter: blur(6px);       /* optional nicety */
    padding: 10px 12px;               /* space around input */
    border-top: 1px solid var(--stroke, rgba(255,255,255,.1));
  }

  /* Make the input comfortable to tap */
  #input {
    min-height: 42px;
    line-height: 1.3;
  }

  /* Keep top-right buttons from overflowing */
  .topbar,
  .topbar .right,
  .topbar .buttons {
    flex-wrap: wrap;
    gap: 8px;
  }
}
/* icon links inside bubbles */
.icon-link { display:inline-block; margin-right:8px; line-height:1; }
.icon-link svg { display:inline-block; }
