/* ═══════════════════════════════════════════════════════════════════════════
 * SYNC BAR + HEALTH CHECK styles
 * Used by index.html (in-shell tabs) and every iframe page that opts into the
 * unified per-tab health-check chrome. Depends only on css/tokens.css.
 * Lives in <div data-sync-bar="<tabId>">; markup is built by js/sync-bar.js.
 * ═══════════════════════════════════════════════════════════════════════════ */

.sync-bar {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin: 0 0 var(--space-4) 0;
    font-size: var(--fs-sm);
    color: var(--text-secondary);
    box-shadow: var(--shadow-sm);
}
.sync-bar-dot {
    flex: 0 0 auto;
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--text-muted);
}
.sync-bar-dot.green { background: var(--success); }
.sync-bar-dot.amber { background: var(--warning); }
.sync-bar-dot.red   { background: var(--danger); }
.sync-bar-dot.blue  { background: var(--info); animation: sync-bar-pulse 1.4s ease-in-out infinite; }
.sync-bar-dot.gray  { background: var(--text-muted); }
@keyframes sync-bar-pulse { 0%,100% { opacity: 1 } 50% { opacity: 0.35 } }

.sync-bar-time {
    flex: 1 1 auto;
    font-variant-numeric: tabular-nums;
}
.sync-bar-refresh,
.sync-bar-health {
    flex: 0 0 auto;
    font: inherit;
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.sync-bar-refresh {
    background: var(--bg-surface-2);
    border: 1px solid var(--border-default);
    color: var(--text-primary);
}
.sync-bar-refresh:hover:not(:disabled) {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
}
.sync-bar-refresh:disabled { opacity: 0.55; cursor: wait; }

.sync-bar-health {
    border: 1px solid transparent;
    background: var(--bg-subtle);
    color: var(--text-secondary);
}
.sync-bar-health.green { background: var(--success-bg); color: var(--success); border-color: color-mix(in srgb, var(--success) 25%, transparent); }
.sync-bar-health.amber { background: var(--warning-bg); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 30%, transparent); }
.sync-bar-health.red   { background: var(--danger-bg);  color: var(--danger);  border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.sync-bar-health:hover { filter: brightness(0.97); }

.sync-bar-drawer {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    margin: -10px 0 var(--space-4) 0;
    box-shadow: var(--shadow-sm);
}
.sync-bar-drawer-header {
    display: flex; align-items: center;
    margin-bottom: var(--space-3);
    color: var(--text-primary);
}
.sync-bar-rerun {
    margin-left: auto;
    background: var(--bg-surface-2);
    border: 1px solid var(--border-default);
    color: var(--text-secondary);
    padding: 2px 10px;
    border-radius: var(--radius-sm);
    font-size: var(--fs-xs);
    cursor: pointer;
}
.sync-bar-rerun:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }

.sync-check-group { margin-bottom: var(--space-3); }
.sync-check-group:last-child { margin-bottom: 0; }
.sync-check-heading {
    font-size: var(--fs-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: var(--fw-semibold);
    margin-bottom: var(--space-2);
}
.sync-check-item {
    display: flex; gap: var(--space-2);
    padding: var(--space-2);
    border-left: 3px solid transparent;
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    background: var(--bg-surface-2);
}
.sync-check-item.pass { border-left-color: var(--success); }
.sync-check-item.warn { border-left-color: var(--warning); background: var(--warning-bg); }
.sync-check-item.fail { border-left-color: var(--danger); background: var(--danger-bg); }
.sync-check-icon {
    flex: 0 0 auto;
    width: 18px; text-align: center;
    font-weight: var(--fw-bold);
    font-size: var(--fs-md);
    line-height: 1.4;
}
.sync-check-item.pass .sync-check-icon { color: var(--success); }
.sync-check-item.warn .sync-check-icon { color: var(--warning); }
.sync-check-item.fail .sync-check-icon { color: var(--danger); }
.sync-check-body { flex: 1 1 auto; }
.sync-check-name { color: var(--text-primary); font-weight: var(--fw-medium); font-size: var(--fs-sm); }
.sync-check-name .sync-check-active-tag {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: var(--radius-sm);
    background: var(--info-bg);
    color: var(--info);
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.sync-check-detail { color: var(--text-secondary); font-size: var(--fs-xs); margin-top: 2px; }
