/* ============================================================
   SAJEEL AI WALA — workspace (browser.html)
   ChatGPT-style shell: left sidebar + centered thread + composer
   Relies on tokens & .btn from styles.css
   ============================================================ */

.wb-shell {
  position: relative;
  z-index: 1;
  display: flex;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* ================= left sidebar ================= */
.wb-sidebar {
  width: 264px;
  flex: 0 0 264px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 14px 12px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(9, 11, 18, 0.72);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  backdrop-filter: blur(20px) saturate(150%);
  overflow-y: auto;
}

.wb-sidebar__top { display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.wb-sidebar__bottom { display: flex; flex-direction: column; gap: 10px; padding-top: 10px; }

.wb-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  padding: 6px 8px;
  border-radius: 12px;
  margin-bottom: 8px;
}
.wb-brand img { border-radius: 8px; width: 28px; height: 28px; object-fit: cover; }
.wb-brand span { font-weight: 700; letter-spacing: 0.02em; color: var(--text); font-size: 14px; }
.wb-brand em {
  font-style: normal;
  font-weight: 500;
  margin-left: 6px;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: 11px;
  letter-spacing: 0.14em;
}

.wb-newchat {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.wb-newchat:hover { background: rgba(255, 255, 255, 0.09); border-color: rgba(255, 255, 255, 0.18); }

.wb-side__label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 14px 4px 4px;
  color: var(--text-3);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.wb-side__clear {
  border: 0;
  background: none;
  color: var(--text-3);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  cursor: pointer;
  text-transform: none;
  padding: 2px 6px;
  border-radius: 8px;
}
.wb-side__clear:hover { color: var(--text-2); background: rgba(255,255,255,0.06); }

.wb-recents {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 2px;
  padding-right: 2px;
}
.wb-recents::-webkit-scrollbar { width: 6px; }
.wb-recents::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 999px; }

/* items reuse the old drawer-item classes for JS compatibility */
.wb-recents .wb-chat-drawer__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--t-fast) var(--ease);
}
.wb-recents .wb-chat-drawer__item:hover { background: rgba(255, 255, 255, 0.06); }
.wb-recents .wb-chat-drawer__item.is-active {
  background: rgba(91, 156, 255, 0.12);
  border-color: rgba(91, 156, 255, 0.25);
}
.wb-chat-drawer__title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-2);
  font-size: 13.5px;
}
.wb-chat-drawer__item.is-active .wb-chat-drawer__title { color: var(--text); }
.wb-chat-drawer__meta { color: var(--text-3); font-size: 11px; flex: 0 0 auto; }
.wb-chat-drawer__del {
  border: 0;
  background: none;
  color: var(--text-3);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 6px;
  opacity: 0;
  transition: opacity var(--t-fast) var(--ease);
}
.wb-chat-drawer__item:hover .wb-chat-drawer__del { opacity: 1; }
.wb-chat-drawer__del:hover { color: #ff7b7b; background: rgba(255, 123, 123, 0.1); }
.wb-chat-drawer__empty { color: var(--text-3); font-size: 12.5px; padding: 8px 10px; }

.wb-getapp {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  background: linear-gradient(120deg, rgba(91,156,255,0.16), rgba(169,123,255,0.12));
  transition: border-color var(--t-fast) var(--ease);
}
.wb-getapp:hover { border-color: rgba(91, 156, 255, 0.4); }

.wb-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}
.wb-profile__avatarwrap { position: relative; flex: 0 0 auto; }
.wb-profile__meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.wb-profile__meta b {
  color: var(--text);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wb-profile__meta i { color: var(--text-3); font-size: 11px; font-style: normal; }
.wb-profile__out {
  border: 0;
  background: none;
  color: var(--text-3);
  font-size: 11.5px;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 8px;
  flex: 0 0 auto;
}
.wb-profile__out:hover { color: var(--text); background: rgba(255, 255, 255, 0.07); }

/* provider badge (GitHub / Google) on the profile avatar */
.wb__user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  background: rgba(91, 156, 255, 0.16);
  border: 1px solid rgba(91, 156, 255, 0.3);
  background-size: cover;
  background-position: center;
}
.wb__user-badge {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 2px solid #0a0c13;
  background: #0d1117;
}
.wb__user-badge .gh-mark { width: 9px; height: 9px; fill: #fff; }
.wb__user-badge .g-mark { width: 10px; height: 10px; }

/* mobile sidebar toggle */
.wb-sb-toggle {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 60;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(10, 13, 20, 0.8);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: var(--text);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

/* ================= main column ================= */
.wb-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 16px;
}

.wb-thread {
  flex: 1;
  width: 100%;
  max-width: 780px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow-y: auto;
  padding: 24px 4px 8px;
  scrollbar-width: thin;
}
.wb-thread::-webkit-scrollbar { width: 6px; }
.wb-thread::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 999px; }

