/* ═══════════════════════════════════════════════════════════════════════════
   ArifLab Agentic AI Demo — Premium Dark Theme
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
    --bg: #09090b;
    --bg-surface: #0f0f12;
    --bg-elevated: #18181c;
    --bg-hover: #222228;
    --text: #ececef;
    --text-dim: #a0a3ad;
    --text-muted: #55575f;
    --accent: #ff6a2f;
    --accent-dim: rgba(255,106,47,0.12);
    --accent-mid: rgba(255,106,47,0.25);
    --green: #34d399;
    --green-dim: rgba(52,211,153,0.10);
    --yellow: #fbbf24;
    --yellow-dim: rgba(251,191,36,0.10);
    --red: #f87171;
    --red-dim: rgba(248,113,113,0.10);
    --blue: #60a5fa;
    --blue-dim: rgba(96,165,250,0.10);
    --border: rgba(255,255,255,0.06);
    --border-hi: rgba(255,255,255,0.10);
    --r: 8px;
    --font: 'Inter', system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
html { font-size:14px; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text-dim);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ─── HEADER ─────────────────────────────────────────────────────────────── */

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 48px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand { display: flex; align-items: center; gap: 8px; }
.brand-mark { color: var(--accent); font-size: 16px; font-weight: 700; }
.brand-name { font-size: 13px; font-weight: 700; color: var(--text); letter-spacing: 1.5px; }

.header-sep { width: 1px; height: 16px; background: var(--border-hi); }

.header-title {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.live-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--green);
    animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.3} }

.live-label { font-size: 11px; font-weight: 700; color: var(--green); letter-spacing: 1px; }
.mimo-badge { font-size: 11px; font-weight: 600; color: var(--accent); background: var(--accent-dim); padding: 2px 8px; border-radius: 4px; }

/* ─── ENQUIRY BAR ────────────────────────────────────────────────────────── */

.enquiry-bar {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
    flex-shrink: 0;
}

.enquiry-inner { max-width: 1100px; margin: 0 auto; }

.enquiry-input-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg);
    border: 1px solid var(--border-hi);
    border-radius: var(--r);
    padding: 4px 4px 4px 16px;
}

.enquiry-icon { color: var(--accent); font-size: 14px; flex-shrink: 0; }

.enquiry-input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    padding: 10px 0;
    outline: none;
}

.enquiry-input::placeholder { color: var(--text-muted); }

.btn-start {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s;
}
.btn-start:hover { background: #ff8248; }
.btn-start:disabled { opacity: .5; cursor: not-allowed; }
.btn-icon { font-size: 10px; }

.enquiry-samples {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.samples-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }

.sample-btn {
    padding: 4px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-dim);
    font-family: var(--font);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all .15s;
}
.sample-btn:hover { background: var(--bg-hover); border-color: var(--border-hi); color: var(--text); }

/* ─── MAIN LAYOUT ────────────────────────────────────────────────────────── */

.main-layout {
    display: grid;
    grid-template-columns: 160px 1fr 260px;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* ─── LEFT SIDEBAR — WORKFLOW ────────────────────────────────────────────── */

.sidebar-workflow {
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    padding: 16px 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar-title {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0 16px 12px;
}

.workflow-pipeline {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    padding: 0 12px;
}

.wf-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.wf-node {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 7px 10px;
    border-radius: 6px;
    border: 1px solid transparent;
    transition: all .3s;
    cursor: default;
}

.wf-node.active {
    background: var(--accent-dim);
    border-color: var(--accent-mid);
}

.wf-node.done {
    background: var(--green-dim);
    border-color: rgba(52,211,153,0.15);
}

.wf-node.waiting {
    opacity: .4;
}

.wf-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
    transition: background .3s;
}

.wf-node.active .wf-dot { background: var(--accent); animation: pulse 1.5s infinite; }
.wf-node.done .wf-dot { background: var(--green); }

.wf-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-dim);
    white-space: nowrap;
    transition: color .3s;
}

