/* =====================================================================
   BELTalk AI — chat console theme
   Dark "Network Operations Centre" aesthetic with glassmorphism.
   Layered on top of Bootstrap 5 (dark mode).
   ===================================================================== */

:root {
    --bg:          #080d17;
    --bg-2:        #0b1322;
    --glass:       rgba(148, 176, 214, 0.05);
    --glass-2:     rgba(148, 176, 214, 0.08);
    --glass-brdr:  rgba(148, 176, 214, 0.14);
    --accent:      #f5a524;   /* solar amber — brand */
    --accent-2:    #22d3aa;   /* electric teal — "operational" */
    --accent-soft: rgba(245, 165, 36, 0.14);
    --text:        #e8eef8;
    --muted:       #8ea1bd;
    --danger:      #ff6b6b;
    --radius:      16px;
    --mono:        ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, monospace;
    --sans:        "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    height: 100%;
    margin: 0;
}

body {
    font-family: var(--sans);
    color: var(--text);
    background:
        radial-gradient(1100px 600px at 85% -10%, rgba(245,165,36,0.10), transparent 60%),
        radial-gradient(900px 600px at -10% 110%, rgba(34,211,170,0.10), transparent 55%),
        linear-gradient(160deg, var(--bg), var(--bg-2));
    overflow: hidden;
}

/* faint ops-console grid overlay */
.noc-grid {
    position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.5;
    background-image:
        linear-gradient(rgba(148,176,214,0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148,176,214,0.035) 1px, transparent 1px);
    background-size: 46px 46px;
    mask-image: radial-gradient(circle at 50% 40%, #000 40%, transparent 92%);
}

.glass {
    background: var(--glass);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    border: 1px solid var(--glass-brdr);
}

/* ------------------------- layout ------------------------- */
.app-shell {
    position: relative; z-index: 1;
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 18px;
    height: 100vh;
    padding: 18px;
    max-width: 1360px;
    margin: 0 auto;
}

/* ------------------------- sidebar ------------------------ */
.noc-panel {
    border-radius: var(--radius);
    padding: 22px 20px;
    display: flex;
    flex-direction: column;
    gap: 22px;
    overflow-y: auto;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
    width: 46px; height: 46px; border-radius: 12px;
    display: grid; place-items: center;
    font-weight: 800; letter-spacing: 1px; font-size: 15px;
    color: #1a1206;
    background: linear-gradient(135deg, var(--accent), #ffd479);
    box-shadow: 0 6px 20px rgba(245,165,36,0.35);
}
.brand-name { font-weight: 700; font-size: 15px; }
.brand-sub  { font-size: 12px; color: var(--muted); }

.noc-status-title {
    font-family: var(--mono); font-size: 11px; letter-spacing: 2px;
    text-transform: uppercase; color: var(--muted); margin-bottom: 10px;
}
.status-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.status-label { font-weight: 600; }

.dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--accent-2);
    box-shadow: 0 0 0 0 rgba(34,211,170,0.6);
    animation: pulse 2s infinite;
}
.dot.sm { width: 8px; height: 8px; }
@keyframes pulse {
    0%   { box-shadow: 0 0 0 0 rgba(34,211,170,0.55); }
    70%  { box-shadow: 0 0 0 8px rgba(34,211,170,0); }
    100% { box-shadow: 0 0 0 0 rgba(34,211,170,0); }
}

.noc-readout { display: grid; gap: 8px; font-family: var(--mono); font-size: 12px; }
.noc-readout > div { display: flex; justify-content: space-between; color: var(--muted); }
.noc-readout b { color: var(--text); font-weight: 600; }

.noc-topics ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 7px; }
.noc-topics li {
    font-size: 13px; color: var(--muted);
    padding-left: 16px; position: relative;
}
.noc-topics li::before {
    content: ""; position: absolute; left: 0; top: 7px;
    width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
}

.calc-link {
    margin-top: auto;
    display: block; text-align: center;
    padding: 11px; border-radius: 12px;
    text-decoration: none; font-weight: 600; font-size: 14px;
    color: var(--accent);
    background: var(--accent-soft);
    border: 1px solid rgba(245,165,36,0.28);
    transition: transform .15s ease, background .2s ease;
}
.calc-link:hover { background: rgba(245,165,36,0.22); transform: translateY(-1px); }
.noc-foot { font-size: 11px; color: var(--muted); text-align: center; }

/* ------------------------- chat console ------------------- */
.chat-console {
    display: flex; flex-direction: column; gap: 14px;
    min-height: 0; /* allow the thread to scroll */
}