/* hero — ChatGPT "What's on your mind today?" empty state */
.wb-hero {
  margin: auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 18px;
  padding: 40px 12px 8px;
}
.wb-hero__logo {
  width: 72px;
  height: 72px;
  border-radius: 22px;
  object-fit: cover;
  box-shadow: 0 18px 50px rgba(91, 156, 255, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.1);
  animation: heroIn 700ms var(--ease) both;
}
@keyframes heroIn {
  from { opacity: 0; transform: translateY(14px) scale(0.92); filter: blur(6px); }
  to { opacity: 1; transform: none; filter: blur(0); }
}
.wb-hero__title {
  margin: 0;
  font-size: clamp(26px, 4vw, 36px);
  letter-spacing: -0.02em;
  color: var(--text);
  animation: heroIn 700ms 80ms var(--ease) both;
}
.wb-hero__chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  animation: heroIn 700ms 160ms var(--ease) both;
}
.wb-hero__chips button {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-2);
  font: inherit;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.wb-hero__chips button:hover {
  background: rgba(91, 156, 255, 0.12);
  border-color: rgba(91, 156, 255, 0.35);
  color: var(--text);
}

/* messages */
.wb-msgs { display: flex; flex-direction: column; gap: 18px; padding: 8px 0 16px; }
.wb-msgs:empty { display: none; }

.msg { display: flex; flex-direction: column; gap: 5px; max-width: 92%; }
.msg--user {
  align-self: flex-end;
  align-items: flex-end;
  background: rgba(91, 156, 255, 0.14);
  border: 1px solid rgba(91, 156, 255, 0.28);
  border-radius: 18px 18px 4px 18px;
  padding: 11px 15px;
}
.msg--user .msg__who { display: none; }
.msg--user p { margin: 0; color: var(--text); font-size: 14.5px; line-height: 1.55; white-space: pre-wrap; }

.msg--ai { align-self: stretch; max-width: 100%; }
.msg--ai .msg__who {
  color: var(--violet);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.msg--ai p { margin: 0; color: var(--text-2); font-size: 14.5px; line-height: 1.65; white-space: pre-wrap; }
.msg--ai .msg__link {
  margin-top: 4px;
  color: var(--blue);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
}
.msg--ai .msg__link:hover { text-decoration: underline; }

.msg--thinking { display: flex; gap: 5px; padding: 6px 0; }
.msg--thinking i {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-3);
  animation: think 1.1s infinite ease-in-out;
}
.msg--thinking i:nth-child(2) { animation-delay: 0.15s; }
.msg--thinking i:nth-child(3) { animation-delay: 0.3s; }
@keyframes think {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* composer — floating pill like ChatGPT */
.wb-composer {
  width: 100%;
  max-width: 780px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 8px 20px;
  border-radius: 26px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(14, 17, 26, 0.82);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  backdrop-filter: blur(24px) saturate(160%);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  margin-bottom: 8px;
}
.wb-composer:focus-within {
  border-color: rgba(91, 156, 255, 0.45);
  box-shadow: 0 12px 44px rgba(91, 156, 255, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.wb-composer input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  padding: 10px 0;
}
.wb-composer input::placeholder { color: var(--text-3); }
.wb-composer__send {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--grad);
  box-shadow: 0 6px 18px rgba(91, 156, 255, 0.35);
  transition: transform var(--t-fast) var(--ease), filter var(--t-fast) var(--ease);
}
.wb-composer__send:hover { transform: translateY(-1px); filter: brightness(1.1); }
.wb-composer__send:active { transform: scale(0.94); }
.wb-composer__send .icon { width: 18px; height: 18px; stroke: currentColor; }

.wb-composer__note {
  margin: 0 0 14px;
  color: var(--text-3);
  font-size: 11.5px;
  text-align: center;
  max-width: 640px;
}

/* ================= responsive ================= */
@media (max-width: 900px) {
  .wb-sb-toggle { display: grid; }
  .wb-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 55;
    transform: translateX(-100%);
    transition: transform 280ms var(--ease);
    width: 280px;
    flex-basis: auto;
    box-shadow: 24px 0 60px rgba(0, 0, 0, 0.5);
  }
  .wb-sidebar.is-open { transform: none; }
  .wb-main { padding-top: 64px; }
  .msg { max-width: 100%; }
}
@media (max-width: 560px) {
  .wb-hero__title { font-size: 24px; }
  .wb-hero__chips button { font-size: 12px; padding: 7px 12px; }
  .wb-composer { padding-left: 14px; border-radius: 22px; }
}