.wf-node.active .wf-label { color: var(--accent); font-weight: 600; }
.wf-node.done .wf-label { color: var(--green); }

.wf-connector {
    width: 1px;
    height: 8px;
    background: var(--border-hi);
    margin: 0 auto;
}

.wf-node.active ~ .wf-connector { background: var(--accent-mid); }

/* ─── CENTER FEED ────────────────────────────────────────────────────────── */

.center-feed {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg);
}

.feed-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.feed-title { font-size: 12px; font-weight: 600; color: var(--text); letter-spacing: .3px; }
.feed-count { font-size: 11px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.activity-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.activity-list::-webkit-scrollbar { width: 3px; }
.activity-list::-webkit-scrollbar-thumb { background: var(--bg-hover); border-radius: 3px; }

/* Empty state */
.empty-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
}

.empty-hero-icon { font-size: 28px; color: var(--text-muted); margin-bottom: 16px; opacity: .4; }
.empty-hero h3 { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty-hero p { font-size: 13px; color: var(--text-dim); max-width: 360px; line-height: 1.6; }
.empty-sub { color: var(--text-muted) !important; margin-top: 4px; }

/* Activity items */
.act-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-surface);
    animation: fadeUp .2s ease-out;
}

@keyframes fadeUp { from { opacity:0; transform:translateY(3px); } to { opacity:1; transform:translateY(0); } }

.act-agent {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
    flex-shrink: 0;
    letter-spacing: .2px;
}

.act-msg {
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.4;
    flex: 1;
}

.act-badge {
    font-size: 9px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: .5px;
    flex-shrink: 0;
}

.badge-ok { background: var(--green-dim); color: var(--green); }
.badge-wait { background: var(--yellow-dim); color: var(--yellow); }
.badge-err { background: var(--red-dim); color: var(--red); }
.badge-info { background: var(--blue-dim); color: var(--blue); }

/* Tool activity section */
.tool-section { border-top: 1px solid var(--border); flex-shrink: 0; }

.tool-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 20px;
    background: var(--bg-surface);
    border: none;
    color: var(--text-muted);
    font-family: var(--font);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    cursor: pointer;
    transition: color .15s;
}
.tool-toggle:hover { color: var(--text-dim); }

.tool-toggle-arrow { transition: transform .2s; }
.tool-toggle-arrow.open { transform: rotate(90deg); }

.tool-panel {
    max-height: 200px;
    overflow-y: auto;
    padding: 8px 16px 12px;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tool-panel::-webkit-scrollbar { width: 3px; }
.tool-panel::-webkit-scrollbar-thumb { background: var(--bg-hover); border-radius: 3px; }

.tool-row {
    display: grid;
    grid-template-columns: 90px 1fr 1.5fr 60px;
    gap: 8px;
    padding: 5px 8px;
    font-size: 11px;
    border-radius: 4px;
    align-items: center;
    animation: fadeUp .15s ease-out;
}

.tool-row:nth-child(odd) { background: rgba(255,255,255,0.015); }

.tool-row-name { color: var(--accent); font-weight: 500; font-family: monospace; font-size: 10px; }
.tool-row-agent { color: var(--text-muted); }
.tool-row-result { color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tool-row-time { color: var(--text-muted); text-align: right; font-variant-numeric: tabular-nums; }

/* ─── RIGHT SIDEBAR ──────────────────────────────────────────────────────── */

.sidebar-right {
    background: var(--bg-surface);
    border-left: 1px solid var(--border);
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.decision-panel { flex: 1; }

.decision-idle {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 12px;
    text-align: center;
    opacity: .5;
}
.decision-idle-icon { font-size: 24px; color: var(--text-muted); margin-bottom: 12px; }
.decision-idle p { font-size: 12px; color: var(--text-muted); }

.decision-current {
    padding: 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-hi);
    border-radius: var(--r);
    margin-bottom: 12px;
}

.decision-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 6px;
}

.decision-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    line-height: 1.4;
}