.chat-header {
    border-radius: var(--radius);
    padding: 14px 20px;
    display: flex; align-items: center; justify-content: space-between;
}
.chat-header-title { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.chat-header-meta  { font-size: 12px; color: var(--muted); font-family: var(--mono); }

.thread {
    flex: 1; min-height: 0;
    overflow-y: auto;
    padding: 6px 4px;
    display: flex; flex-direction: column; gap: 16px;
    scroll-behavior: smooth;
}

.msg { display: flex; gap: 12px; max-width: 90%; animation: rise .25s ease; }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.avatar {
    width: 34px; height: 34px; flex: 0 0 34px; border-radius: 10px;
    display: grid; place-items: center; font-size: 11px; font-weight: 700;
}
.bot-avatar {
    color: #1a1206;
    background: linear-gradient(135deg, var(--accent), #ffd479);
}
.user-avatar { color: var(--text); background: var(--glass-2); border: 1px solid var(--glass-brdr); }

.bubble {
    padding: 13px 16px; border-radius: 14px; line-height: 1.55; font-size: 14.5px;
    background: var(--glass);
    border: 1px solid var(--glass-brdr);
    backdrop-filter: blur(10px);
}
.msg.user .bubble {
    background: linear-gradient(135deg, rgba(245,165,36,0.22), rgba(245,165,36,0.10));
    border-color: rgba(245,165,36,0.30);
}
.bubble p { margin: 0 0 8px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble ul, .bubble ol { margin: 6px 0; padding-left: 20px; }
.welcome-lead { font-weight: 700; font-size: 16px; color: var(--text); }

.welcome-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.welcome-tags span {
    font-size: 11.5px; padding: 4px 9px; border-radius: 20px;
    background: var(--accent-soft); color: var(--accent);
    border: 1px solid rgba(245,165,36,0.22);
}

/* answer meta (confidence + feedback) */
.msg-meta {
    display: flex; align-items: center; gap: 12px;
    margin-top: 8px; font-size: 11px; color: var(--muted); font-family: var(--mono);
}
.msg-meta .fb { display: flex; gap: 6px; }
.msg-meta .fb button {
    background: none; border: none; cursor: pointer; color: var(--muted);
    font-size: 13px; padding: 0 2px; opacity: .8;
}
.msg-meta .fb button:hover { color: var(--text); opacity: 1; }
.msg-meta .fb button.active { color: var(--accent-2); }
.conf-pill { padding: 2px 8px; border-radius: 20px; background: var(--glass-2); }

/* typing indicator */
.typing { display: flex; gap: 5px; padding: 4px 2px; }
.typing span {
    width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
    animation: blink 1.2s infinite ease-in-out both;
}
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%,80%,100% { opacity:.25; transform: scale(.85);} 40% {opacity:1; transform: scale(1);} }

/* suggested chips */
.suggested { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    font-size: 13px; padding: 8px 13px; border-radius: 22px; cursor: pointer;
    color: var(--text);
    background: var(--glass);
    border: 1px solid var(--glass-brdr);
    transition: transform .15s ease, border-color .2s ease, background .2s ease;
}
.chip:hover { transform: translateY(-1px); border-color: rgba(245,165,36,0.5); background: var(--accent-soft); }

/* composer */
.composer {
    border-radius: var(--radius);
    padding: 10px 10px 10px 16px;
    display: flex; align-items: flex-end; gap: 10px;
}
.composer textarea {
    flex: 1; resize: none; border: none; outline: none; background: transparent;
    color: var(--text); font-family: var(--sans); font-size: 15px; line-height: 1.5;
    max-height: 140px; padding: 8px 0;
}
.composer textarea::placeholder { color: var(--muted); }
.composer button {
    flex: 0 0 42px; width: 42px; height: 42px; border-radius: 12px; border: none;
    cursor: pointer; display: grid; place-items: center; color: #1a1206;
    background: linear-gradient(135deg, var(--accent), #ffd479);
    transition: transform .15s ease, opacity .2s ease;
}
.composer button:hover { transform: translateY(-1px); }
.composer button:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.composer-hint { text-align: center; font-size: 11.5px; color: var(--muted); }

/* scrollbars */
.thread::-webkit-scrollbar, .noc-panel::-webkit-scrollbar { width: 8px; }
.thread::-webkit-scrollbar-thumb, .noc-panel::-webkit-scrollbar-thumb {
    background: var(--glass-brdr); border-radius: 8px;
}

/* ------------------------- responsive --------------------- */
@media (max-width: 860px) {
    body { overflow: auto; }
    .app-shell { grid-template-columns: 1fr; height: auto; min-height: 100vh; }
    .noc-panel { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 16px; }
    .noc-topics, .noc-foot { display: none; }
    .calc-link { margin-top: 0; }
    .chat-console { height: auto; }
    .thread { max-height: 60vh; }
    .msg { max-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
