/* ═══════════════════════════════════════════════════════
   IsonAI Chat Refine v1 - CHAT_REFINE_V1
   Warm dark redesign · Additive CSS override
   Loaded after main styles + mobile patches.
   Revert: remove <link> from chat.html + delete this file.
   ═══════════════════════════════════════════════════════ */

/* ── DARK THEME: warmer, lighter palette ── */
/* sidebar #171915 < chat #1e201b - chat is brighter */
[data-theme="dark"] {
  --bg-0: #22211d;   /* WARM_STONE_CHARCOAL_V1: comfortable warm dark chat reading area */
  --bg-1: #181815;   /* WARM_STONE_CHARCOAL_V1: sidebar deeper warm dark */
  --bg-2: #2b2a24;
  --bg-3: #35342d;
  --bg-4: #403e36;
  --bg-user: rgba(154,137,104,0.18);
  --bg-glass: rgba(34,33,29,0.55);  /* GLASS_TOPBAR_V1 */
  --tx: #f4f0e6;
  --tx-2: #c2bcaf;
  --code-bg: #191815;
  --code-hd: #252420;
}

/* ── SIDEBAR: darker, wider, more breathing room ── */
.sb {
  width: 270px;
  background: var(--bg-1);
}
.sb-top {
  margin-bottom: 6px;
  padding: 8px 8px 10px;
}
/* SIDEBAR_LOGO_TEXT_V1 + SIDEBAR_LOGO_TYPE_MATCH_V1 - brand lockup is now mark
   PNG + live text so the wordmark takes the theme instead of being baked
   copper-on-blue. Type/metrics reproduce the old lockup PNG exactly (measured
   off it at its 0.48 display scale); only the colour differs.
   Wordmark is Poppins Medium -- NOT var(--font-d); the old CSS claimed Outfit
   but the artwork never was (x/cap 0.797 vs Poppins .791, Outfit .714).
   Tracking +0.26px: old ink/cap 4.2273 vs Poppins natural 4.1571.
   gap 0.88 = 2.88 design gap - 2.00 'I' side bearing; top -1.13 aligns baseline. */
.sb-top .logo {
  gap: 0.88px;
   padding: 4px 0 0 6.96px;
}
.sb-top .logo img {
  width: 34.08px !important;
  height: 34.08px !important;
  border-radius: 0;
}
.sb-top .logo-text {
  display: inline !important;
  font-family: 'Poppins', system-ui, sans-serif;
  font-weight: 500;
  font-size: 26.67px;
  letter-spacing: 0.26px;
  position: relative;
  top: -1.13px;
  color: #ffffff;
}
[data-theme="light"] .sb-top .logo-text {
  color: #000000;
}
/* PURPLE_CLEANUP_V2 */
.sb-new {
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 13.5px;
  background: linear-gradient(135deg, rgba(154,137,104,0.1), rgba(142,129,112,0.06));
  border-color: rgba(154,137,104,0.18);
  color: var(--ac);
  margin-bottom: 8px;
}
.sb-new:hover {
  background: linear-gradient(135deg, rgba(154,137,104,0.16), rgba(142,129,112,0.1));
  border-color: rgba(154,137,104,0.3);
}
.sb-search {
  border-radius: 10px;
  margin-bottom: 16px;
}
.sb-list {
  gap: 3px;
}

/* Sidebar active chat item - copper left accent */
.sb-list .c-it.on,
.sb-list .c-it.active,
.sb-list .c-it[class*="active"] {
  border-left: 2px solid rgba(154,137,104,0.4);
  background: rgba(154,137,104,0.07);
  border-radius: 0 10px 10px 0;
}
.sb-list .c-it {
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
}

/* Sidebar footer - profile area */
.sb-foot {
  padding-top: 10px;
}
.sb-foot .u-av {
  width: 32px;
  height: 32px;
  font-size: 12px;
  background: linear-gradient(135deg, var(--ac), var(--ac-2));
}

/* ── MAIN AREA ── */
.mn {
  background: var(--bg-0);
}

/* ── TOPBAR: cleaner, no heavy border ── */
/* GLASS_TOPBAR_V1: pronounced frosted-glass topbar (blur + saturate + sheen) */
.topbar {
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-bottom: 0;  /* GLASS_TOPBAR_V1: borderless frosted-glass topbar - no divider/sheen lines (centering stays 7/7) */
  box-shadow: none;
}
[data-theme="light"] {
  --bg-0: #FFFFFF;
  --bg-1: #FDFBF6;
  --bg-2: #F8F3E7;
  --bg-3: #EFE6D2;
  --bg-4: #DED0B3;
  --bg-user: rgba(44,74,111,.075);
  --bg-glass: rgba(253,251,246,.90);
  --tx: #1F1812;
  --tx-2: rgba(31,24,18,.74);
  --ac: #2C4A6F;
  --ac-2: #3B5D86;
  --ac-3: #1F3858;
}
.topbar-title {
  font-size: 15px;
}
.top-btn {
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.07);
  padding: 6px 12px;
  font-size: 12px;
}
.top-ico {
  border-radius: 8px;
}