/* ================= fallbacks ================= */
@supports not (backdrop-filter: blur(1px)) {
  .wb-sidebar { background: #0b0e16; }
  .wb-composer { background: #12151f; }
}

@media (prefers-reduced-motion: reduce) {
  .wb-hero__logo, .wb-hero__title, .wb-hero__chips { animation: none; }
  .msg--thinking i { animation: none; opacity: 0.7; }
}

/* ============================================================
   Agent-style UI — thinking card, plan (to-do) card, rich text
   ============================================================ */

/* ---------- thinking card ---------- */
.think {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.02));
  border-radius: 14px;
  padding: 10px 14px 8px;
  max-width: 560px;
}
.think__head { display: flex; align-items: center; gap: 8px; }
.think__orb {
  width: 10px; height: 10px; border-radius: 50%;
  background: conic-gradient(from 0deg, var(--blue), var(--violet), var(--cyan), var(--blue));
  animation: think-spin 1.1s linear infinite;
  box-shadow: 0 0 10px rgba(91,156,255,0.55);
}
.think.is-done .think__orb { animation: none; background: var(--blue); box-shadow: none; opacity: 0.85; }
.think__label { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; color: var(--text-2); }
.think__steps { list-style: none; margin: 8px 0 2px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.think__steps li {
  font-size: 12.5px; color: var(--text-3);
  padding-left: 18px; position: relative; opacity: 0.45;
  transition: opacity 0.25s ease, color 0.25s ease;
}
.think__steps li::before {
  content: ""; position: absolute; left: 2px; top: 4px;
  width: 8px; height: 8px; border-radius: 50%;
  border: 1.5px solid var(--text-3); opacity: 0.5;
}
.think__steps li.is-run {
  opacity: 1; color: var(--text);
  background: linear-gradient(90deg, rgba(91,156,255,0.14), transparent 70%);
  border-radius: 6px;
}
.think__steps li.is-run::before {
  border-color: var(--blue);
  animation: think-pulse 0.9s ease-in-out infinite;
}
.think__steps li.is-done { opacity: 0.8; }
.think__steps li.is-done::before {
  content: "✓"; border: none; width: auto; height: auto; top: 0; left: 2px;
  font-size: 10px; color: var(--blue); opacity: 1;
}
@keyframes think-spin { to { transform: rotate(360deg); } }
@keyframes think-pulse { 50% { transform: scale(1.35); opacity: 0.6; } }

/* ---------- plan / to-do card ---------- */
.todo {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  border-radius: 14px;
  padding: 10px 14px 8px;
  margin: 4px 0 8px;
  max-width: 560px;
}
.todo__head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.todo__icon { font-size: 13px; color: var(--blue); }
.todo__title { font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-2); }
.todo__count { margin-left: auto; font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.todo__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.todo__item { display: flex; gap: 9px; align-items: flex-start; font-size: 13.5px; color: var(--text-2); }
.todo__box {
  flex: 0 0 auto; width: 14px; height: 14px; margin-top: 2px;
  border-radius: 4.5px; border: 1.5px solid var(--text-3);
  position: relative; transition: all 0.2s ease;
}
.todo__item.is-done .todo__box { background: rgba(79,216,232,0.15); border-color: var(--cyan); }
.todo__item.is-done .todo__box::after {
  content: "✓"; position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 10px; color: var(--cyan); font-weight: 700;
}
.todo__item.is-done .todo__text { color: var(--text-3); text-decoration: line-through; text-decoration-color: rgba(107,114,132,0.5); }

/* ---------- rich text (markdown-lite) ---------- */
.md { display: flex; flex-direction: column; gap: 8px; }
.md p { margin: 0; color: var(--text-2); font-size: 14.5px; line-height: 1.65; }
.md h3 { margin: 6px 0 0; color: var(--text); font-size: 14px; letter-spacing: 0.01em; }
.md ul, .md ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.md li { color: var(--text-2); font-size: 14px; line-height: 1.55; }
.md li::marker { color: var(--blue); }
.md strong { color: var(--text); font-weight: 650; }
.md em { color: var(--text-2); }
.md code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 12.5px; background: rgba(255,255,255,0.07);
  border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; color: var(--cyan);
}
.md pre {
  margin: 2px 0; background: rgba(0,0,0,0.45); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; overflow-x: auto;
}
.md pre code { background: none; border: none; padding: 0; color: var(--text-2); font-size: 12.5px; line-height: 1.5; }

