/* Blueprint Hub — Ground Control */
:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --bg-panel: #0d1117;
    --border: #30363d;
    --border-light: #262c36;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --accent-blue: #58a6ff;
    --accent-green: #3fb950;
    --accent-yellow: #d29922;
    --accent-red: #f85149;
    --accent-purple: #bc8cff;
    --author-adrian: #58a6ff;
    --author-claude: #3fb950;
    --author-openclaw: #d29922;
    --author-system: #6e7681;
    --author-chatgpt: #bc8cff;
    --author-gemini: #2dd4bf;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

/* ---- Header ---- */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}
.header h1 { font-size: 16px; font-weight: 600; }
.header h1 span { color: var(--accent-blue); }
.header-status {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 13px;
    color: var(--text-secondary);
}
.status-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 4px;
}
.status-dot.connected { background: var(--accent-green); }
.status-dot.disconnected { background: var(--accent-red); }

/* ---- Session Bar ---- */
.session-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 7px 20px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
    font-size: 12px;
}
.session-bar .label { color: var(--text-muted); }
.session-bar .value { color: var(--text-primary); font-weight: 500; }
.session-bar .mode-badge {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2px 10px;
    font-size: 11px;
    color: var(--accent-blue);
}

/* ---- Main Layout ---- */
.main {
    display: flex;
    height: calc(100vh - 82px);
}

/* ---- Feed ---- */
.feed-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    min-width: 0;
}
.feed {
    flex: 1;
    overflow-y: auto;
    padding: 10px 16px;
}
.feed::-webkit-scrollbar { width: 5px; }
.feed::-webkit-scrollbar-track { background: transparent; }
.feed::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ---- Messages ---- */
.message {
    padding: 6px 0;
    border-bottom: 1px solid var(--border-light);
    animation: fadeIn 0.25s ease-in;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; } }
.message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 3px;
}
.message-author {
    font-weight: 600;
    font-size: 12px;
    text-transform: capitalize;
}
.message-author.adrian { color: var(--author-adrian); }
.message-author.claude { color: var(--author-claude); }
.message-author.openclaw { color: var(--author-openclaw); }
.message-author.system { color: var(--author-system); }
.message-author.chatgpt { color: var(--author-chatgpt); }
.message-author.gemini { color: var(--author-gemini); }
.message-type {
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 8px;
    background: var(--bg-tertiary);
    color: var(--text-muted);
}
.message-type.alert { background: rgba(248,81,73,0.15); color: var(--accent-red); }
.message-type.directive { background: rgba(88,166,255,0.15); color: var(--accent-blue); }
.message-type.observation { background: rgba(210,153,34,0.15); color: var(--accent-yellow); }
.message-time {
    font-size: 10px;
    color: var(--text-muted);
    margin-left: auto;
}
.message-content {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-primary);
    padding-left: 4px;
    white-space: pre-wrap;
    word-break: break-word;
}
.message.system .message-content {
    color: var(--text-muted);
    font-style: italic;
    font-size: 12px;
}

/* ---- Input ---- */
.input-area {
    padding: 10px 16px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
}
.input-area input {
    flex: 1;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 12px;
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
}
.input-area input:focus { border-color: var(--accent-blue); }
.input-area input::placeholder { color: var(--text-muted); }
.input-area button {
    background: var(--accent-blue);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}
.input-area button:hover { opacity: 0.9; }

/* ---- Sidebar ---- */
.sidebar {
    width: 340px;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
}

/* ---- Tab Navigation ---- */
.tab-nav {
    display: flex;
    border-bottom: 1px solid var(--border);
    background: var(--bg-tertiary);
    flex-shrink: 0;
}
.tab-btn {
    flex: 1;
    padding: 9px 0;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.tab-btn:hover { color: var(--text-secondary); }
.tab-btn.active {
    color: var(--accent-blue);
    border-bottom-color: var(--accent-blue);
}

/* ---- Tab Content ---- */
.tab-content {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}
.tab-content.active { display: block; }
.tab-content::-webkit-scrollbar { width: 5px; }
.tab-content::-webkit-scrollbar-track { background: transparent; }
.tab-content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ---- Panels ---- */
.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 6px;
}
.panel-header {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
}

/* ---- Participants ---- */
.participant {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
    font-size: 12px;
}
.dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}
.dot.adrian { background: var(--author-adrian); }
.dot.claude { background: var(--author-claude); }
.dot.openclaw { background: var(--author-openclaw); }
.dot.chatgpt { background: var(--author-chatgpt); }
.dot.gemini { background: var(--author-gemini); }

/* ---- Stat Rows ---- */
.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 2px 0;
    font-size: 12px;
}
.stat-row .label { color: var(--text-secondary); }
.stat-row .value { color: var(--text-primary); font-weight: 500; }