/* ── CHAT MESSAGES: constrained width, generous spacing ── */
.msg-wrap {
  background: var(--bg-0);
}
[data-theme="dark"] .msg-wrap {
  background: radial-gradient(ellipse 75% 50% at 50% -5%, rgba(184, 154, 100, 0.16) 0%, rgba(184, 154, 100, 0.04) 50%, transparent 75%), var(--bg-0);
}
[data-theme="light"] .msg-wrap {
  background: radial-gradient(ellipse 65% 45% at 28% -5%, rgba(107, 138, 153, 0.16) 0%, transparent 65%), radial-gradient(ellipse 65% 45% at 72% -5%, rgba(196, 154, 108, 0.18) 0%, transparent 65%), #FFFFFF;
}
.msg-inner {
  max-width: 840px;
  margin: 0 auto;
  padding-left: 40px;
  padding-right: 40px;
}
.msg {
  margin-bottom: 26px;
}

/* User bubble: copper tint, rounder */
.msg.user .m-body {
  background: var(--bg-user);
  border: 1px solid rgba(154,137,104,0.20);
  border-radius: 22px 22px 6px 22px;
  padding: 14px 22px;
}
[data-theme="dark"] .msg.user .m-body {
  background: #2f2d26;
  border: 1px solid rgba(184, 154, 100, 0.32);
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25), 0 1px 3px rgba(0, 0, 0, 0.16);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* AI response: spacious typography */
.msg.assistant .m-txt p,
.msg.assistant .m-txt li {
  line-height: 1.7;
}
.msg.assistant .m-txt {
  font-size: 0.94rem;
}
.msg.assistant .m-head {
  margin-bottom: 6px;
}

/* ── INPUT AREA: pill shape, constrained width ── */
.input-area {
  background: linear-gradient(to top, var(--bg-0) 65%, rgba(34, 33, 29, 0.85) 80%, transparent);
}
.input-wrap {
  max-width: 840px;
  margin: 0 auto;
}
.input-box {
  border-radius: 22px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
}
[data-theme="dark"] .input-box {
  background: #2a2923;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.36), 0 2px 6px rgba(0, 0, 0, 0.20);
  transition: border-color 0.22s ease, box-shadow 0.22s ease, background 0.22s ease;
}
[data-theme="dark"] .input-box:focus-within {
  background: #2f2e27;
  border-color: rgba(184, 154, 100, 0.45);
  border-top-color: rgba(220, 195, 150, 0.65);
  box-shadow: 0 0 0 1px rgba(184, 154, 100, 0.40), 0 14px 44px rgba(0, 0, 0, 0.42), 0 0 30px rgba(184, 154, 100, 0.14);
}

/* Input tools: rounded hover zones */
.in-tool {
  border-radius: 10px;
  width: 32px;
  height: 32px;
}
.in-tool:hover {
  background: rgba(255,255,255,0.06);
}

/* Send button: gradient purple */
.send-btn {
  background: none !important;
  border: none !important;
  box-shadow: none !important;
}
.send-btn:hover {
  background: rgba(154,137,104,0.1) !important;
  box-shadow: none !important;
}
.send-btn.stop {
  background: var(--red) !important;
  box-shadow: 0 2px 8px var(--red-dim) !important;
}

/* ── MESSAGE ACTIONS: cleaner ── */
.m-acts button {
  border-radius: 8px;
}
.m-acts button:hover {
  background: rgba(255,255,255,0.05);
}

/* ── WELCOME / SUGGESTIONS: match constrained width ── */
.msg-inner > .welcome,
.msg-inner > .sug-area {
  max-width: 100%;
}

/* ── DISCLAIMER FOOTER ── */
.input-foot {
  text-align: center;
  opacity: 0.6;
}

/* ── SCROLLBAR: match warmer palette ── */
[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: var(--bg-4);
}

/* ── SPARK SIDEBAR BTN: match new rounding ── */
.spark-sidebar-btn {
  border-radius: 10px;
}