@media (prefers-reduced-motion: reduce) {
  .think__orb { animation: none; }
  .think__steps li.is-run::before { animation: none; }
}

/* ---------- thinking card: expandable live reasoning pane ---------- */
.think__head {
  display: flex; align-items: center; gap: 8px;
  width: 100%; background: none; border: none; padding: 0;
  cursor: pointer; text-align: left; font: inherit;
}
.think__head:disabled { cursor: default; }
.think__chev { margin-left: auto; font-size: 10px; color: var(--text-3); transition: transform 0.18s ease; }
.think.is-open .think__chev { transform: rotate(180deg); }
.think__pane {
  margin-top: 8px; border-top: 1px solid var(--line); padding-top: 8px;
  max-height: 240px; overflow-y: auto;
}
.think__reason { display: flex; flex-direction: column; gap: 6px; }
.think__reason, .think__reason * {
  font-size: 12.5px; line-height: 1.6; color: var(--text-2);
  white-space: pre-wrap; font-style: italic;
}
.think__label { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; color: var(--text-2); }

/* ---------- live streaming answer ---------- */
.md--live p, .md--live li { animation: md-in 0.25s ease both; }
@keyframes md-in { from { opacity: 0.35; } to { opacity: 1; } }

/* ============================================================
   File & image tools — composer buttons, attach chips, msg cards
   ============================================================ */
.wb-composer__row { display: flex; align-items: center; gap: 8px; }
.wb-composer__row #wbChatInput { flex: 1 1 auto; }
.wb-composer__tool {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center;
  border: 1px solid var(--line); background: rgba(255,255,255,0.03);
  color: var(--text-2); cursor: pointer; transition: all 0.18s ease;
}
.wb-composer__tool:hover { color: var(--text); border-color: var(--line-strong); background: rgba(255,255,255,0.07); transform: translateY(-1px); }
.wb-composer__tool .icon { width: 17px; height: 17px; }

.wb-attach {
  display: flex; flex-wrap: wrap; gap: 7px; padding: 0 2px 9px;
}
.chip-attach {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 8px 5px 9px; border-radius: 10px;
  border: 1px solid var(--line); background: rgba(255,255,255,0.05);
  font-size: 12px; color: var(--text-2); max-width: 220px;
}
.chip-attach__ic { font-style: normal; font-size: 13px; }
.chip-attach--img img { width: 26px; height: 26px; object-fit: cover; border-radius: 6px; display: block; }
.chip-attach__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-attach__x {
  flex: 0 0 auto; width: 17px; height: 17px; border-radius: 50%;
  border: none; background: rgba(255,255,255,0.1); color: var(--text-2);
  font-size: 11px; line-height: 1; cursor: pointer; display: grid; place-items: center;
}
.chip-attach__x:hover { background: rgba(255,80,80,0.25); color: #fff; }

.msg-atts { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 7px; }
.msg-atts__img {
  width: 120px; height: 90px; object-fit: cover;
  border-radius: 10px; border: 1px solid var(--line-strong); display: block;
}
.msg-atts__card {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 11px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: rgba(255,255,255,0.06);
  font-size: 12.5px; color: var(--text);
}
.msg-atts__card i { font-style: normal; font-size: 12px; opacity: 0.8; }
.msg-atts__card small { color: var(--text-3); font-size: 10.5px; }