.decision-meta {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.decision-row {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
}

.decision-row-label { color: var(--text-muted); }
.decision-row-value { color: var(--text-dim); font-weight: 500; }

/* Final result */
.final-result { margin-top: auto; }

.result-section {
    margin-bottom: 12px;
}

.result-section-title {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 8px;
}

.result-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.result-cell {
    padding: 8px 10px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.result-cell-label {
    font-size: 9px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 2px;
}

.result-cell-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.result-cell-value.accent { color: var(--accent); }
.result-cell-value.green { color: var(--green); }
.result-cell-value.dim { color: var(--text-dim); font-weight: 400; }

.result-outputs {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.result-output-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 11px;
    color: var(--text-dim);
}

.result-output-dot {
    width: 5px; height: 5px; border-radius: 50%;
    background: var(--green);
    flex-shrink: 0;
}

/* ─── FOOTER ─────────────────────────────────────────────────────────────── */

.footer {
    padding: 12px 24px;
    border-top: 1px solid var(--border);
    text-align: center;
    flex-shrink: 0;
}

.footer p { font-size: 11px; color: var(--text-muted); line-height: 1.5; }

/* ─── APPROVAL MODAL ─────────────────────────────────────────────────────── */

.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.85);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal {
    background: var(--bg-surface);
    border: 1px solid var(--border-hi);
    border-radius: 12px;
    width: 420px; max-width: 92vw;
    overflow: hidden;
    animation: modalIn .2s ease-out;
}
@keyframes modalIn { from { opacity:0; transform:scale(.96); } to { opacity:1; transform:scale(1); } }

.modal-badge {
    padding: 14px 24px;
    background: var(--accent-dim);
    border-bottom: 1px solid var(--accent-mid);
    font-size: 12px; font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: var(--border);
}

.modal-cell {
    padding: 14px 16px;
    background: var(--bg-surface);
}

.modal-cell-label {
    font-size: 10px; font-weight: 600; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px;
}

.modal-cell-value {
    font-size: 18px; font-weight: 700; color: var(--text);
}

.modal-cell-value.accent { color: var(--accent); font-size: 22px; }
.modal-cell-value.green { color: var(--green); }

.modal-reason {
    padding: 14px 16px;
    border-top: 1px solid var(--border);
    font-size: 12px; color: var(--text-dim); line-height: 1.5;
}

.modal-buttons {
    display: flex;
    gap: 0;
    border-top: 1px solid var(--border);
}

.modal-buttons button {
    flex: 1;
    padding: 14px;
    border: none;
    font-family: var(--font);
    font-size: 12px; font-weight: 600;
    cursor: pointer;
    transition: background .15s;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.btn-approve { background: var(--accent); color: #fff; }
.btn-approve:hover { background: #ff8248; }

.btn-reject { background: var(--red-dim); color: var(--red); border-left: 1px solid var(--border) !important; }
.btn-reject:hover { background: rgba(248,113,113,0.15); }

.btn-changes { background: var(--bg-elevated); color: var(--text-dim); border-left: 1px solid var(--border) !important; }
.btn-changes:hover { background: var(--bg-hover); }

/* ─── RESPONSIVE ─────────────────────────────────────────────────────────── */

@media (max-width: 1024px) {
    .main-layout { grid-template-columns: 140px 1fr 220px; }
}

@media (max-width: 768px) {
    .main-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
    }
    .sidebar-workflow {
        flex-direction: row;
        overflow-x: auto;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 8px 12px;
    }
    .workflow-pipeline { flex-direction: row; gap: 0; padding: 0; }
    .wf-connector { width: 12px; height: 1px; margin: 0; }
    .wf-step { flex-direction: row; }
    .sidebar-title { display: none; }
    .sidebar-right { border-left: none; border-top: 1px solid var(--border); max-height: 300px; }
    .enquiry-input-wrap { flex-wrap: wrap; }
    .btn-start { width: 100%; justify-content: center; }
}

@media (max-width: 480px) {
    .header { padding: 0 12px; }
    .header-title { display: none; }
    .enquiry-bar { padding: 12px; }
    .activity-list { padding: 8px; }
}
