/* ==========================================================================
   Tariff Radar — chat assistant (ChatGPT-style) layout
   ========================================================================== */

.chat-body { margin: 0; height: 100vh; overflow: hidden; background: var(--bg); }
.chat-app { display: flex; height: 100vh; }

.brand-tile {
    display: inline-flex; align-items: center; justify-content: center;
    width: 42px; height: 42px; border-radius: 11px; font-size: 20px;
    background: linear-gradient(135deg, var(--saffron), #ffffff 55%, var(--green));
    box-shadow: inset 0 0 0 1px rgba(0,0,0,.06);
}
.brand-tile.sm { width: 30px; height: 30px; border-radius: 8px; font-size: 15px; }
.brand-tile.lg { width: 66px; height: 66px; border-radius: 16px; font-size: 32px; }

/* ---- Sidebar ---- */
.chat-sidebar {
    width: 280px; flex-shrink: 0; background: #fff; border-right: 1px solid var(--line);
    display: flex; flex-direction: column; padding: 16px 14px;
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 4px 4px 14px; }
.bt-name { font-weight: 800; font-size: 17px; color: var(--navy-800); line-height: 1.1; }
.bt-sub { font-size: 12px; color: var(--gold-dk); font-weight: 700; }
.side-newchat {
    width: 100%; border: 0; cursor: pointer; padding: 12px 16px; border-radius: 12px;
    font-weight: 800; font-size: 15px; color: #3a2a00; text-align: left;
    background: linear-gradient(180deg, var(--gold-2), var(--gold)); box-shadow: 0 4px 12px rgba(242,169,0,.3);
}
.side-newchat:hover { filter: brightness(1.03); }
.side-recent-label { font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); font-weight: 700; margin: 20px 6px 8px; }
.side-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.side-empty { color: var(--muted); font-size: 13px; padding: 6px; font-style: italic; }
.conv-item {
    display: block; padding: 9px 11px; border-radius: 9px; color: var(--ink); font-size: 14px;
    text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.conv-item:hover { background: #f1f4fa; color: var(--navy-800); }
.conv-item.active { background: #fff3d6; }
.side-foot { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 8px; font-size: 12px; }
.side-foot a { color: var(--navy-600); font-weight: 600; text-decoration: none; }
.side-foot .muted { color: var(--muted); margin-top: 4px; }

/* ---- Main column ---- */
.chat-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat-top {
    display: flex; align-items: center; gap: 10px; padding: 12px 20px;
    border-bottom: 1px solid var(--line); background: #fff;
}
.chat-top strong { color: var(--navy-800); font-size: 16px; }
.online { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--green); font-weight: 700; }
.online .dot { width: 8px; height: 8px; border-radius: 50%; background: #22b268; box-shadow: 0 0 0 3px rgba(34,178,104,.2); }
.top-link { margin-left: auto; font-size: 13px; color: var(--navy-600); font-weight: 600; text-decoration: none; }
.top-link:hover { color: var(--navy-800); }
.menu-btn { display: none; border: 0; background: none; font-size: 20px; cursor: pointer; color: var(--navy-800); }

/* ---- Scroll area ---- */
.chat-scroll { flex: 1; overflow-y: auto; padding: 24px 20px; }

/* Welcome / empty state */
.welcome { max-width: 760px; margin: 6vh auto 0; text-align: center; }
.welcome h1 { font-size: 34px; margin: 16px 0 8px; color: var(--navy-800); font-weight: 800; }
.welcome h1 .accent { color: var(--gold-dk); }
.welcome-lede { color: var(--muted); max-width: 560px; margin: 0 auto 22px; font-size: 15.5px; }
.setup-note { background: var(--warn-bg); color: var(--warn); border: 1px solid #f3dfa6; border-radius: 12px; padding: 12px 16px; font-size: 13.5px; margin-bottom: 20px; }
.sugg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; text-align: left; }
.sugg-card {
    background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px;
    cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .1s; font-family: inherit;
}
.sugg-card:hover { border-color: var(--gold); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.sc-title { font-weight: 700; color: var(--navy-800); margin-bottom: 4px; }
.sc-sub { font-size: 13px; color: var(--muted); }

/* Messages */
.msg-list { max-width: 800px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.msg { display: flex; gap: 12px; align-items: flex-start; }
.msg .avatar { flex-shrink: 0; width: 32px; height: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 800; }
.msg.user .avatar { background: var(--navy-800); color: #fff; }
.msg.bot .avatar { background: linear-gradient(135deg, var(--saffron), #fff 55%, var(--green)); }
.msg .bubble { padding: 12px 16px; border-radius: 14px; font-size: 15px; line-height: 1.6; max-width: 100%; }
.msg.user { flex-direction: row-reverse; }
.msg.user .bubble { background: #fff6e2; border: 1px solid #f2e3bd; color: var(--ink); border-top-right-radius: 4px; }
.msg.bot .bubble { background: #fff; border: 1px solid var(--line); color: var(--ink); border-top-left-radius: 4px; box-shadow: var(--shadow-sm); }
.msg .bubble p { margin: 0 0 8px; } .msg .bubble p:last-child { margin-bottom: 0; }
.msg .bubble ul { margin: 6px 0; padding-left: 20px; } .msg .bubble li { margin: 3px 0; }
.msg .bubble code { background: #eef1f7; padding: 1px 5px; border-radius: 5px; font-size: 13px; }
.msg .bubble strong { color: var(--navy-800); }

/* Typing indicator */
.typing .bubble { display: inline-flex; gap: 5px; align-items: center; }
.typing .d { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing .d:nth-child(2) { animation-delay: .2s; } .typing .d:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%,60%,100% { opacity: .25; } 30% { opacity: 1; } }

/* ---- Input ---- */
.chat-input-wrap { padding: 12px 20px 16px; background: linear-gradient(180deg, rgba(238,241,247,0), var(--bg) 40%); }
.chat-input {
    max-width: 800px; margin: 0 auto; display: flex; align-items: flex-end; gap: 8px;
    background: #fff; border: 1px solid var(--line); border-radius: 26px; padding: 8px 8px 8px 18px;
    box-shadow: var(--shadow-sm);
}
.chat-input:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(242,169,0,.15); }
.chat-input textarea {
    flex: 1; border: 0; outline: 0; resize: none; font-family: inherit; font-size: 15px;
    line-height: 1.5; max-height: 160px; padding: 8px 0; background: transparent; color: var(--ink);
}
.send-btn {
    flex-shrink: 0; width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer;
    background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: #3a2a00; font-size: 16px;
    display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(242,169,0,.35);
}
.send-btn:disabled { opacity: .5; cursor: default; box-shadow: none; }
.chat-disclaimer { max-width: 800px; margin: 8px auto 0; text-align: center; font-size: 11.5px; color: var(--muted); }

/* ---- Responsive ---- */
@media (max-width: 820px) {
    .chat-sidebar { position: fixed; z-index: 40; top: 0; bottom: 0; left: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0,0,0,.2); }
    .chat-sidebar.open { transform: translateX(0); }
    .menu-btn { display: inline-block; }
    .sugg-grid { grid-template-columns: 1fr; }
}