/* ---- Refresh Buttons ---- */
.refresh-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 4px;
    padding: 0 5px;
    font-size: 12px;
    cursor: pointer;
    margin-left: auto;
    line-height: 1.3;
}
.refresh-btn:hover {
    color: var(--accent-blue);
    border-color: var(--accent-blue);
}

/* ---- Compact Lists ---- */
.compact-list {
    max-height: 220px;
    overflow-y: auto;
}
.compact-list::-webkit-scrollbar { width: 3px; }
.compact-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.compact-row {
    display: flex;
    align-items: center;
    padding: 2px 0;
    font-size: 11px;
}
.compact-name {
    color: var(--text-primary);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.compact-status {
    color: var(--text-muted);
    font-size: 10px;
    margin-left: 8px;
    white-space: nowrap;
}
.muted { font-size: 11px; color: var(--text-muted); }

/* ---- Action Buttons ---- */
.action-btn {
    font-size: 10px;
    padding: 2px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    margin-left: 4px;
    transition: all 0.15s;
}
.action-btn:hover {
    color: var(--text-primary);
    border-color: var(--text-muted);
}
.action-btn-danger {
    background: rgba(248,81,73,0.15);
    color: var(--accent-red);
    border-color: rgba(248,81,73,0.3);
}
.action-btn-danger:hover {
    background: rgba(248,81,73,0.3);
    border-color: var(--accent-red);
}
.action-btn-blue {
    background: var(--accent-blue);
    color: #fff;
    border-color: var(--accent-blue);
}
.action-btn-blue:hover { opacity: 0.85; }
.action-btn-cancel {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}
.action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ---- Action Grid (Quick Actions) ---- */
.action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}
.action-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 10px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    text-align: center;
}
.action-card:hover {
    border-color: var(--accent-blue);
    background: rgba(88,166,255,0.08);
}
.action-card.confirm-required:hover {
    border-color: var(--accent-yellow);
    background: rgba(210,153,34,0.08);
}
.action-card-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-primary);
}
.action-card-desc {
    font-size: 9px;
    color: var(--text-muted);
    margin-top: 2px;
}
.action-card.running {
    border-color: var(--accent-blue);
    position: relative;
    overflow: hidden;
}
.action-card.running::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0;
    height: 2px;
    background: var(--accent-blue);
    animation: progress 2s ease-in-out infinite;
    width: 100%;
}
@keyframes progress {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ---- Control Row (Docker/Service inline actions) ---- */
.control-row {
    display: flex;
    align-items: center;
    padding: 3px 0;
    font-size: 11px;
    border-bottom: 1px solid var(--border-light);
}
.control-row:last-child { border-bottom: none; }
.control-row .ctrl-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    margin-right: 6px;
    flex-shrink: 0;
}
.control-row .ctrl-name {
    flex: 1;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.control-row .ctrl-status {
    color: var(--text-muted);
    font-size: 10px;
    margin-right: 6px;
}
.control-row .ctrl-actions {
    display: flex;
    gap: 3px;
    flex-shrink: 0;
}

/* ---- OpenClaw Task Input ---- */
.openclaw-task-input {
    display: flex;
    gap: 6px;
}
.openclaw-task-input input {
    flex: 1;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 6px 8px;
    color: var(--text-primary);
    font-size: 11px;
    outline: none;
}
.openclaw-task-input input:focus { border-color: var(--accent-blue); }
.openclaw-task-input input::placeholder { color: var(--text-muted); }

/* ---- Confirmation Modal ---- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    max-width: 360px;
    width: 90%;
}
.modal-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--accent-yellow);
}
.modal-body {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.5;
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}
.modal-actions .action-btn {
    font-size: 12px;
    padding: 6px 16px;
}

/* ---- Responsive ---- */
@media (max-width: 900px) { .sidebar { width: 300px; } }
@media (max-width: 768px) { .sidebar { display: none; } .feed-container { border-right: none; } }

/* === Hub Banner === */
.hub-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: 500;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    animation: bannerPulse 2s ease-in-out infinite;
}
.hub-banner.info { background: #1a3a5c; color: #7cb3e0; }
.hub-banner.warning { background: #5c4a1a; color: #e0c77c; }
.hub-banner.success { background: #1a5c2a; color: #7ce08c; }
.hub-banner.error { background: #5c1a1a; color: #e07c7c; }
.banner-time { margin-left: auto; font-size: 0.75rem; opacity: 0.6; }
.banner-dismiss {
    background: none; border: none; color: inherit; font-size: 1.2rem;
    cursor: pointer; opacity: 0.5; padding: 0 4px;
}
.banner-dismiss:hover { opacity: 1; }
@keyframes bannerPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.85; }
}
