/* Dogged Dashboard — Dark theme overrides on Pico CSS */

:root {
    --brand: #4ecdc4;
    --brand-dim: #2a7a74;
    --dirt-handler: #e8a87c;
    --dirt-dog: #85dcb0;
    --dirt-system: #7eb8da;
    --scratch-color: #d4a5e5;
    --hash-color: #888;
    --danger: #e76f51;
    --success: #4ecdc4;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============================================================
   Top Bar
   ============================================================ */

.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--pico-muted-border-color);
    flex-shrink: 0;
    height: 48px;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.yard-title {
    font-size: 1.1rem;
    color: var(--brand);
}

.status-badge {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.status-badge.healthy { background: var(--success); color: #111; }
.status-badge.degraded { background: var(--danger); color: #fff; }
.status-badge.unknown { background: #555; color: #ccc; }

.top-bar-center {
    display: flex;
    gap: 1.5rem;
    font-size: 0.8rem;
    color: var(--pico-muted-color);
}
.stat-value { color: var(--brand); font-weight: 600; }

.chain-badge {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 12px;
}
.chain-badge.valid { background: rgba(78,205,196,0.2); color: var(--success); }
.chain-badge.broken { background: rgba(231,111,81,0.2); color: var(--danger); }

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.connect-btn {
    font-size: 0.75rem;
    padding: 4px 12px;
    margin: 0;
}

.settings-btn {
    background: none;
    border: none;
    color: var(--pico-muted-color);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px;
    margin: 0;
    width: auto;
}

/* ============================================================
   Split View
   ============================================================ */

.split-view {
    display: flex;
    flex: 1;
    overflow: hidden;
    height: calc(100vh - 48px);
}

.feed-panel {
    width: 40%;
    min-width: 300px;
    border-right: 1px solid var(--pico-muted-border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.graph-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--pico-muted-border-color);
    flex-shrink: 0;
}

.panel-header h3 {
    margin: 0;
    font-size: 0.9rem;
    color: var(--pico-muted-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.poll-indicator {
    color: var(--success);
    font-size: 0.7rem;
    text-transform: uppercase;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.refresh-btn {
    background: none;
    border: none;
    color: var(--pico-muted-color);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 2px 6px;
    margin: 0;
    width: auto;
}
.refresh-btn:hover { color: var(--brand); }

/* ============================================================
   Feed Items
   ============================================================ */

.feed-list {
    overflow-y: auto;
    flex: 1;
    padding: 0.5rem;
}

.feed-item {
    padding: 0.6rem 0.8rem;
    margin-bottom: 0.4rem;
    border-radius: 6px;
    background: rgba(255,255,255,0.03);
    border-left: 3px solid transparent;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.feed-item.type-handler { border-left-color: var(--dirt-handler); }
.feed-item.type-dog { border-left-color: var(--dirt-dog); }
.feed-item.type-system { border-left-color: var(--dirt-system); }
.feed-item.scratch-thread { border-left-color: var(--scratch-color); }

.feed-item-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-bottom: 0.3rem;
}

.event-type-badge {
    font-size: 0.65rem;
    padding: 1px 6px;
    border-radius: 3px;
    background: rgba(255,255,255,0.1);
    color: var(--pico-color);
    text-transform: lowercase;
}

.event-type-badge.scratch {
    background: rgba(212,165,229,0.2);
    color: var(--scratch-color);
}

.source-badge {
    font-size: 0.6rem;
    color: var(--pico-muted-color);
}

.hash-chain {
    margin-left: auto;
    font-size: 0.6rem;
    font-family: monospace;
    color: var(--hash-color);
    display: flex;
    align-items: center;
    gap: 0.2rem;
}

.chain-arrow { color: var(--brand-dim); }

.feed-item-body {
    font-size: 0.8rem;
    color: var(--pico-color);
    line-height: 1.4;
    word-break: break-word;
}

.feed-item-footer {
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    color: var(--pico-muted-color);
    margin-top: 0.3rem;
}

.tag-pill {
    font-size: 0.6rem;
    padding: 1px 6px;
    border-radius: 10px;
    background: rgba(212,165,229,0.15);
    color: var(--scratch-color);
}

.feed-empty {
    text-align: center;
    color: var(--pico-muted-color);
    padding: 2rem;
    font-size: 0.9rem;
}

/* ============================================================
   Graph
   ============================================================ */

.graph-container {
    flex: 1;
    overflow: hidden;
}

#graph-svg {
    width: 100%;
    height: 100%;
}

.node circle {
    stroke: rgba(255,255,255,0.2);
    stroke-width: 1.5;
    cursor: pointer;
}
.node circle:hover { stroke: var(--brand); stroke-width: 2.5; }

.node text {
    font-size: 10px;
    fill: var(--pico-muted-color);
    pointer-events: none;
}

.link {
    stroke: rgba(255,255,255,0.08);
    stroke-width: 1;
}

.link-label {
    font-size: 8px;
    fill: rgba(255,255,255,0.3);
}

/* ============================================================
   Node Detail
   ============================================================ */

.node-detail {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--pico-background-color);
    border-top: 1px solid var(--pico-muted-border-color);
    padding: 0.8rem 1rem;
    max-height: 200px;
    overflow-y: auto;
}

.node-detail-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.kind-badge {
    font-size: 0.65rem;
    padding: 1px 6px;
    border-radius: 3px;
    background: rgba(78,205,196,0.15);
    color: var(--brand);
}

.close-btn {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--pico-muted-color);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    width: auto;
}

.prop-row {
    display: flex;
    gap: 0.5rem;
    font-size: 0.75rem;
    padding: 2px 0;
}
.prop-key { color: var(--pico-muted-color); min-width: 100px; }
.prop-val { color: var(--pico-color); }

/* ============================================================
   Dialog / Settings
   ============================================================ */

dialog {
    max-width: 400px;
}

dialog article {
    margin: 0;
}