/* ── RESPONSIVE: don't break mobile ── */
@media (max-width: 768px) {
  .sb {
    width: 280px;
  }
  .msg-inner {
    padding-left: 16px;
    padding-right: 16px;
    max-width: 100%;
  }
  .input-wrap {
    max-width: 100%;
  }
  .msg.user .m-body {
    border-radius: 18px 18px 6px 18px;
  }
  .input-box {
    border-radius: 18px;
  }
  .wel-title {
    font-size: 1.85rem !important;
    letter-spacing: -0.015em !important;
  }
}

/* REFINE_WELCOME_V1 - hide suggestion boxes, push welcome down */
.sugs {
  display: none !important;
}
.welcome {
  margin-top: 18vh;
  min-height: 40vh;
}

/* ASSISTANT_DARK_WHITE_V1 + WARM_STONE_CHARCOAL_V1: warm soft-white chat text
   instead of harsh glaring #FFFFFF. Light mode keeps semantic --tx ramp. */
[data-theme="dark"] .msg.user .m-txt,
[data-theme="dark"] .msg.assistant .m-txt,
[data-theme="dark"] .msg.assistant .m-txt p,
[data-theme="dark"] .msg.assistant .m-txt li,
[data-theme="dark"] .msg.assistant .m-txt h1,
[data-theme="dark"] .msg.assistant .m-txt h2,
[data-theme="dark"] .msg.assistant .m-txt h3 {
  color: #f4f0e6 !important;
}

/* ── GEMINI_ELEGANCE_V1: Welcome Gradient Ink & Subtle Aura ── */
[data-theme="dark"] .wel-title {
  font-size: 2.8rem !important;
  font-weight: 600 !important;
  background: linear-gradient(135deg, #FFFFFF 15%, #EADABE 50%, #B8935A 100%) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  background-clip: text !important;
  color: transparent !important;
  letter-spacing: -0.02em !important;
  margin-bottom: 12px !important;
}
[data-theme="dark"] .wel-logo img {
  filter: drop-shadow(0 0 28px rgba(184, 154, 100, 0.35)) drop-shadow(0 8px 18px rgba(0, 0, 0, 0.4));
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), filter 0.3s ease;
}
[data-theme="dark"] .wel-logo img:hover {
  transform: scale(1.05);
  filter: drop-shadow(0 8px 28px rgba(154, 137, 104, 0.32));
}
[data-theme="dark"] .wel-sub {
  color: var(--tx-2);
  line-height: 1.65;
}

[data-theme="light"] .wel-title {
  font-size: 2.8rem !important;
  font-weight: 600 !important;
  background: linear-gradient(135deg, #1F1812 25%, #2C4A6F 70%, #3B5D86 100%) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  background-clip: text !important;
  color: transparent !important;
  letter-spacing: -0.02em !important;
  margin-bottom: 12px !important;
}
[data-theme="light"] .wel-logo img {
  filter: drop-shadow(0 8px 24px rgba(44, 74, 111, 0.15));
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), filter 0.3s ease;
}
[data-theme="light"] .wel-logo img:hover {
  transform: scale(1.05);
  filter: drop-shadow(0 10px 30px rgba(44, 74, 111, 0.22));
}
[data-theme="light"] .wel-sub {
  color: rgba(31, 24, 18, 0.70);
  line-height: 1.65;
}

/* ── GEMINI_ELEGANCE_V1: Thinking & Streaming Polish ── */
[data-theme="dark"] #thinkInd {
  border: 1px solid rgba(154, 137, 104, 0.22);
  background: rgba(30, 29, 25, 0.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.14);
}
[data-theme="dark"] .think-toggle {
  transition: background 0.2s ease, color 0.2s ease;
}
[data-theme="dark"] .think-toggle:hover {
  background: rgba(154, 137, 104, 0.10);
  color: #f4f0e6;
}
[data-theme="dark"] .thinking {
  background: rgba(154, 137, 104, 0.08);
  border: 1px solid rgba(154, 137, 104, 0.22);
  box-shadow: 0 0 18px rgba(154, 137, 104, 0.08);
}
[data-theme="dark"] .think-bar {
  background: linear-gradient(180deg, #c8b593, var(--ac));
}

[data-theme="light"] #thinkInd {
  border: 1px solid rgba(44, 74, 111, 0.16);
  background: rgba(253, 251, 246, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 2px 10px rgba(31, 24, 18, 0.04);
}
[data-theme="light"] .think-toggle:hover {
  background: rgba(44, 74, 111, 0.06);
  color: #1F1812;
}
[data-theme="light"] .thinking {
  background: rgba(44, 74, 111, 0.05);
  border: 1px solid rgba(44, 74, 111, 0.18);
  box-shadow: 0 0 16px rgba(44, 74, 111, 0.06);
}
[data-theme="light"] .think-bar {
  background: linear-gradient(180deg, #3B5D86, #2C4A6F);
}
